Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/argz/argz_count.c1
-rw-r--r--newlib/libc/argz/argz_extract.c1
-rw-r--r--newlib/libc/argz/argz_stringify.c1
-rw-r--r--newlib/libc/ctype/ctype_.c3
-rw-r--r--newlib/libc/ctype/isalnum.c2
-rw-r--r--newlib/libc/ctype/isalpha.c2
-rw-r--r--newlib/libc/ctype/iscntrl.c2
-rw-r--r--newlib/libc/ctype/isdigit.c2
-rw-r--r--newlib/libc/ctype/islower.c2
-rw-r--r--newlib/libc/ctype/isprint.c4
-rw-r--r--newlib/libc/ctype/ispunct.c2
-rw-r--r--newlib/libc/ctype/isspace.c2
-rw-r--r--newlib/libc/ctype/isupper.c2
-rw-r--r--newlib/libc/ctype/isxdigit.c2
-rw-r--r--newlib/libc/include/_ansi.h6
-rw-r--r--newlib/libc/include/_syslist.h1
-rw-r--r--newlib/libc/include/assert.h8
-rw-r--r--newlib/libc/include/ctype.h28
-rw-r--r--newlib/libc/include/getopt.h102
-rw-r--r--newlib/libc/include/machine/_default_types.h4
-rw-r--r--newlib/libc/include/machine/ieeefp.h2
-rw-r--r--newlib/libc/include/machine/setjmp.h25
-rw-r--r--newlib/libc/include/math.h6
-rw-r--r--newlib/libc/include/reent.h87
-rw-r--r--newlib/libc/include/stdint.h3
-rw-r--r--newlib/libc/include/stdio.h5
-rw-r--r--newlib/libc/include/string.h6
-rw-r--r--newlib/libc/include/sys/_default_fcntl.h17
-rw-r--r--newlib/libc/include/sys/reent.h198
-rw-r--r--newlib/libc/include/sys/stat.h15
-rw-r--r--newlib/libc/include/sys/unistd.h17
-rw-r--r--newlib/libc/libc.texinfo15
-rw-r--r--newlib/libc/machine/arm/setjmp.S10
-rwxr-xr-xnewlib/libc/machine/configure6558
-rw-r--r--newlib/libc/machine/i386/memchr.S88
-rw-r--r--newlib/libc/machine/i386/memset.S69
-rw-r--r--newlib/libc/machine/i386/strchr.S113
-rw-r--r--newlib/libc/machine/i386/strlen.S65
-rw-r--r--newlib/libc/machine/m68k/m68kasm.h40
-rw-r--r--newlib/libc/machine/m68k/memcpy.S64
-rw-r--r--newlib/libc/machine/m68k/memset.S72
-rw-r--r--newlib/libc/machine/m68k/setjmp.S41
-rw-r--r--newlib/libc/machine/mips/strncpy.c21
-rw-r--r--newlib/libc/machine/mn10300/memset.S2
-rw-r--r--newlib/libc/machine/powerpc/vfprintf.c31
-rw-r--r--newlib/libc/machine/spu/Makefile.am31
-rw-r--r--newlib/libc/machine/spu/Makefile.in200
-rw-r--r--newlib/libc/machine/spu/assert.c41
-rw-r--r--newlib/libc/machine/spu/fprintf.S2
-rw-r--r--newlib/libc/machine/spu/fscanf.S2
-rw-r--r--newlib/libc/machine/spu/impure.c14
-rw-r--r--newlib/libc/machine/spu/include/spu_timer.h85
-rw-r--r--newlib/libc/machine/spu/memcmp.c43
-rw-r--r--newlib/libc/machine/spu/mk_syscalls3
-rw-r--r--newlib/libc/machine/spu/printf.S2
-rw-r--r--newlib/libc/machine/spu/scanf.S2
-rw-r--r--newlib/libc/machine/spu/setjmp.S4
-rw-r--r--newlib/libc/machine/spu/snprintf.S2
-rw-r--r--newlib/libc/machine/spu/sprintf.S2
-rw-r--r--newlib/libc/machine/spu/spu_clock_stop.c67
-rw-r--r--newlib/libc/machine/spu/spu_clock_svcs.c93
-rw-r--r--newlib/libc/machine/spu/spu_timebase.c51
-rw-r--r--newlib/libc/machine/spu/spu_timer_flih.S152
-rw-r--r--newlib/libc/machine/spu/spu_timer_free.c86
-rw-r--r--newlib/libc/machine/spu/spu_timer_internal.h140
-rw-r--r--newlib/libc/machine/spu/spu_timer_slih.c221
-rw-r--r--newlib/libc/machine/spu/spu_timer_slih_reg.c72
-rw-r--r--newlib/libc/machine/spu/spu_timer_stop.c101
-rw-r--r--newlib/libc/machine/spu/spu_timer_svcs.c115
-rw-r--r--newlib/libc/machine/spu/sscanf.S2
-rw-r--r--newlib/libc/machine/spu/stack_reg_va.S4
-rw-r--r--newlib/libc/machine/spu/straddr.h75
-rw-r--r--newlib/libc/machine/spu/strcat.c27
-rw-r--r--newlib/libc/machine/spu/strcpy.c17
-rw-r--r--newlib/libc/machine/spu/strcpy.h184
-rw-r--r--newlib/libc/machine/spu/strlen.c22
-rw-r--r--newlib/libc/machine/spu/strncat.c69
-rw-r--r--newlib/libc/machine/spu/strncmp.c99
-rw-r--r--newlib/libc/machine/spu/strncmp.h155
-rw-r--r--newlib/libc/machine/spu/strncpy.c59
-rw-r--r--newlib/libc/machine/spu/sys/dirent.h6
-rw-r--r--newlib/libc/machine/spu/sys/errno.h10
-rw-r--r--newlib/libc/machine/spu/sys/linux_syscalls.h294
-rw-r--r--newlib/libc/machine/spu/sys/sched.h6
-rw-r--r--newlib/libc/machine/spu/sys/syscall.h6
-rw-r--r--newlib/libc/posix/Makefile.am2
-rw-r--r--newlib/libc/posix/Makefile.in22
-rw-r--r--newlib/libc/posix/_isatty.c17
-rw-r--r--newlib/libc/posix/isatty.c13
-rw-r--r--newlib/libc/reent/Makefile.am1
-rw-r--r--newlib/libc/reent/Makefile.in27
-rw-r--r--newlib/libc/reent/isattyr.c63
-rw-r--r--newlib/libc/search/hash.h2
-rw-r--r--newlib/libc/stdio/Makefile.am18
-rw-r--r--newlib/libc/stdio/Makefile.in25
-rw-r--r--newlib/libc/stdio/asiprintf.c6
-rw-r--r--newlib/libc/stdio/asniprintf.c6
-rw-r--r--newlib/libc/stdio/asnprintf.c6
-rw-r--r--newlib/libc/stdio/asprintf.c4
-rw-r--r--newlib/libc/stdio/dprintf.c1
-rw-r--r--newlib/libc/stdio/fflush.c2
-rw-r--r--newlib/libc/stdio/freopen.c2
-rw-r--r--newlib/libc/stdio/ftell.c9
-rw-r--r--newlib/libc/stdio/local.h8
-rw-r--r--newlib/libc/stdio/makebuf.c2
-rw-r--r--newlib/libc/stdio/rget.c4
-rw-r--r--newlib/libc/stdio/siprintf.c4
-rw-r--r--newlib/libc/stdio/siscanf.c4
-rw-r--r--newlib/libc/stdio/sniprintf.c4
-rw-r--r--newlib/libc/stdio/snprintf.c4
-rw-r--r--newlib/libc/stdio/sprintf.c4
-rw-r--r--newlib/libc/stdio/sscanf.c4
-rw-r--r--newlib/libc/stdio/vasiprintf.c2
-rw-r--r--newlib/libc/stdio/vasniprintf.c4
-rw-r--r--newlib/libc/stdio/vasnprintf.c2
-rw-r--r--newlib/libc/stdio/vasprintf.c2
-rw-r--r--newlib/libc/stdio/vdiprintf.c1
-rw-r--r--newlib/libc/stdio/vdprintf.c1
-rw-r--r--newlib/libc/stdio/vfprintf.c162
-rw-r--r--newlib/libc/stdio/vfscanf.c154
-rw-r--r--newlib/libc/stdio/vsiprintf.c2
-rw-r--r--newlib/libc/stdio/vsiscanf.c2
-rw-r--r--newlib/libc/stdio/vsniprintf.c2
-rw-r--r--newlib/libc/stdio/vsnprintf.c4
-rw-r--r--newlib/libc/stdio/vsprintf.c2
-rw-r--r--newlib/libc/stdio/vsscanf.c2
-rw-r--r--newlib/libc/stdio64/ftello64.c9
-rw-r--r--newlib/libc/stdlib/envlock.h15
-rw-r--r--newlib/libc/stdlib/gdtoa-hexnan.c2
-rw-r--r--newlib/libc/stdlib/getopt.c433
-rw-r--r--newlib/libc/stdlib/mprec.h49
-rw-r--r--newlib/libc/stdlib/strtod.c65
-rw-r--r--newlib/libc/stdlib/wcsrtombs.c2
-rw-r--r--newlib/libc/string/Makefile.am30
-rw-r--r--newlib/libc/string/Makefile.in63
-rw-r--r--newlib/libc/string/memchr.c81
-rw-r--r--newlib/libc/string/memmem.c102
-rw-r--r--newlib/libc/string/memset.c53
-rw-r--r--newlib/libc/string/str-two-way.h415
-rw-r--r--newlib/libc/string/strcasestr.c57
-rw-r--r--newlib/libc/string/strchr.c69
-rw-r--r--newlib/libc/string/strings.tex4
-rw-r--r--newlib/libc/string/strlen.c42
-rw-r--r--newlib/libc/string/strstr.c54
-rw-r--r--newlib/libc/sys/a29khif/_isatty.S2
-rw-r--r--newlib/libc/sys/arc/isatty.c5
-rw-r--r--newlib/libc/sys/arm/syscalls.c4
-rwxr-xr-xnewlib/libc/sys/configure6529
-rw-r--r--newlib/libc/sys/d10v/syscalls.c2
-rw-r--r--newlib/libc/sys/h8300hms/syscalls.c2
-rw-r--r--newlib/libc/sys/h8500hms/syscalls.c2
-rw-r--r--newlib/libc/sys/linux/Makefile.am1
-rw-r--r--newlib/libc/sys/linux/Makefile.in83
-rw-r--r--newlib/libc/sys/linux/bits/libc-lock.h2
-rw-r--r--newlib/libc/sys/linux/iconv/iconvconfig.c1176
-rw-r--r--newlib/libc/sys/linux/iconv/strtab.c341
-rw-r--r--newlib/libc/sys/linux/include/arpa/nameser.h174
-rw-r--r--newlib/libc/sys/linux/include/hesiod.h102
-rw-r--r--newlib/libc/sys/linux/include/libc_private.h72
-rw-r--r--newlib/libc/sys/linux/include/net/ethernet.h166
-rw-r--r--newlib/libc/sys/linux/include/net/if_atm.h107
-rw-r--r--newlib/libc/sys/linux/include/net/if_media.h409
-rw-r--r--newlib/libc/sys/linux/include/net/if_ppp.h148
-rw-r--r--newlib/libc/sys/linux/include/net/if_pppvar.h109
-rw-r--r--newlib/libc/sys/linux/include/netdb.h50
-rw-r--r--newlib/libc/sys/linux/include/netinet/if_atm.h47
-rw-r--r--newlib/libc/sys/linux/include/netinet/if_ether.h3
-rw-r--r--newlib/libc/sys/linux/include/netinet/ip_flow.h57
-rw-r--r--newlib/libc/sys/linux/include/nsswitch.h184
-rw-r--r--newlib/libc/sys/linux/include/resolv.h115
-rw-r--r--newlib/libc/sys/linux/include/sched.h3
-rw-r--r--newlib/libc/sys/linux/include/stdint.h29
-rw-r--r--newlib/libc/sys/linux/intl/locale.alias75
-rw-r--r--newlib/libc/sys/linux/isatty.c34
-rw-r--r--newlib/libc/sys/linux/libc-symbols.h27
-rw-r--r--newlib/libc/sys/linux/machine/i386/atomic.h366
-rw-r--r--newlib/libc/sys/linux/machine/i386/get_clockfreq.c27
-rw-r--r--newlib/libc/sys/linux/machine/i386/include/endian.h11
-rw-r--r--newlib/libc/sys/linux/machine/i386/include/param.h2
-rw-r--r--newlib/libc/sys/linux/net/Makefile.am48
-rw-r--r--newlib/libc/sys/linux/net/Makefile.in1061
-rw-r--r--newlib/libc/sys/linux/net/XXX-lookup.c75
-rw-r--r--newlib/libc/sys/linux/net/addr2ascii.3222
-rw-r--r--newlib/libc/sys/linux/net/alias-lookup.c22
-rw-r--r--newlib/libc/sys/linux/net/aliases.h64
-rw-r--r--newlib/libc/sys/linux/net/base64.c24
-rw-r--r--newlib/libc/sys/linux/net/bindresvport.c160
-rw-r--r--newlib/libc/sys/linux/net/byteorder.384
-rw-r--r--newlib/libc/sys/linux/net/check_pf.c199
-rw-r--r--newlib/libc/sys/linux/net/databases.def40
-rw-r--r--newlib/libc/sys/linux/net/digits_dots.c317
-rw-r--r--newlib/libc/sys/linux/net/ether_addr.c231
-rw-r--r--newlib/libc/sys/linux/net/ether_aton.c29
-rw-r--r--newlib/libc/sys/linux/net/ether_aton_r.c64
-rw-r--r--newlib/libc/sys/linux/net/ether_hton.c83
-rw-r--r--newlib/libc/sys/linux/net/ether_line.c81
-rw-r--r--newlib/libc/sys/linux/net/ether_ntoa.c30
-rw-r--r--newlib/libc/sys/linux/net/ether_ntoa_r.c34
-rw-r--r--newlib/libc/sys/linux/net/ether_ntoh.c86
-rw-r--r--newlib/libc/sys/linux/net/etherent.h9
-rw-r--r--newlib/libc/sys/linux/net/ethers-lookup.c22
-rw-r--r--newlib/libc/sys/linux/net/ethers.3197
-rw-r--r--newlib/libc/sys/linux/net/function.def78
-rw-r--r--newlib/libc/sys/linux/net/getXXbyYY.c156
-rw-r--r--newlib/libc/sys/linux/net/getXXbyYY_r.c292
-rw-r--r--newlib/libc/sys/linux/net/getXXent.c96
-rw-r--r--newlib/libc/sys/linux/net/getXXent_r.c209
-rw-r--r--newlib/libc/sys/linux/net/getaddrinfo.3620
-rw-r--r--newlib/libc/sys/linux/net/getaddrinfo.c3416
-rw-r--r--newlib/libc/sys/linux/net/getaliasent.c26
-rw-r--r--newlib/libc/sys/linux/net/getaliasent_r.c29
-rw-r--r--newlib/libc/sys/linux/net/getaliasname.c30
-rw-r--r--newlib/libc/sys/linux/net/getaliasname_r.c29
-rw-r--r--newlib/libc/sys/linux/net/gethostbydns.c815
-rw-r--r--newlib/libc/sys/linux/net/gethostbyht.c285
-rw-r--r--newlib/libc/sys/linux/net/gethostbyname.3380
-rw-r--r--newlib/libc/sys/linux/net/gethostbynis.c281
-rw-r--r--newlib/libc/sys/linux/net/gethostnamadr.c221
-rw-r--r--newlib/libc/sys/linux/net/gethstbyad.c31
-rw-r--r--newlib/libc/sys/linux/net/gethstbyad_r.c53
-rw-r--r--newlib/libc/sys/linux/net/gethstbynm.c38
-rw-r--r--newlib/libc/sys/linux/net/gethstbynm2.c39
-rw-r--r--newlib/libc/sys/linux/net/gethstbynm2_r.c46
-rw-r--r--newlib/libc/sys/linux/net/gethstbynm_r.c45
-rw-r--r--newlib/libc/sys/linux/net/gethstent.c27
-rw-r--r--newlib/libc/sys/linux/net/gethstent_r.c35
-rw-r--r--newlib/libc/sys/linux/net/getifaddrs.3164
-rw-r--r--newlib/libc/sys/linux/net/getifaddrs.c401
-rw-r--r--newlib/libc/sys/linux/net/getipnodebyname.3461
-rw-r--r--newlib/libc/sys/linux/net/getnameinfo.3311
-rw-r--r--newlib/libc/sys/linux/net/getnameinfo.c768
-rw-r--r--newlib/libc/sys/linux/net/getnetbyad.c32
-rw-r--r--newlib/libc/sys/linux/net/getnetbyad_r.c32
-rw-r--r--newlib/libc/sys/linux/net/getnetbydns.c327
-rw-r--r--newlib/libc/sys/linux/net/getnetbyht.c183
-rw-r--r--newlib/libc/sys/linux/net/getnetbynis.c190
-rw-r--r--newlib/libc/sys/linux/net/getnetbynm.c31
-rw-r--r--newlib/libc/sys/linux/net/getnetbynm_r.c31
-rw-r--r--newlib/libc/sys/linux/net/getnetent.3172
-rw-r--r--newlib/libc/sys/linux/net/getnetent.c27
-rw-r--r--newlib/libc/sys/linux/net/getnetent_r.c32
-rw-r--r--newlib/libc/sys/linux/net/getnetgrent.c52
-rw-r--r--newlib/libc/sys/linux/net/getnetgrent_r.c446
-rw-r--r--newlib/libc/sys/linux/net/getnetnamadr.c113
-rw-r--r--newlib/libc/sys/linux/net/getnssent.c58
-rw-r--r--newlib/libc/sys/linux/net/getnssent_r.c218
-rw-r--r--newlib/libc/sys/linux/net/getproto.c75
-rw-r--r--newlib/libc/sys/linux/net/getproto_r.c29
-rw-r--r--newlib/libc/sys/linux/net/getprotoent.3149
-rw-r--r--newlib/libc/sys/linux/net/getprotoent.c121
-rw-r--r--newlib/libc/sys/linux/net/getprotoname.c64
-rw-r--r--newlib/libc/sys/linux/net/getprtent.c26
-rw-r--r--newlib/libc/sys/linux/net/getprtent_r.c30
-rw-r--r--newlib/libc/sys/linux/net/getprtname.c30
-rw-r--r--newlib/libc/sys/linux/net/getprtname_r.c29
-rw-r--r--newlib/libc/sys/linux/net/getrpcbyname.c30
-rw-r--r--newlib/libc/sys/linux/net/getrpcbyname_r.c29
-rw-r--r--newlib/libc/sys/linux/net/getrpcbynumber.c30
-rw-r--r--newlib/libc/sys/linux/net/getrpcbynumber_r.c29
-rw-r--r--newlib/libc/sys/linux/net/getrpcent.c26
-rw-r--r--newlib/libc/sys/linux/net/getrpcent_r.c30
-rw-r--r--newlib/libc/sys/linux/net/getservbyname.c81
-rw-r--r--newlib/libc/sys/linux/net/getservbyport.c76
-rw-r--r--newlib/libc/sys/linux/net/getservent.3158
-rw-r--r--newlib/libc/sys/linux/net/getservent.c294
-rw-r--r--newlib/libc/sys/linux/net/getservent_r.c30
-rw-r--r--newlib/libc/sys/linux/net/getsrvbynm.c30
-rw-r--r--newlib/libc/sys/linux/net/getsrvbynm_r.c29
-rw-r--r--newlib/libc/sys/linux/net/getsrvbypt.c30
-rw-r--r--newlib/libc/sys/linux/net/getsrvbypt_r.c29
-rw-r--r--newlib/libc/sys/linux/net/grp-lookup.c23
-rw-r--r--newlib/libc/sys/linux/net/herrno.c6
-rw-r--r--newlib/libc/sys/linux/net/herror.c103
-rw-r--r--newlib/libc/sys/linux/net/hesiod.3159
-rw-r--r--newlib/libc/sys/linux/net/hesiod.c600
-rw-r--r--newlib/libc/sys/linux/net/hosts-lookup.c23
-rw-r--r--newlib/libc/sys/linux/net/if_indextoname.3142
-rw-r--r--newlib/libc/sys/linux/net/ifaddrs.h74
-rw-r--r--newlib/libc/sys/linux/net/ifreq.c100
-rw-r--r--newlib/libc/sys/linux/net/ifreq.h40
-rw-r--r--newlib/libc/sys/linux/net/in6_addr.c28
-rw-r--r--newlib/libc/sys/linux/net/inet.3271
-rw-r--r--newlib/libc/sys/linux/net/inet6_option.c346
-rw-r--r--newlib/libc/sys/linux/net/inet6_option_space.3445
-rw-r--r--newlib/libc/sys/linux/net/inet6_rthdr_space.3323
-rw-r--r--newlib/libc/sys/linux/net/inet_lnaof.c16
-rw-r--r--newlib/libc/sys/linux/net/inet_makeaddr.c (renamed from newlib/libc/sys/linux/net/inet_mkadr.c)30
-rw-r--r--newlib/libc/sys/linux/net/inet_net.3157
-rw-r--r--newlib/libc/sys/linux/net/inet_netof.c18
-rw-r--r--newlib/libc/sys/linux/net/inet_network.c (renamed from newlib/libc/sys/linux/net/inet_net.c)49
-rw-r--r--newlib/libc/sys/linux/net/inet_ntoa.c151
-rw-r--r--newlib/libc/sys/linux/net/innetgr-stub.c7
-rw-r--r--newlib/libc/sys/linux/net/ip6opt.c387
-rw-r--r--newlib/libc/sys/linux/net/iso_addr.3113
-rw-r--r--newlib/libc/sys/linux/net/iso_addr.c119
-rw-r--r--newlib/libc/sys/linux/net/key-lookup.c23
-rw-r--r--newlib/libc/sys/linux/net/linkaddr.3140
-rw-r--r--newlib/libc/sys/linux/net/linkaddr.c160
-rw-r--r--newlib/libc/sys/linux/net/local.h24
-rw-r--r--newlib/libc/sys/linux/net/map_v4v6.c128
-rw-r--r--newlib/libc/sys/linux/net/name6.c1812
-rw-r--r--newlib/libc/sys/linux/net/namespace.h152
-rw-r--r--newlib/libc/sys/linux/net/netgroup.h80
-rw-r--r--newlib/libc/sys/linux/net/netgrp-lookup.c22
-rw-r--r--newlib/libc/sys/linux/net/network-lookup.c23
-rw-r--r--newlib/libc/sys/linux/net/not-cancel.h53
-rw-r--r--newlib/libc/sys/linux/net/ns.3133
-rw-r--r--newlib/libc/sys/linux/net/ns_addr.c239
-rw-r--r--newlib/libc/sys/linux/net/ns_name.c320
-rw-r--r--newlib/libc/sys/linux/net/ns_netint.c17
-rw-r--r--newlib/libc/sys/linux/net/ns_ntoa.c105
-rw-r--r--newlib/libc/sys/linux/net/ns_parse.c125
-rw-r--r--newlib/libc/sys/linux/net/ns_print.c143
-rw-r--r--newlib/libc/sys/linux/net/ns_samedomain.c204
-rw-r--r--newlib/libc/sys/linux/net/ns_ttl.c21
-rw-r--r--newlib/libc/sys/linux/net/nsap_addr.c41
-rw-r--r--newlib/libc/sys/linux/net/nscd-types.h22
-rw-r--r--newlib/libc/sys/linux/net/nscd/nscd-client.h312
-rw-r--r--newlib/libc/sys/linux/net/nscd/nscd_proto.h67
-rw-r--r--newlib/libc/sys/linux/net/nsdispatch.3231
-rw-r--r--newlib/libc/sys/linux/net/nsdispatch.c266
-rw-r--r--newlib/libc/sys/linux/net/nslexer.c1712
-rw-r--r--newlib/libc/sys/linux/net/nslexer.l114
-rw-r--r--newlib/libc/sys/linux/net/nsparser.c541
-rw-r--r--newlib/libc/sys/linux/net/nsparser.h13
-rw-r--r--newlib/libc/sys/linux/net/nsparser.y178
-rw-r--r--newlib/libc/sys/linux/net/nss.h52
-rw-r--r--newlib/libc/sys/linux/net/nsswitch.c772
-rw-r--r--newlib/libc/sys/linux/net/nsswitch.h180
-rw-r--r--newlib/libc/sys/linux/net/opensock.c120
-rw-r--r--newlib/libc/sys/linux/net/proto-lookup.c22
-rw-r--r--newlib/libc/sys/linux/net/pwd-lookup.c23
-rw-r--r--newlib/libc/sys/linux/net/rcmd.3298
-rw-r--r--newlib/libc/sys/linux/net/rcmd.c1190
-rw-r--r--newlib/libc/sys/linux/net/rcmdsh.3116
-rw-r--r--newlib/libc/sys/linux/net/res_comp.c74
-rw-r--r--newlib/libc/sys/linux/net/res_config.h10
-rw-r--r--newlib/libc/sys/linux/net/res_data.c303
-rw-r--r--newlib/libc/sys/linux/net/res_debug.c407
-rw-r--r--newlib/libc/sys/linux/net/res_debug.h34
-rw-r--r--newlib/libc/sys/linux/net/res_hconf.c676
-rw-r--r--newlib/libc/sys/linux/net/res_hconf.h55
-rw-r--r--newlib/libc/sys/linux/net/res_init.c495
-rw-r--r--newlib/libc/sys/linux/net/res_libc.c166
-rw-r--r--newlib/libc/sys/linux/net/res_mkquery.c137
-rw-r--r--newlib/libc/sys/linux/net/res_mkupdate.c412
-rw-r--r--newlib/libc/sys/linux/net/res_query.c315
-rw-r--r--newlib/libc/sys/linux/net/res_send.c1480
-rw-r--r--newlib/libc/sys/linux/net/res_update.c515
-rw-r--r--newlib/libc/sys/linux/net/resolver.3422
-rw-r--r--newlib/libc/sys/linux/net/rexec.c202
-rw-r--r--newlib/libc/sys/linux/net/rpc-lookup.c22
-rw-r--r--newlib/libc/sys/linux/net/rthdr.c319
-rw-r--r--newlib/libc/sys/linux/net/ruserpass.c336
-rw-r--r--newlib/libc/sys/linux/net/send.c1
-rw-r--r--newlib/libc/sys/linux/net/service-lookup.c22
-rw-r--r--newlib/libc/sys/linux/net/spwd-lookup.c24
-rw-r--r--newlib/libc/sys/linux/net/vars.c45
-rw-r--r--newlib/libc/sys/linux/shlib-compat.h1
-rw-r--r--newlib/libc/sys/linux/stdlib/COPYRIGHT56
-rw-r--r--newlib/libc/sys/linux/stdlib/Makefile.am41
-rw-r--r--newlib/libc/sys/linux/stdlib/Makefile.in537
-rw-r--r--newlib/libc/sys/linux/stdlib/cclass.h63
-rw-r--r--newlib/libc/sys/linux/stdlib/cname.h142
-rw-r--r--newlib/libc/sys/linux/stdlib/collate.c216
-rw-r--r--newlib/libc/sys/linux/stdlib/collate.h67
-rw-r--r--newlib/libc/sys/linux/stdlib/collcmp.c84
-rw-r--r--newlib/libc/sys/linux/stdlib/engine.c1139
-rw-r--r--newlib/libc/sys/linux/stdlib/fnmatch.3151
-rw-r--r--newlib/libc/sys/linux/stdlib/fnmatch.c232
-rw-r--r--newlib/libc/sys/linux/stdlib/glob.3466
-rw-r--r--newlib/libc/sys/linux/stdlib/glob.c909
-rw-r--r--newlib/libc/sys/linux/stdlib/reallocf.c40
-rw-r--r--newlib/libc/sys/linux/stdlib/regcomp.c2088
-rw-r--r--newlib/libc/sys/linux/stdlib/regerror.c178
-rw-r--r--newlib/libc/sys/linux/stdlib/regex.3701
-rw-r--r--newlib/libc/sys/linux/stdlib/regex2.h177
-rw-r--r--newlib/libc/sys/linux/stdlib/regexec.c182
-rw-r--r--newlib/libc/sys/linux/stdlib/regfree.c86
-rw-r--r--newlib/libc/sys/linux/stdlib/utils.h58
-rw-r--r--newlib/libc/sys/linux/stdlib/wordexp.c186
-rw-r--r--newlib/libc/sys/linux/stdlib/wordfree.c38
-rw-r--r--newlib/libc/sys/linux/sys/ioctl.h2
-rw-r--r--newlib/libc/sys/linux/sys/socket.h149
-rw-r--r--newlib/libc/sys/linux/sys/types.h2
-rw-r--r--newlib/libc/sys/linux/sys/unistd.h1
-rw-r--r--newlib/libc/sys/mmixware/isatty.c6
-rw-r--r--newlib/libc/sys/sh/syscalls.c7
-rw-r--r--newlib/libc/sys/sysnecv850/crt0.S7
-rw-r--r--newlib/libc/sys/sysnecv850/isatty.c2
-rw-r--r--newlib/libc/syscalls/Makefile.am1
-rw-r--r--newlib/libc/syscalls/Makefile.in41
-rw-r--r--newlib/libc/syscalls/sysclose.c4
-rw-r--r--newlib/libc/syscalls/sysexecve.c4
-rw-r--r--newlib/libc/syscalls/sysfcntl.c4
-rw-r--r--newlib/libc/syscalls/sysfork.c4
-rw-r--r--newlib/libc/syscalls/sysfstat.c4
-rw-r--r--newlib/libc/syscalls/sysgetpid.c4
-rw-r--r--newlib/libc/syscalls/sysgettod.c4
-rw-r--r--newlib/libc/syscalls/sysisatty.c15
-rw-r--r--newlib/libc/syscalls/syskill.c4
-rw-r--r--newlib/libc/syscalls/syslink.c4
-rw-r--r--newlib/libc/syscalls/syslseek.c4
-rw-r--r--newlib/libc/syscalls/sysopen.c8
-rw-r--r--newlib/libc/syscalls/sysread.c4
-rw-r--r--newlib/libc/syscalls/syssbrk.c4
-rw-r--r--newlib/libc/syscalls/sysstat.c4
-rw-r--r--newlib/libc/syscalls/systimes.c4
-rw-r--r--newlib/libc/syscalls/sysunlink.c4
-rw-r--r--newlib/libc/syscalls/syswait.c4
-rw-r--r--newlib/libc/syscalls/syswrite.c4
-rw-r--r--newlib/libc/time/mktime.c14
412 files changed, 40247 insertions, 27232 deletions
diff --git a/newlib/libc/argz/argz_count.c b/newlib/libc/argz/argz_count.c
index 8f0366828..0c8a816c1 100644
--- a/newlib/libc/argz/argz_count.c
+++ b/newlib/libc/argz/argz_count.c
@@ -5,7 +5,6 @@
*/
#include <_ansi.h>
-#include <stddef.h>
#include <sys/types.h>
size_t
diff --git a/newlib/libc/argz/argz_extract.c b/newlib/libc/argz/argz_extract.c
index a819f3953..56c604684 100644
--- a/newlib/libc/argz/argz_extract.c
+++ b/newlib/libc/argz/argz_extract.c
@@ -4,7 +4,6 @@
* is freely granted, provided that this notice is preserved.
*/
-#include <stddef.h>
#include <argz.h>
#include <sys/types.h>
diff --git a/newlib/libc/argz/argz_stringify.c b/newlib/libc/argz/argz_stringify.c
index 04bea7514..febf8b4f9 100644
--- a/newlib/libc/argz/argz_stringify.c
+++ b/newlib/libc/argz/argz_stringify.c
@@ -5,7 +5,6 @@
*/
#include <_ansi.h>
-#include <stddef.h>
#include <sys/types.h>
void
diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c
index 6fa30b207..5551dbdc9 100644
--- a/newlib/libc/ctype/ctype_.c
+++ b/newlib/libc/ctype/ctype_.c
@@ -86,10 +86,8 @@ static _CONST char _ctype_b[128 + 256] = {
# if defined(__CYGWIN__)
_CONST char __declspec(dllexport) *__ctype_ptr = _ctype_b + 128;
-_CONST char __declspec(dllexport) *__ctype_ptr__ = _ctype_b + 127;
# else
_CONST char *__ctype_ptr = _ctype_b + 128;
-_CONST char *__ctype_ptr__ = _ctype_b + 127;
# endif
# if defined(_HAVE_ARRAY_ALIASING)
@@ -126,5 +124,4 @@ _CONST char _ctype_[1 + 256] = {
};
_CONST char *__ctype_ptr = _ctype_ + 1;
-_CONST char *__ctype_ptr__ = _ctype_;
#endif
diff --git a/newlib/libc/ctype/isalnum.c b/newlib/libc/ctype/isalnum.c
index 3fd5f9515..7e05bd1a2 100644
--- a/newlib/libc/ctype/isalnum.c
+++ b/newlib/libc/ctype/isalnum.c
@@ -41,6 +41,6 @@ No OS subroutines are required.
int
_DEFUN(isalnum,(c),int c)
{
- return(__ctype_ptr__[c+1] & (_U|_L|_N));
+ return((_ctype_ + 1)[c] & (_U|_L|_N));
}
diff --git a/newlib/libc/ctype/isalpha.c b/newlib/libc/ctype/isalpha.c
index a30ca9e19..35f14d396 100644
--- a/newlib/libc/ctype/isalpha.c
+++ b/newlib/libc/ctype/isalpha.c
@@ -39,6 +39,6 @@ No supporting OS subroutines are required.
int
_DEFUN(isalpha,(c),int c)
{
- return(__ctype_ptr__[c+1] & (_U|_L));
+ return((_ctype_ + 1)[c] & (_U|_L));
}
diff --git a/newlib/libc/ctype/iscntrl.c b/newlib/libc/ctype/iscntrl.c
index a4fdff178..7b6da349d 100644
--- a/newlib/libc/ctype/iscntrl.c
+++ b/newlib/libc/ctype/iscntrl.c
@@ -42,7 +42,7 @@ No supporting OS subroutines are required.
int
_DEFUN(iscntrl,(c),int c)
{
- return(__ctype_ptr__[c+1] & _C);
+ return((_ctype_ + 1)[c] & _C);
}
diff --git a/newlib/libc/ctype/isdigit.c b/newlib/libc/ctype/isdigit.c
index 18383ee45..5c21898e6 100644
--- a/newlib/libc/ctype/isdigit.c
+++ b/newlib/libc/ctype/isdigit.c
@@ -39,5 +39,5 @@ No supporting OS subroutines are required.
int
_DEFUN(isdigit,(c),int c)
{
- return(__ctype_ptr__[c+1] & _N);
+ return((_ctype_ + 1)[c] & _N);
}
diff --git a/newlib/libc/ctype/islower.c b/newlib/libc/ctype/islower.c
index 098e56c54..cda484367 100644
--- a/newlib/libc/ctype/islower.c
+++ b/newlib/libc/ctype/islower.c
@@ -38,6 +38,6 @@ No supporting OS subroutines are required.
int
_DEFUN(islower,(c),int c)
{
- return(__ctype_ptr__[c+1] & _L);
+ return((_ctype_ + 1)[c] & _L);
}
diff --git a/newlib/libc/ctype/isprint.c b/newlib/libc/ctype/isprint.c
index 2f317a291..2ff00f4e3 100644
--- a/newlib/libc/ctype/isprint.c
+++ b/newlib/libc/ctype/isprint.c
@@ -47,7 +47,7 @@ No supporting OS subroutines are required.
int
_DEFUN(isgraph,(c),int c)
{
- return(__ctype_ptr__[c+1] & (_P|_U|_L|_N));
+ return((_ctype_ + 1)[c] & (_P|_U|_L|_N));
}
@@ -55,6 +55,6 @@ _DEFUN(isgraph,(c),int c)
int
_DEFUN(isprint,(c),int c)
{
- return(__ctype_ptr__[c+1] & (_P|_U|_L|_N|_B));
+ return((_ctype_ + 1)[c] & (_P|_U|_L|_N|_B));
}
diff --git a/newlib/libc/ctype/ispunct.c b/newlib/libc/ctype/ispunct.c
index 9b9c9c0bc..c5679323c 100644
--- a/newlib/libc/ctype/ispunct.c
+++ b/newlib/libc/ctype/ispunct.c
@@ -41,6 +41,6 @@ No supporting OS subroutines are required.
int
_DEFUN(ispunct,(c),int c)
{
- return(__ctype_ptr__[c+1] & _P);
+ return((_ctype_ + 1)[c] & _P);
}
diff --git a/newlib/libc/ctype/isspace.c b/newlib/libc/ctype/isspace.c
index 36582415c..1bc0798a2 100644
--- a/newlib/libc/ctype/isspace.c
+++ b/newlib/libc/ctype/isspace.c
@@ -39,6 +39,6 @@ No supporting OS subroutines are required.
int
_DEFUN(isspace,(c),int c)
{
- return(__ctype_ptr__[c+1] & _S);
+ return((_ctype_ + 1)[c] & _S);
}
diff --git a/newlib/libc/ctype/isupper.c b/newlib/libc/ctype/isupper.c
index d6cc6ecc4..4cf9e9a2d 100644
--- a/newlib/libc/ctype/isupper.c
+++ b/newlib/libc/ctype/isupper.c
@@ -38,6 +38,6 @@ No supporting OS subroutines are required.
int
_DEFUN(isupper,(c),int c)
{
- return(__ctype_ptr__[c+1] & _U);
+ return((_ctype_ + 1)[c] & _U);
}
diff --git a/newlib/libc/ctype/isxdigit.c b/newlib/libc/ctype/isxdigit.c
index 9748eb4b5..f8a035f37 100644
--- a/newlib/libc/ctype/isxdigit.c
+++ b/newlib/libc/ctype/isxdigit.c
@@ -40,6 +40,6 @@ No supporting OS subroutines are required.
int
_DEFUN(isxdigit,(c),int c)
{
- return(__ctype_ptr__[c+1] & ((_X)|(_N)));
+ return((_ctype_ + 1)[c] & ((_X)|(_N)));
}
diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h
index a3f0334e3..b84f37791 100644
--- a/newlib/libc/include/_ansi.h
+++ b/newlib/libc/include/_ansi.h
@@ -45,8 +45,8 @@
#ifndef _LONG_DOUBLE
#define _LONG_DOUBLE long double
#endif
-#ifndef _LONG_LONG_TYPE
-#define _LONG_LONG_TYPE long long
+#ifndef _LONG_LONG
+#define _LONG_LONG long long
#endif
#ifndef _PARAMS
#define _PARAMS(paramlist) paramlist
@@ -65,7 +65,7 @@
#define _DEFUN_VOID(name) name()
#define _CAST_VOID
#define _LONG_DOUBLE double
-#define _LONG_LONG_TYPE long
+#define _LONG_LONG long
#ifndef _PARAMS
#define _PARAMS(paramlist) ()
#endif
diff --git a/newlib/libc/include/_syslist.h b/newlib/libc/include/_syslist.h
index 09da79336..0bf76e108 100644
--- a/newlib/libc/include/_syslist.h
+++ b/newlib/libc/include/_syslist.h
@@ -11,7 +11,6 @@
#define _fstat fstat
#define _getpid getpid
#define _gettimeofday gettimeofday
-#define _isatty isatty
#define _kill kill
#define _link link
#define _lseek lseek
diff --git a/newlib/libc/include/assert.h b/newlib/libc/include/assert.h
index e542b214f..ed14928ba 100644
--- a/newlib/libc/include/assert.h
+++ b/newlib/libc/include/assert.h
@@ -21,14 +21,10 @@ extern "C" {
# if defined __cplusplus && defined __GNUC__
# define __ASSERT_FUNC __PRETTY_FUNCTION__
- /* C99 requires the use of __func__. */
-# elif __STDC_VERSION__ >= 199901L
+ /* C99 requires the use of __func__, gcc also supports it. */
+# elif defined __GNUC__ || __STDC_VERSION__ >= 199901L
# define __ASSERT_FUNC __func__
- /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */
-# elif __GNUC__ >= 2
-# define __ASSERT_FUNC __FUNCTION__
-
/* failed to detect __func__ support. */
# else
# define __ASSERT_FUNC ((char *) 0)
diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h
index 17a486ebb..c1ace5077 100644
--- a/newlib/libc/include/ctype.h
+++ b/newlib/libc/include/ctype.h
@@ -36,20 +36,21 @@ int _EXFUN(_toupper, (int __c));
#define _X 0100
#define _B 0200
-extern __IMPORT _CONST char *__ctype_ptr__;
+extern __IMPORT _CONST char *__ctype_ptr;
+extern __IMPORT _CONST char _ctype_[]; /* For backward compatibility. */
#ifndef __cplusplus
-#define isalpha(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L))
-#define isupper(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_U)
-#define islower(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_L)
-#define isdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_N)
-#define isxdigit(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_X|_N))
-#define isspace(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_S)
-#define ispunct(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_P)
-#define isalnum(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_U|_L|_N))
-#define isprint(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N|_B))
-#define isgraph(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&(_P|_U|_L|_N))
-#define iscntrl(c) ((__ctype_ptr__)[(unsigned)((c)+1)]&_C)
+#define isalpha(c) ((__ctype_ptr)[(unsigned)(c)]&(_U|_L))
+#define isupper(c) ((__ctype_ptr)[(unsigned)(c)]&_U)
+#define islower(c) ((__ctype_ptr)[(unsigned)(c)]&_L)
+#define isdigit(c) ((__ctype_ptr)[(unsigned)(c)]&_N)
+#define isxdigit(c) ((__ctype_ptr)[(unsigned)(c)]&(_X|_N))
+#define isspace(c) ((__ctype_ptr)[(unsigned)(c)]&_S)
+#define ispunct(c) ((__ctype_ptr)[(unsigned)(c)]&_P)
+#define isalnum(c) ((__ctype_ptr)[(unsigned)(c)]&(_U|_L|_N))
+#define isprint(c) ((__ctype_ptr)[(unsigned)(c)]&(_P|_U|_L|_N|_B))
+#define isgraph(c) ((__ctype_ptr)[(unsigned)(c)]&(_P|_U|_L|_N))
+#define iscntrl(c) ((__ctype_ptr)[(unsigned)(c)]&_C)
/* Non-gcc versions will get the library versions, and will be
@@ -67,9 +68,6 @@ extern __IMPORT _CONST char *__ctype_ptr__;
#define toascii(c) ((c)&0177)
#endif
-/* For C++ backward-compatibility only. */
-extern __IMPORT _CONST char _ctype_[];
-
_END_STD_C
#endif /* _CTYPE_H_ */
diff --git a/newlib/libc/include/getopt.h b/newlib/libc/include/getopt.h
index 13cf99c5f..7179298ae 100644
--- a/newlib/libc/include/getopt.h
+++ b/newlib/libc/include/getopt.h
@@ -82,8 +82,6 @@ Gregory Pietsch's current e-mail address:
gpietsch@comcast.net
****************************************************************************/
-/* This is a glibc-extension header file. */
-
#ifndef GETOPT_H
#define GETOPT_H
@@ -91,60 +89,31 @@ gpietsch@comcast.net
/* include files needed by this include file */
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
+/* macros defined by this include file */
+#define NO_ARG 0
+#define REQUIRED_ARG 1
+#define OPTIONAL_ARG 2
+
+/* types defined by this include file */
+
+struct option
+{
+ char *name; /* the name of the long option */
+ int has_arg; /* one of the above macros */
+ int *flag; /* determines if getopt_long() returns a
+ * value for a long option; if it is
+ * non-NULL, 0 is returned as a function
+ * value and the value of val is stored in
+ * the area pointed to by flag. Otherwise,
+ * val is returned. */
+ int val; /* determines the value to return if flag is
+ * NULL. */
+};
#ifdef __cplusplus
extern "C"
{
-
-#endif /* __cplusplus */
-
-/* types defined by this include file */
- struct option
- {
- char *name; /* the name of the long option */
- int has_arg; /* one of the above macros */
- int *flag; /* determines if getopt_long() returns a
- * value for a long option; if it is
- * non-NULL, 0 is returned as a function
- * value and the value of val is stored in
- * the area pointed to by flag. Otherwise,
- * val is returned. */
- int val; /* determines the value to return if flag is
- * NULL. */
-
- };
-
-/* While getopt.h is a glibc extension, the following are newlib extensions.
- * They are optionally included via the __need_getopt_newlib flag. */
-
-#ifdef __need_getopt_newlib
-
- /* macros defined by this include file */
- #define NO_ARG no_argument
- #define REQUIRED_ARG required_argument
- #define OPTIONAL_ARG optional_argument
-
- /* The GETOPT_DATA_INITIALIZER macro is used to initialize a statically-
- allocated variable of type struct getopt_data. */
- #define GETOPT_DATA_INITIALIZER {0,0,0,0,0}
-
- /* These #defines are to make accessing the reentrant functions easier. */
- #define getopt_r __getopt_r
- #define getopt_long_r __getopt_long_r
- #define getopt_long_only_r __getopt_long_only_r
-
- /* The getopt_data structure is for reentrancy. Its members are similar to
- the externally-defined variables. */
- typedef struct getopt_data
- {
- char *optarg;
- int optind, opterr, optopt, optwhere;
- } getopt_data;
-
-#endif /* __need_getopt_newlib */
+#endif
/* externally-defined variables */
extern char *optarg;
@@ -153,35 +122,14 @@ extern "C"
extern int optopt;
/* function prototypes */
- int _EXFUN (getopt,
- (int __argc, char *const __argv[], const char *__optstring));
-
- int _EXFUN (getopt_long,
- (int __argc, char *const __argv[], const char *__shortopts,
- const struct option * __longopts, int *__longind));
-
- int _EXFUN (getopt_long_only,
- (int __argc, char *const __argv[], const char *__shortopts,
- const struct option * __longopts, int *__longind));
-
- int _EXFUN (__getopt_r,
- (int __argc, char *const __argv[], const char *__optstring,
- struct getopt_data * __data));
-
- int _EXFUN (__getopt_long_r,
- (int __argc, char *const __argv[], const char *__shortopts,
- const struct option * __longopts, int *__longind,
- struct getopt_data * __data));
-
- int _EXFUN (__getopt_long_only_r,
- (int __argc, char *const __argv[], const char *__shortopts,
- const struct option * __longopts, int *__longind,
- struct getopt_data * __data));
+ int _EXFUN (getopt, (int __argc, char *const __argv[], const char *__optstring));
+ int _EXFUN (getopt_long, (int __argc, char *const __argv[], const char *__shortopts, const struct option *__longopts, int *__longind));
+ int _EXFUN (getopt_long_only, (int __argc, char *const __argv[], const char *__shortopts, const struct option *__longopts, int *__longind));
#ifdef __cplusplus
};
-#endif /* __cplusplus */
+#endif
#endif /* GETOPT_H */
diff --git a/newlib/libc/include/machine/_default_types.h b/newlib/libc/include/machine/_default_types.h
index e79f99399..a20abce84 100644
--- a/newlib/libc/include/machine/_default_types.h
+++ b/newlib/libc/include/machine/_default_types.h
@@ -12,8 +12,8 @@ extern "C" {
/*
* Guess on types by examining *_MIN / *_MAX defines.
*/
-#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ >= 3 ) \
- && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2 ))
+#if defined(__GNUC__) && (__GNUC__ >= 3 ) \
+ && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ > 2 )
/* GCC >= 3.3.0 has __<val>__ implicitly defined. */
#define __EXP(x) __##x##__
#else
diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h
index 9384a8781..b7f0b0d2f 100644
--- a/newlib/libc/include/machine/ieeefp.h
+++ b/newlib/libc/include/machine/ieeefp.h
@@ -38,7 +38,7 @@
whereby multiple words of an IEEE floating point are in big endian order, but the
words themselves are little endian with respect to the bytes.
- _DOUBLE_IS_32BITS
+ _DOUBLE_IS_32_BITS
This is used on platforms that support double by using the 32-bit IEEE
float type.
diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h
index 9d798ffb6..2b7aeb278 100644
--- a/newlib/libc/include/machine/setjmp.h
+++ b/newlib/libc/include/machine/setjmp.h
@@ -268,12 +268,6 @@ typedef int sigjmp_buf[_JBLEN+2];
# define _CYGWIN_WORKING_SIGSETJMP
#endif
-#ifdef _POSIX_THREADS
-#define __SIGMASK_FUNC pthread_sigmask
-#else
-#define __SIGMASK_FUNC sigprocmask
-#endif
-
#if defined(__GNUC__)
#define sigsetjmp(env, savemask) \
@@ -281,7 +275,7 @@ typedef int sigjmp_buf[_JBLEN+2];
({ \
sigjmp_buf *_sjbuf = &(env); \
((*_sjbuf)[_SAVEMASK] = savemask,\
- __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
+ sigprocmask (SIG_SETMASK, 0, (sigset_t *)((*_sjbuf) + _SIGMASK)),\
setjmp (*_sjbuf)); \
})
@@ -290,7 +284,7 @@ typedef int sigjmp_buf[_JBLEN+2];
({ \
sigjmp_buf *_sjbuf = &(env); \
((((*_sjbuf)[_SAVEMASK]) ? \
- __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
+ sigprocmask (SIG_SETMASK, (sigset_t *)((*_sjbuf) + _SIGMASK), 0)\
: 0), \
longjmp (*_sjbuf, val)); \
})
@@ -298,26 +292,15 @@ typedef int sigjmp_buf[_JBLEN+2];
#else /* !__GNUC__ */
#define sigsetjmp(env, savemask) ((env)[_SAVEMASK] = savemask,\
- __SIGMASK_FUNC (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
+ sigprocmask (SIG_SETMASK, 0, (sigset_t *) ((env) + _SIGMASK)),\
setjmp (env))
#define siglongjmp(env, val) ((((env)[_SAVEMASK])?\
- __SIGMASK_FUNC (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
+ sigprocmask (SIG_SETMASK, (sigset_t *) ((env) + _SIGMASK), 0):0),\
longjmp (env, val))
#endif
-/* POSIX _setjmp/_longjmp, maintained for XSI compatibility. These
- are equivalent to sigsetjmp/siglongjmp when not saving the signal mask.
- New applications should use sigsetjmp/siglongjmp instead. */
-#ifdef __CYGWIN__
-extern void _longjmp(jmp_buf, int);
-extern int _setjmp(jmp_buf);
-#else
-#define _setjmp(env) sigsetjmp ((env), 0)
-#define _longjmp(env, val) siglongjmp ((env), (val))
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h
index ce7263194..3f7001a0c 100644
--- a/newlib/libc/include/math.h
+++ b/newlib/libc/include/math.h
@@ -226,7 +226,7 @@ extern double scalbln _PARAMS((double, long int));
extern double tgamma _PARAMS((double));
extern double nearbyint _PARAMS((double));
extern long int lrint _PARAMS((double));
-extern _LONG_LONG_TYPE int llrint _PARAMS((double));
+extern _LONG_LONG int llrint _PARAMS((double));
extern double round _PARAMS((double));
extern long int lround _PARAMS((double));
extern double trunc _PARAMS((double));
@@ -293,7 +293,7 @@ extern float scalblnf _PARAMS((float, long int));
extern float tgammaf _PARAMS((float));
extern float nearbyintf _PARAMS((float));
extern long int lrintf _PARAMS((float));
-extern _LONG_LONG_TYPE llrintf _PARAMS((float));
+extern _LONG_LONG llrintf _PARAMS((float));
extern float roundf _PARAMS((float));
extern long int lroundf _PARAMS((float));
extern float truncf _PARAMS((float));
@@ -335,7 +335,7 @@ extern float hypotf _PARAMS((float, float));
/* Other long double precision functions. */
extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
extern long int lrintl _PARAMS((_LONG_DOUBLE));
-extern _LONG_LONG_TYPE llrintl _PARAMS((_LONG_DOUBLE));
+extern _LONG_LONG llrintl _PARAMS((_LONG_DOUBLE));
#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */
diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h
index dfd0c9a36..639789e71 100644
--- a/newlib/libc/include/reent.h
+++ b/newlib/libc/include/reent.h
@@ -10,7 +10,7 @@
be declared here. It documents them all in one place. All library access
to the system is via some form of these functions.
- The target may provide the needed syscalls by any of the following:
+ There are three ways a target may provide the needed syscalls.
1) Define the reentrant versions of the syscalls directly.
(eg: _open_r, _close_r, etc.). Please keep the namespace clean.
@@ -29,56 +29,11 @@
When you do this, add -DMISSING_SYSCALL_NAMES to newlib_cflags in
configure.host.
- 4) Define or otherwise provide the regular versions of the syscalls,
- and do not supply functional interfaces for any of the reentrant
- calls. With this method, the reentrant syscalls are redefined to
- directly call the regular system call without the reentrancy argument.
- When you do this, specify both -DREENTRANT_SYSCALLS_PROVIDED and
- -DMISSING_SYSCALL_NAMES via newlib_cflags in configure.host and do
- not specify "syscall_dir".
-
Stubs of the reentrant versions of the syscalls exist in the libc/reent
- source directory and are provided if REENTRANT_SYSCALLS_PROVIDED isn't
- defined. These stubs call the native system calls: _open, _close, etc.
- if MISSING_SYSCALL_NAMES is *not* defined, otherwise they call the
- non-underscored versions: open, close, etc. when MISSING_SYSCALL_NAMES
- *is* defined.
-
- By default, newlib functions call the reentrant syscalls internally,
- passing a reentrancy structure as an argument. This reentrancy structure
- contains data that is thread-specific. For example, the errno value is
- kept in the reentrancy structure. If multiple threads exist, each will
- keep a separate errno value which is intuitive since the application flow
- cannot check for failure reliably otherwise.
-
- The reentrant syscalls are either provided by the platform, by the
- libc/reent stubs, or in the case of both MISSING_SYSCALL_NAMES and
- REENTRANT_SYSCALLS_PROVIDED being defined, the calls are redefined to
- simply call the regular syscalls with no reentrancy struct argument.
-
- A single-threaded application does not need to worry about the reentrancy
- structure. It is used internally.
-
- A multi-threaded application needs either to manually manage reentrancy
- structures or use dynamic reentrancy.
-
- Manually managing reentrancy structures entails calling special reentrant
- versions of newlib functions that have an additional reentrancy argument.
- For example, _printf_r. By convention, the first argument is the
- reentrancy structure. By default, the normal version of the function
- uses the default reentrancy structure: _REENT. The reentrancy structure
- is passed internally, eventually to the reentrant syscalls themselves.
- How the structures are stored and accessed in this model is up to the
- application.
-
- Dynamic reentrancy is specified by the __DYNAMIC_REENT__ flag. This
- flag denotes setting up a macro to replace _REENT with a function call
- to __getreent(). This function needs to be implemented by the platform
- and it is meant to return the reentrancy structure for the current
- thread. When the regular C functions (e.g. printf) go to call internal
- routines with the default _REENT structure, they end up calling with
- the reentrancy structure for the thread. Thus, application code does not
- need to call the _r routines nor worry about reentrancy structures. */
+ source directory and are used if REENTRANT_SYSCALLS_PROVIDED isn't defined.
+ They use the native system calls: _open, _close, etc. if they're available
+ (MISSING_SYSCALL_NAMES is *not* defined), otherwise open, close, etc.
+ (MISSING_SYSCALL_NAMES *is* defined). */
/* WARNING: All identifiers here must begin with an underscore. This file is
included by stdio.h and others and we therefore must only use identifiers
@@ -104,35 +59,6 @@ struct tms;
struct timeval;
struct timezone;
-#if defined(REENTRANT_SYSCALLS_PROVIDED) && defined(MISSING_SYSCALL_NAMES)
-
-#define _close_r(__reent, __fd) close(__fd)
-#define _execve_r(__reent, __f, __arg, __env) execve(__f, __arg, __env)
-#define _fcntl_r(__reent, __fd, __cmd, __arg) fcntl(__fd, __cmd, __arg)
-#define _fork_r(__reent) fork()
-#define _fstat_r(__reent, __fdes, __stat) fstat(__fdes, __stat)
-#define _getpid_r(__reent) getpid()
-#define _isatty_r(__reent, __desc) isatty(__desc)
-#define _kill_r(__reent, __pid, __signal) kill(__pid, __signal)
-#define _link_r(__reent, __oldpath, __newpath) link(__oldpath, __newpath)
-#define _lseek_r(__reent, __fdes, __off, __w) lseek(__fdes, __off, __w)
-#define _open_r(__reent, __path, __flag, __m) open(__path, __flag, __m)
-#define _read_r(__reent, __fd, __buff, __cnt) read(__fd, __buff, __cnt)
-#define _sbrk_r(__reent, __incr) sbrk(__incr)
-#define _stat_r(__reent, __path, __buff) stat(__path, __buff)
-#define _times_r(__reent, __time) times(__time)
-#define _unlink_r(__reent, __path) unlink(__path)
-#define _wait_r(__reent, __status) wait(__status)
-#define _write_r(__reent, __fd, __buff, __cnt) write(__fd, __buff, __cnt)
-#define _gettimeofday_r(__reent, __tp, __tzp) gettimeofday(__tp, __tzp)
-
-#ifdef __LARGE64_FILES
-#define _lseek64_r(__reent, __fd, __off, __w) lseek64(__fd, __off, __w)
-#define _fstat64_r(__reent, __fd, __buff) fstat64(__fd, __buff)
-#define _open64_r(__reent, __path, __flag, __m) open64(__path, __flag, __m)
-#endif
-
-#else
/* Reentrant versions of system calls. */
extern int _close_r _PARAMS ((struct _reent *, int));
@@ -141,7 +67,6 @@ extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int));
extern int _fork_r _PARAMS ((struct _reent *));
extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *));
extern int _getpid_r _PARAMS ((struct _reent *));
-extern int _isatty_r _PARAMS ((struct _reent *, int));
extern int _kill_r _PARAMS ((struct _reent *, int, int));
extern int _link_r _PARAMS ((struct _reent *, const char *, const char *));
extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int));
@@ -170,8 +95,6 @@ extern int _fstat64_r _PARAMS ((struct _reent *, int, struct stat64 *));
extern int _open64_r _PARAMS ((struct _reent *, const char *, int, int));
#endif
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h
index 821462d8a..1fa36517a 100644
--- a/newlib/libc/include/stdint.h
+++ b/newlib/libc/include/stdint.h
@@ -348,7 +348,8 @@ typedef unsigned long uintptr_t;
#endif
/* This must match size_t in stddef.h, currently long unsigned int */
-#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
+#define SIZE_MIN (-__STDINT_EXP(LONG_MAX) - 1L)
+#define SIZE_MAX __STDINT_EXP(LONG_MAX)
/* This must match sig_atomic_t in <signal.h> (currently int) */
#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h
index 3f4fa6724..51c72a447 100644
--- a/newlib/libc/include/stdio.h
+++ b/newlib/libc/include/stdio.h
@@ -339,10 +339,7 @@ FILE * _EXFUN(fmemopen, (void *, size_t, const char *));
/* getdelim - see __getdelim for now */
/* getline - see __getline for now */
FILE * _EXFUN(open_memstream, (char **, size_t *));
-#if defined (__CYGWIN__)
-int _EXFUN(renameat, (int, const char *, int, const char *));
-int _EXFUN(symlinkat, (const char *, int, const char *));
-#endif
+/* renameat - unimplemented for now */
int _EXFUN(vdprintf, (int, const char *, __VALIST)
_ATTRIBUTE ((__format__ (__printf__, 2, 0))));
# endif
diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h
index 9962768cf..27c314620 100644
--- a/newlib/libc/include/string.h
+++ b/newlib/libc/include/string.h
@@ -56,7 +56,9 @@ int _EXFUN(ffs,(int));
char *_EXFUN(index,(const char *, int));
_PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t));
_PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t));
-_PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t));
+#ifdef __CYGWIN__
+extern void *memmem (__const void *, size_t, __const void *, size_t);
+#endif
char *_EXFUN(rindex,(const char *, int));
char *_EXFUN(stpcpy,(char *, const char *));
char *_EXFUN(stpncpy,(char *, const char *, size_t));
@@ -76,7 +78,7 @@ char *_EXFUN(strlwr,(char *));
char *_EXFUN(strupr,(char *));
#ifdef __CYGWIN__
#ifndef DEFS_H /* Kludge to work around problem compiling in gdb */
-char *_EXFUN(strsignal, (int __signo));
+const char *_EXFUN(strsignal, (int __signo));
#endif
int _EXFUN(strtosigno, (const char *__name));
#endif
diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h
index ccef6132e..b10503933 100644
--- a/newlib/libc/include/sys/_default_fcntl.h
+++ b/newlib/libc/include/sys/_default_fcntl.h
@@ -131,17 +131,6 @@ extern "C" {
#define F_UNLKSYS 4 /* remove remote locks for a given system */
#endif /* !_POSIX_SOURCE */
-#ifdef __CYGWIN__
-/* Special descriptor value to denote the cwd in calls to openat(2) etc. */
-#define AT_FDCWD -2
-
-/* Flag values for faccessat2) et al. */
-#define AT_EACCESS 1
-#define AT_SYMLINK_NOFOLLOW 2
-#define AT_SYMLINK_FOLLOW 4
-#define AT_REMOVEDIR 8
-#endif
-
/*#include <sys/stdtypes.h>*/
#ifndef __CYGWIN__
@@ -177,12 +166,6 @@ struct eflock {
extern int open _PARAMS ((const char *, int, ...));
extern int creat _PARAMS ((const char *, mode_t));
extern int fcntl _PARAMS ((int, int, ...));
-#ifdef __CYGWIN__
-#include <sys/time.h>
-extern int futimesat _PARAMS ((int, const char *, const struct timeval *));
-extern int openat _PARAMS ((int, const char *, int, ...));
-extern int unlinkat _PARAMS ((int, const char *, int));
-#endif
/* Provide _<systemcall> prototypes for functions provided by some versions
of newlib. */
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index fffb05de0..39785d77d 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -149,19 +149,8 @@ struct __sFILE_fake {
struct _reent *_data;
};
-
-/* Following is needed both in libc/stdio and libc/stdlib so we put it
- * here instead of libc/stdio/local.h where it was previously. */
-
-extern _VOID _EXFUN(__sinit,(struct _reent *));
-
-# define _REENT_SMALL_CHECK_INIT(ptr) \
- do \
- { \
- if ((ptr) && !(ptr)->__sdidinit) \
- __sinit (ptr); \
- } \
- while (0)
+/* CHECK_STD_INIT() comes from stdio/local.h; be sure to include that. */
+# define _REENT_SMALL_CHECK_INIT(ptr) CHECK_STD_INIT(ptr)
#else
# define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */
#endif
@@ -430,35 +419,35 @@ extern const struct __sFILE_fake __sf_fake_stderr;
}
#define _REENT_INIT_PTR(var) \
- { (var)->_stdin = (__FILE *)&__sf_fake_stdin; \
- (var)->_stdout = (__FILE *)&__sf_fake_stdout; \
- (var)->_stderr = (__FILE *)&__sf_fake_stderr; \
- (var)->_errno = 0; \
- (var)->_inc = 0; \
- (var)->_emergency = _NULL; \
- (var)->__sdidinit = 0; \
- (var)->_current_category = 0; \
- (var)->_current_locale = "C"; \
- (var)->_mp = _NULL; \
- (var)->__cleanup = _NULL; \
- (var)->_gamma_signgam = 0; \
- (var)->_cvtlen = 0; \
- (var)->_cvtbuf = _NULL; \
- (var)->_r48 = _NULL; \
- (var)->_localtime_buf = _NULL; \
- (var)->_asctime_buf = _NULL; \
- (var)->_sig_func = _NULL; \
- (var)->_atexit = _NULL; \
- (var)->_atexit0._next = _NULL; \
- (var)->_atexit0._ind = 0; \
- (var)->_atexit0._fns[0] = _NULL; \
- (var)->_atexit0._on_exit_args_ptr = _NULL; \
- (var)->__sglue._next = _NULL; \
- (var)->__sglue._niobs = 0; \
- (var)->__sglue._iobs = _NULL; \
- (var)->__sf = 0; \
- (var)->_misc = _NULL; \
- (var)->_signal_buf = _NULL; \
+ { var->_stdin = (__FILE *)&__sf_fake_stdin; \
+ var->_stdout = (__FILE *)&__sf_fake_stdout; \
+ var->_stderr = (__FILE *)&__sf_fake_stderr; \
+ var->_errno = 0; \
+ var->_inc = 0; \
+ var->_emergency = _NULL; \
+ var->__sdidinit = 0; \
+ var->_current_category = 0; \
+ var->_current_locale = "C"; \
+ var->_mp = _NULL; \
+ var->__cleanup = _NULL; \
+ var->_gamma_signgam = 0; \
+ var->_cvtlen = 0; \
+ var->_cvtbuf = _NULL; \
+ var->_r48 = _NULL; \
+ var->_localtime_buf = _NULL; \
+ var->_asctime_buf = _NULL; \
+ var->_sig_func = _NULL; \
+ var->_atexit = _NULL; \
+ var->_atexit0._next = _NULL; \
+ var->_atexit0._ind = 0; \
+ var->_atexit0._fns[0] = _NULL; \
+ var->_atexit0._on_exit_args_ptr = _NULL; \
+ var->__sglue._next = _NULL; \
+ var->__sglue._niobs = 0; \
+ var->__sglue._iobs = _NULL; \
+ var->__sf = 0; \
+ var->_misc = _NULL; \
+ var->_signal_buf = _NULL; \
}
/* Only built the assert() calls if we are built with debugging. */
@@ -623,7 +612,6 @@ struct _reent
_mbstate_t _mbsrtowcs_state;
_mbstate_t _wcrtomb_state;
_mbstate_t _wcsrtombs_state;
- int _h_errno;
} _reent;
/* Two next two fields were once used by malloc. They are no longer
used. They are used to preserve the space used before so as to
@@ -652,9 +640,9 @@ struct _reent
#define _REENT_INIT(var) \
{ 0, \
- &(var).__sf[0], \
- &(var).__sf[1], \
- &(var).__sf[2], \
+ &var.__sf[0], \
+ &var.__sf[1], \
+ &var.__sf[2], \
0, \
"", \
0, \
@@ -700,65 +688,65 @@ struct _reent
}
#define _REENT_INIT_PTR(var) \
- { (var)->_errno = 0; \
- (var)->_stdin = &(var)->__sf[0]; \
- (var)->_stdout = &(var)->__sf[1]; \
- (var)->_stderr = &(var)->__sf[2]; \
- (var)->_inc = 0; \
- memset(&(var)->_emergency, 0, sizeof((var)->_emergency)); \
- (var)->_current_category = 0; \
- (var)->_current_locale = "C"; \
- (var)->__sdidinit = 0; \
- (var)->__cleanup = _NULL; \
- (var)->_result = _NULL; \
- (var)->_result_k = 0; \
- (var)->_p5s = _NULL; \
- (var)->_freelist = _NULL; \
- (var)->_cvtlen = 0; \
- (var)->_cvtbuf = _NULL; \
- (var)->_new._reent._unused_rand = 0; \
- (var)->_new._reent._strtok_last = _NULL; \
- (var)->_new._reent._asctime_buf[0] = 0; \
- memset(&(var)->_new._reent._localtime_buf, 0, sizeof((var)->_new._reent._localtime_buf)); \
- (var)->_new._reent._gamma_signgam = 0; \
- (var)->_new._reent._rand_next = 1; \
- (var)->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
- (var)->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
- (var)->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
- (var)->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
- (var)->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
- (var)->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
- (var)->_new._reent._r48._add = _RAND48_ADD; \
- (var)->_new._reent._mblen_state.__count = 0; \
- (var)->_new._reent._mblen_state.__value.__wch = 0; \
- (var)->_new._reent._mbtowc_state.__count = 0; \
- (var)->_new._reent._mbtowc_state.__value.__wch = 0; \
- (var)->_new._reent._wctomb_state.__count = 0; \
- (var)->_new._reent._wctomb_state.__value.__wch = 0; \
- (var)->_new._reent._mbrlen_state.__count = 0; \
- (var)->_new._reent._mbrlen_state.__value.__wch = 0; \
- (var)->_new._reent._mbrtowc_state.__count = 0; \
- (var)->_new._reent._mbrtowc_state.__value.__wch = 0; \
- (var)->_new._reent._mbsrtowcs_state.__count = 0; \
- (var)->_new._reent._mbsrtowcs_state.__value.__wch = 0; \
- (var)->_new._reent._wcrtomb_state.__count = 0; \
- (var)->_new._reent._wcrtomb_state.__value.__wch = 0; \
- (var)->_new._reent._wcsrtombs_state.__count = 0; \
- (var)->_new._reent._wcsrtombs_state.__value.__wch = 0; \
- (var)->_new._reent._l64a_buf[0] = '\0'; \
- (var)->_new._reent._signal_buf[0] = '\0'; \
- (var)->_new._reent._getdate_err = 0; \
- (var)->_atexit = _NULL; \
- (var)->_atexit0._next = _NULL; \
- (var)->_atexit0._ind = 0; \
- (var)->_atexit0._fns[0] = _NULL; \
- (var)->_atexit0._on_exit_args._fntypes = 0; \
- (var)->_atexit0._on_exit_args._fnargs[0] = _NULL; \
- (var)->_sig_func = _NULL; \
- (var)->__sglue._next = _NULL; \
- (var)->__sglue._niobs = 0; \
- (var)->__sglue._iobs = _NULL; \
- memset(&(var)->__sf, 0, sizeof((var)->__sf)); \
+ { var->_errno = 0; \
+ var->_stdin = &var->__sf[0]; \
+ var->_stdout = &var->__sf[1]; \
+ var->_stderr = &var->__sf[2]; \
+ var->_inc = 0; \
+ memset(&var->_emergency, 0, sizeof(var->_emergency)); \
+ var->_current_category = 0; \
+ var->_current_locale = "C"; \
+ var->__sdidinit = 0; \
+ var->__cleanup = _NULL; \
+ var->_result = _NULL; \
+ var->_result_k = 0; \
+ var->_p5s = _NULL; \
+ var->_freelist = _NULL; \
+ var->_cvtlen = 0; \
+ var->_cvtbuf = _NULL; \
+ var->_new._reent._unused_rand = 0; \
+ var->_new._reent._strtok_last = _NULL; \
+ var->_new._reent._asctime_buf[0] = 0; \
+ memset(&var->_new._reent._localtime_buf, 0, sizeof(var->_new._reent._localtime_buf)); \
+ var->_new._reent._gamma_signgam = 0; \
+ var->_new._reent._rand_next = 1; \
+ var->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
+ var->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
+ var->_new._reent._r48._seed[2] = _RAND48_SEED_2; \
+ var->_new._reent._r48._mult[0] = _RAND48_MULT_0; \
+ var->_new._reent._r48._mult[1] = _RAND48_MULT_1; \
+ var->_new._reent._r48._mult[2] = _RAND48_MULT_2; \
+ var->_new._reent._r48._add = _RAND48_ADD; \
+ var->_new._reent._mblen_state.__count = 0; \
+ var->_new._reent._mblen_state.__value.__wch = 0; \
+ var->_new._reent._mbtowc_state.__count = 0; \
+ var->_new._reent._mbtowc_state.__value.__wch = 0; \
+ var->_new._reent._wctomb_state.__count = 0; \
+ var->_new._reent._wctomb_state.__value.__wch = 0; \
+ var->_new._reent._mbrlen_state.__count = 0; \
+ var->_new._reent._mbrlen_state.__value.__wch = 0; \
+ var->_new._reent._mbrtowc_state.__count = 0; \
+ var->_new._reent._mbrtowc_state.__value.__wch = 0; \
+ var->_new._reent._mbsrtowcs_state.__count = 0; \
+ var->_new._reent._mbsrtowcs_state.__value.__wch = 0; \
+ var->_new._reent._wcrtomb_state.__count = 0; \
+ var->_new._reent._wcrtomb_state.__value.__wch = 0; \
+ var->_new._reent._wcsrtombs_state.__count = 0; \
+ var->_new._reent._wcsrtombs_state.__value.__wch = 0; \
+ var->_new._reent._l64a_buf[0] = '\0'; \
+ var->_new._reent._signal_buf[0] = '\0'; \
+ var->_new._reent._getdate_err = 0; \
+ var->_atexit = _NULL; \
+ var->_atexit0._next = _NULL; \
+ var->_atexit0._ind = 0; \
+ var->_atexit0._fns[0] = _NULL; \
+ var->_atexit0._on_exit_args._fntypes = 0; \
+ var->_atexit0._on_exit_args._fnargs[0] = _NULL; \
+ var->_sig_func = _NULL; \
+ var->__sglue._next = _NULL; \
+ var->__sglue._niobs = 0; \
+ var->__sglue._iobs = _NULL; \
+ memset(&var->__sf, 0, sizeof(var->__sf)); \
}
#define _REENT_CHECK_RAND48(ptr) /* nothing */
diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h
index 06a71a978..1eb16ecd3 100644
--- a/newlib/libc/include/sys/stat.h
+++ b/newlib/libc/include/sys/stat.h
@@ -115,11 +115,6 @@ struct stat
#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
-#if defined(__CYGWIN__)
-/* Special tv_nsec values for futimens(2) and utimensat(2). */
-#define UTIME_NOW -2L
-#define UTIME_OMIT -1L
-#endif
int _EXFUN(chmod,( const char *__path, mode_t __mode ));
int _EXFUN(fchmod,(int __fd, mode_t __mode));
@@ -134,16 +129,6 @@ int _EXFUN(lstat,( const char *__path, struct stat *__buf ));
int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
#endif
-#if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
-int _EXFUN(fchmodat, (int, const char *, mode_t, int));
-int _EXFUN(fstatat, (int, const char *, struct stat *, int));
-int _EXFUN(mkdirat, (int, const char *, mode_t));
-int _EXFUN(mkfifoat, (int, const char *, mode_t));
-int _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
-int _EXFUN(utimensat, (int, const char *, const struct timespec *, int));
-int _EXFUN(futimens, (int, const struct timespec *));
-#endif
-
/* Provide prototypes for most of the _<systemcall> names that are
provided in newlib for some compilers. */
#ifdef _COMPILING_NEWLIB
diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h
index fa7361a25..619652ffc 100644
--- a/newlib/libc/include/sys/unistd.h
+++ b/newlib/libc/include/sys/unistd.h
@@ -46,9 +46,6 @@ int _EXFUN(execlp, (const char *__file, const char *, ... ));
int _EXFUN(execv, (const char *__path, char * const __argv[] ));
int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] ));
int _EXFUN(execvp, (const char *__file, char * const __argv[] ));
-#if defined(__CYGWIN__)
-int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags));
-#endif
#if defined(__CYGWIN__) || defined(__rtems__) || defined(__SPU__)
int _EXFUN(fchdir, (int __fildes));
#endif
@@ -56,9 +53,6 @@ int _EXFUN(fchmod, (int __fildes, mode_t __mode ));
#if !defined(__INSIDE_CYGWIN__)
int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group ));
#endif
-#if defined(__CYGWIN__)
-int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags));
-#endif
pid_t _EXFUN(fork, (void ));
long _EXFUN(fpathconf, (int __fd, int __name ));
int _EXFUN(fsync, (int __fd));
@@ -105,14 +99,11 @@ int _EXFUN(isatty, (int __fildes ));
int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group ));
#endif
int _EXFUN(link, (const char *__path1, const char *__path2 ));
-#if defined(__CYGWIN__)
-int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags ));
-#endif
int _EXFUN(nice, (int __nice_value ));
#if !defined(__INSIDE_CYGWIN__)
off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence ));
#endif
-#if defined(__SPU__) || defined(__CYGWIN__)
+#if defined(__SPU__)
#define F_ULOCK 0
#define F_LOCK 1
#define F_TLOCK 2
@@ -198,7 +189,6 @@ int getsubopt(char **, char * const *, char **);
int _EXFUN(_close, (int __fildes ));
pid_t _EXFUN(_fork, (void ));
pid_t _EXFUN(_getpid, (void ));
-int _EXFUN(_isatty, (int __fildes ));
int _EXFUN(_link, (const char *__path1, const char *__path2 ));
_off_t _EXFUN(_lseek, (int __fildes, _off_t __offset, int __whence ));
#ifdef __LARGE64_FILES
@@ -235,10 +225,7 @@ void _EXFUN(sync, (void));
int _EXFUN(sync, (void));
#endif
-ssize_t _EXFUN(readlink, (const char *__path, char *__buf, size_t __buflen));
-#if defined(__CYGWIN__)
-ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__path, char *__buf, size_t __buflen));
-#endif
+int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));
int _EXFUN(symlink, (const char *__name1, const char *__name2));
#define F_OK 0
diff --git a/newlib/libc/libc.texinfo b/newlib/libc/libc.texinfo
index f4f9624bc..efa30d35b 100644
--- a/newlib/libc/libc.texinfo
+++ b/newlib/libc/libc.texinfo
@@ -1,5 +1,20 @@
\input texinfo.tex
@setfilename libc.info
+@tex
+% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE FROM "makedoc"
+\global\long\def\example{%
+\begingroup
+\let\aboveenvbreak=\par
+\let\afterenvbreak=\par
+\parskip=0pt
+\lisp}
+\global\long\def\Eexample{%
+\Elisp
+\endgroup
+\vskip -\parskip% to cancel out effect of following \par
+}
+% END LOCAL WHITESPACE KLUGE
+@end tex
@syncodeindex fn cp
@ifinfo
diff --git a/newlib/libc/machine/arm/setjmp.S b/newlib/libc/machine/arm/setjmp.S
index 4bb2a46a7..84e7cd70b 100644
--- a/newlib/libc/machine/arm/setjmp.S
+++ b/newlib/libc/machine/arm/setjmp.S
@@ -120,12 +120,7 @@ SYM (\name):
FUNC_START setjmp
/* Save all the callee-preserved registers into the jump buffer. */
-#ifdef __thumb2__
- stmea a1!, { v1-v7, fp, ip, lr }
- str sp, [a1],#+4
-#else
stmea a1!, { v1-v7, fp, ip, sp, lr }
-#endif
#if 0 /* Simulator does not cope with FP instructions yet. */
#ifndef __SOFTFP__
@@ -147,12 +142,7 @@ SYM (\name):
/* If we have stack extension code it ought to be handled here. */
/* Restore the registers, retrieving the state when setjmp() was called. */
-#ifdef __thumb2__
- ldmfd a1!, { v1-v7, fp, ip, lr }
- ldr sp, [a1],#+4
-#else
ldmfd a1!, { v1-v7, fp, ip, sp, lr }
-#endif
#if 0 /* Simulator does not cope with FP instructions yet. */
#ifndef __SOFTFP__
diff --git a/newlib/libc/machine/configure b/newlib/libc/machine/configure
index f4ef33c08..db1ef53c8 100755
--- a/newlib/libc/machine/configure
+++ b/newlib/libc/machine/configure
@@ -1,54 +1,25 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for newlib 1.16.0.
+# Generated by GNU Autoconf 2.59 for newlib 1.15.0.
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
fi
+DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -58,43 +29,8 @@ else
fi
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
+$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
@@ -108,19 +44,18 @@ do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
@@ -128,388 +63,157 @@ fi
# Name of the executable.
-as_me=`$as_basename -- "$0" ||
+as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
-if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
-else
- as_have_required=no
-fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
fi
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-test \$exitcode = 0) || { (exit 1); exit 1; }
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
-else
- as_candidate_shells=
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- case $as_dir in
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
/*)
- for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
- done;;
- esac
-done
-IFS=$as_save_IFS
-
-
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
+ if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
-fi
-
-fi
-
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell autoconf@gnu.org about your system,
- echo including any error possibly output before this
- echo message
-}
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
- s/-\n.*//
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
+ chmod +x $as_me.lineno ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
# Exit status is that of the last command.
exit
}
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir
-fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
@@ -518,28 +222,7 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -548,6 +231,15 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
# Check that we are running under the correct shell.
@@ -698,252 +390,114 @@ fi
-exec 7<&0 </dev/null 6>&1
-
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+exec 6>&1
+
#
# Initializations.
#
ac_default_prefix=/usr/local
-ac_clean_files=
ac_config_libobj_dir=.
-LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
-PACKAGE_VERSION='1.16.0'
-PACKAGE_STRING='newlib 1.16.0'
+PACKAGE_VERSION='1.15.0'
+PACKAGE_STRING='newlib 1.15.0'
PACKAGE_BUGREPORT=''
ac_unique_file="d10v"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
+#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#ifdef HAVE_SYS_STAT_H
+#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
-#ifdef STDC_HEADERS
+#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
-# ifdef HAVE_STDLIB_H
+# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
-#ifdef HAVE_STRINGS_H
+#if HAVE_STRINGS_H
# include <strings.h>
#endif
-#ifdef HAVE_INTTYPES_H
+#if HAVE_INTTYPES_H
# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-MAY_SUPPLY_SYSCALLS_TRUE
-MAY_SUPPLY_SYSCALLS_FALSE
-newlib_basedir
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-CYGPATH_W
-PACKAGE
-VERSION
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-CC
-DEPDIR
-am__include
-am__quote
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-CCDEPMODE
-am__fastdepCC_TRUE
-am__fastdepCC_FALSE
-AS
-AR
-RANLIB
-READELF
-MAINTAINER_MODE_TRUE
-MAINTAINER_MODE_FALSE
-MAINT
-CCAS
-CCASFLAGS
-NEWLIB_CFLAGS
-LDFLAGS
-ELIX_LEVEL_0_TRUE
-ELIX_LEVEL_0_FALSE
-ELIX_LEVEL_1_TRUE
-ELIX_LEVEL_1_FALSE
-ELIX_LEVEL_2_TRUE
-ELIX_LEVEL_2_FALSE
-ELIX_LEVEL_3_TRUE
-ELIX_LEVEL_3_FALSE
-ELIX_LEVEL_4_TRUE
-ELIX_LEVEL_4_FALSE
-USE_LIBTOOL_TRUE
-USE_LIBTOOL_FALSE
-OBJEXT
-oext
-aext
-lpfx
-libm_machine_dir
-machine_dir
-sys_dir
-SED
-DLLTOOL
-OBJDUMP
-LIBTOOL
-CFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-GREP
-EGREP
-FGREP
-LD
-DUMPBIN
-ac_ct_DUMPBIN
-NM
-LN_S
-lt_ECHO
-CPP
-subdirs
-HAVE_MACHINE_DIR_TRUE
-HAVE_MACHINE_DIR_FALSE
-LIBOBJS
-LTLIBOBJS'
+ac_subdirs_all="$ac_subdirs_all a29k"
+ac_subdirs_all="$ac_subdirs_all arm"
+ac_subdirs_all="$ac_subdirs_all bfin"
+ac_subdirs_all="$ac_subdirs_all cris"
+ac_subdirs_all="$ac_subdirs_all crx"
+ac_subdirs_all="$ac_subdirs_all d10v"
+ac_subdirs_all="$ac_subdirs_all d30v"
+ac_subdirs_all="$ac_subdirs_all fr30"
+ac_subdirs_all="$ac_subdirs_all frv"
+ac_subdirs_all="$ac_subdirs_all h8300"
+ac_subdirs_all="$ac_subdirs_all h8500"
+ac_subdirs_all="$ac_subdirs_all hppa"
+ac_subdirs_all="$ac_subdirs_all i386"
+ac_subdirs_all="$ac_subdirs_all i960"
+ac_subdirs_all="$ac_subdirs_all iq2000"
+ac_subdirs_all="$ac_subdirs_all m32c"
+ac_subdirs_all="$ac_subdirs_all m32r"
+ac_subdirs_all="$ac_subdirs_all m68hc11"
+ac_subdirs_all="$ac_subdirs_all m68k"
+ac_subdirs_all="$ac_subdirs_all m88k"
+ac_subdirs_all="$ac_subdirs_all mep"
+ac_subdirs_all="$ac_subdirs_all mips"
+ac_subdirs_all="$ac_subdirs_all mn10200"
+ac_subdirs_all="$ac_subdirs_all mn10300"
+ac_subdirs_all="$ac_subdirs_all mt"
+ac_subdirs_all="$ac_subdirs_all necv70"
+ac_subdirs_all="$ac_subdirs_all powerpc"
+ac_subdirs_all="$ac_subdirs_all sh"
+ac_subdirs_all="$ac_subdirs_all sparc"
+ac_subdirs_all="$ac_subdirs_all spu"
+ac_subdirs_all="$ac_subdirs_all tic4x"
+ac_subdirs_all="$ac_subdirs_all tic80"
+ac_subdirs_all="$ac_subdirs_all v850"
+ac_subdirs_all="$ac_subdirs_all w65"
+ac_subdirs_all="$ac_subdirs_all x86_64"
+ac_subdirs_all="$ac_subdirs_all xscale"
+ac_subdirs_all="$ac_subdirs_all xstormy16"
+ac_subdirs_all="$ac_subdirs_all z8k"
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAY_SUPPLY_SYSCALLS_TRUE MAY_SUPPLY_SYSCALLS_FALSE newlib_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB READELF ac_ct_READELF MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CCAS CCASFLAGS NEWLIB_CFLAGS LDFLAGS ELIX_LEVEL_0_TRUE ELIX_LEVEL_0_FALSE ELIX_LEVEL_1_TRUE ELIX_LEVEL_1_FALSE ELIX_LEVEL_2_TRUE ELIX_LEVEL_2_FALSE ELIX_LEVEL_3_TRUE ELIX_LEVEL_3_FALSE ELIX_LEVEL_4_TRUE ELIX_LEVEL_4_FALSE USE_LIBTOOL_TRUE USE_LIBTOOL_FALSE OBJEXT oext aext lpfx libm_machine_dir machine_dir sys_dir SED DLLTOOL ac_ct_DLLTOOL OBJDUMP ac_ct_OBJDUMP LIBTOOL CFLAGS CPPFLAGS ac_ct_CC EXEEXT EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S lt_ECHO CPP subdirs HAVE_MACHINE_DIR_TRUE HAVE_MACHINE_DIR_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
- ac_precious_vars='build_alias
-host_alias
-target_alias
-CCAS
-CCASFLAGS
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP'
-ac_subdirs_all='a29k
-arm
-bfin
-cris
-crx
-d10v
-d30v
-fr30
-frv
-h8300
-h8500
-hppa
-i386
-i960
-iq2000
-m32c
-m32r
-m68hc11
-m68k
-m88k
-mep
-mips
-mn10200
-mn10300
-mt
-necv70
-powerpc
-sh
-sparc
-spu
-tic4x
-tic80
-v850
-w65
-x86_64
-xscale
-xstormy16
-z8k'
# Initialize some variables set by options.
ac_init_help=
@@ -970,48 +524,34 @@ x_libraries=NONE
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
+datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
ac_prev=
-ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
- eval $ac_prev=\$ac_option
+ eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
- case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case $ac_dashdash$ac_option in
- --)
- ac_dashdash=yes ;;
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
@@ -1033,45 +573,33 @@ do
--config-cache | -C)
cache_file=config.cache ;;
- -datadir | --datadir | --datadi | --datad)
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
datadir=$ac_optarg ;;
- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
- | --dataroo | --dataro | --datar)
- ac_prev=datarootdir ;;
- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
- datarootdir=$ac_optarg ;;
-
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
- eval enable_$ac_feature=no ;;
-
- -docdir | --docdir | --docdi | --doc | --do)
- ac_prev=docdir ;;
- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
- docdir=$ac_optarg ;;
-
- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
- ac_prev=dvidir ;;
- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
- dvidir=$ac_optarg ;;
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
- eval enable_$ac_feature=\$ac_optarg ;;
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1098,12 +626,6 @@ do
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
- ac_prev=htmldir ;;
- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
- | --ht=*)
- htmldir=$ac_optarg ;;
-
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
@@ -1128,16 +650,13 @@ do
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
- -localedir | --localedir | --localedi | --localed | --locale)
- ac_prev=localedir ;;
- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
- localedir=$ac_optarg ;;
-
-localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst | --locals)
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -1202,16 +721,6 @@ do
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
- ac_prev=pdfdir ;;
- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
- pdfdir=$ac_optarg ;;
-
- -psdir | --psdir | --psdi | --psd | --ps)
- ac_prev=psdir ;;
- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
- psdir=$ac_optarg ;;
-
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
@@ -1264,20 +773,24 @@ do
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
- eval with_$ac_package=\$ac_optarg ;;
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
- eval with_$ac_package=no ;;
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -1308,7 +821,8 @@ Try \`$0 --help' for more information." >&2
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
- eval $ac_envvar=\$ac_optarg
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
@@ -1328,19 +842,27 @@ if test -n "$ac_prev"; then
{ (exit 1); exit 1; }; }
fi
-# Be sure to have absolute directory names.
-for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
- datadir sysconfdir sharedstatedir localstatedir includedir \
- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
do
- eval ac_val=\$$ac_var
+ eval ac_val=$`echo $ac_var`
case $ac_val in
- [\\/$]* | ?:[\\/]* ) continue;;
- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
esac
- { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1367,76 +889,82 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { echo "$as_me: error: Working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
-
-
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
- # Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$0" ||
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
srcdir=$ac_confdir
- if test ! -r "$srcdir/$ac_unique_file"; then
+ if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
-if test ! -r "$srcdir/$ac_unique_file"; then
- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
{ (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+ fi
fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
- pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
- srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
- eval ac_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_env_${ac_var}_value=\$${ac_var}
- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CCAS_set=${CCAS+set}
+ac_env_CCAS_value=$CCAS
+ac_cv_env_CCAS_set=${CCAS+set}
+ac_cv_env_CCAS_value=$CCAS
+ac_env_CCASFLAGS_set=${CCASFLAGS+set}
+ac_env_CCASFLAGS_value=$CCASFLAGS
+ac_cv_env_CCASFLAGS_set=${CCASFLAGS+set}
+ac_cv_env_CCASFLAGS_value=$CCASFLAGS
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
#
# Report the --help message.
@@ -1445,7 +973,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures newlib 1.16.0 to adapt to many kinds of systems.
+\`configure' configures newlib 1.15.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1465,6 +993,9 @@ Configuration:
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
+_ACEOF
+
+ cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
@@ -1482,22 +1013,15 @@ Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/newlib]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
_ACEOF
cat <<\_ACEOF
@@ -1515,7 +1039,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of newlib 1.16.0:";;
+ short | recursive ) echo "Configuration of newlib 1.15.0:";;
esac
cat <<\_ACEOF
@@ -1534,8 +1058,10 @@ Optional Features:
--enable-dependency-tracking do not reject slow dependency extractors
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
- --enable-shared[=PKGS] build shared libraries [default=yes]
- --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-shared[=PKGS]
+ build shared libraries [default=yes]
+ --enable-static[=PKGS]
+ build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
@@ -1554,95 +1080,128 @@ Some influential environment variables:
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
- LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
- you have headers in a nonstandard directory <include dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
_ACEOF
-ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" || continue
+ test -d $ac_dir || continue
ac_builddir=.
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
case $srcdir in
- .) # We are building in place.
+ .) # No --srcdir option. We are building in place.
ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
- cd "$ac_dir" || { ac_status=$?; continue; }
- # Check for guested configure.
- if test -f "$ac_srcdir/configure.gnu"; then
- echo &&
- $SHELL "$ac_srcdir/configure.gnu" --help=recursive
- elif test -f "$ac_srcdir/configure"; then
- echo &&
- $SHELL "$ac_srcdir/configure" --help=recursive
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi || ac_status=$?
- cd "$ac_pwd" || { ac_status=$?; break; }
+ fi
+ cd $ac_popdir
done
fi
-test -n "$ac_init_help" && exit $ac_status
+test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-newlib configure 1.16.0
-generated by GNU Autoconf 2.61
+newlib configure 1.15.0
+generated by GNU Autoconf 2.59
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
- exit
+ exit 0
fi
-cat >config.log <<_ACEOF
+exec 5>config.log
+cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by newlib $as_me 1.16.0, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+It was created by newlib $as_me 1.15.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
_ACEOF
-exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
@@ -1661,7 +1220,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
@@ -1675,7 +1234,6 @@ do
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
-IFS=$as_save_IFS
} >&5
@@ -1697,6 +1255,7 @@ _ACEOF
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
+ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
@@ -1707,7 +1266,7 @@ do
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
- *\'*)
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
@@ -1729,7 +1288,9 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args '$ac_arg'"
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
;;
esac
done
@@ -1740,8 +1301,8 @@ $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
@@ -1754,34 +1315,20 @@ trap 'exit_status=$?
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
-(
- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
+{
(set) 2>&1 |
- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
sed -n \
- "s/'\''/'\''\\\\'\'''\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
- ;; #(
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
*)
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
- esac |
- sort
-)
+ esac;
+}
echo
cat <<\_ASBOX
@@ -1792,28 +1339,22 @@ _ASBOX
echo
for ac_var in $ac_subst_vars
do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- echo "$ac_var='\''$ac_val'\''"
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
+## ------------- ##
+## Output files. ##
+## ------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- echo "$ac_var='\''$ac_val'\''"
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
fi
@@ -1825,24 +1366,26 @@ _ASBOX
## ----------- ##
_ASBOX
echo
- cat confdefs.h
+ sed "/^$/d" confdefs.h | sort
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
- rm -f core *.core core.conftest.* &&
- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
-' 0
+ ' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
# Predefined preprocessor variables.
@@ -1873,17 +1416,14 @@ _ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
-if test -n "$CONFIG_SITE"; then
- set x "$CONFIG_SITE"
-elif test "x$prefix" != xNONE; then
- set x "$prefix/share/config.site" "$prefix/etc/config.site"
-else
- set x "$ac_default_prefix/share/config.site" \
- "$ac_default_prefix/etc/config.site"
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
fi
-shift
-for ac_site_file
-do
+for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
@@ -1899,8 +1439,8 @@ if test -r "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
- [\\/]* | ?:[\\/]* ) . "$cache_file";;
- *) . "./$cache_file";;
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
esac
fi
else
@@ -1912,11 +1452,12 @@ fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val=\$ac_cv_env_${ac_var}_value
- eval ac_new_val=\$ac_env_${ac_var}_value
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
@@ -1941,7 +1482,8 @@ echo "$as_me: current value: $ac_new_val" >&2;}
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
@@ -1958,6 +1500,12 @@ echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start ov
{ (exit 1); exit 1; }; }
fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
@@ -1982,92 +1530,67 @@ fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
-for ac_dir in ../../.. "$srcdir"/../../..; do
- if test -f "$ac_dir/install-sh"; then
+for ac_dir in ../../.. $srcdir/../../..; do
+ if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
- elif test -f "$ac_dir/install.sh"; then
+ elif test -f $ac_dir/install.sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
- elif test -f "$ac_dir/shtool"; then
+ elif test -f $ac_dir/shtool; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../.. \"$srcdir\"/../../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in ../../.. \"$srcdir\"/../../.." >&2;}
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../.. $srcdir/../../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in ../../.. $srcdir/../../.." >&2;}
{ (exit 1); exit 1; }; }
fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
{ (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
if test "${ac_cv_build+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
- ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
{ { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
{ (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
- { (exit 1); exit 1; }; };;
-esac
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
am__api_version="1.9"
@@ -2084,8 +1607,8 @@ am__api_version="1.9"
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2107,7 +1630,7 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -2126,22 +1649,21 @@ case $as_dir/ in
;;
esac
done
-IFS=$as_save_IFS
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
+ # removed, or if the path is relative.
INSTALL=$ac_install_sh
fi
fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -2151,8 +1673,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
# Just in case
sleep 1
echo timestamp > conftest.file
@@ -2194,20 +1716,20 @@ echo "$as_me: error: newly created file is older than distributed files!
Check your system clock" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
test "$program_prefix" != NONE &&
- program_transform_name="s&^&$program_prefix&;$program_transform_name"
+ program_transform_name="s,^,$program_prefix,;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
- program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
cat <<\_ACEOF >conftest.sed
s/[\\$]/&&/g;s/;s,x,x,$//
_ACEOF
program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm -f conftest.sed
+rm conftest.sed
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
@@ -2259,8 +1781,8 @@ for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AWK+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2273,57 +1795,54 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
- { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$AWK" && break
done
-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
all:
- @echo '@@@%%%=$(MAKE)=@@@%%%'
+ @echo 'ac_maketemp="$(MAKE)"'
_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
- *@@@%%%=?*=@@@%%%*)
- eval ac_cv_prog_make_${ac_make}_set=yes;;
- *)
- eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
rm -f conftest.make
fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
SET_MAKE=
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -2338,7 +1857,7 @@ rmdir .tst 2>/dev/null
DEPDIR="${am__leading_dot}deps"
-ac_config_commands="$ac_config_commands depfiles"
+ ac_config_commands="$ac_config_commands depfiles"
am_make=${MAKE-make}
@@ -2348,8 +1867,8 @@ am__doit:
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
-{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
-echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
am__include="#"
am__quote=
_am_result=none
@@ -2376,15 +1895,15 @@ if test "$am__include" = "#"; then
fi
-{ echo "$as_me:$LINENO: result: $_am_result" >&5
-echo "${ECHO_T}$_am_result" >&6; }
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
rm -f confinc confmf
-# Check whether --enable-dependency-tracking was given.
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
if test "${enable_dependency_tracking+set}" = set; then
- enableval=$enable_dependency_tracking;
-fi
+ enableval="$enable_dependency_tracking"
+fi;
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
@@ -2402,9 +1921,10 @@ fi
-# Check whether --enable-multilib was given.
+# Check whether --enable-multilib or --disable-multilib was given.
if test "${enable_multilib+set}" = set; then
- enableval=$enable_multilib; case "${enableval}" in
+ enableval="$enable_multilib"
+ case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for multilib option" >&5
@@ -2413,11 +1933,11 @@ echo "$as_me: error: bad value ${enableval} for multilib option" >&2;}
esac
else
multilib=yes
-fi
-
-# Check whether --enable-target-optspace was given.
+fi;
+# Check whether --enable-target-optspace or --disable-target-optspace was given.
if test "${enable_target_optspace+set}" = set; then
- enableval=$enable_target_optspace; case "${enableval}" in
+ enableval="$enable_target_optspace"
+ case "${enableval}" in
yes) target_optspace=yes ;;
no) target_optspace=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for target-optspace option" >&5
@@ -2426,11 +1946,11 @@ echo "$as_me: error: bad value ${enableval} for target-optspace option" >&2;}
esac
else
target_optspace=
-fi
-
-# Check whether --enable-malloc-debugging was given.
+fi;
+# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given.
if test "${enable_malloc_debugging+set}" = set; then
- enableval=$enable_malloc_debugging; case "${enableval}" in
+ enableval="$enable_malloc_debugging"
+ case "${enableval}" in
yes) malloc_debugging=yes ;;
no) malloc_debugging=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for malloc-debugging option" >&5
@@ -2439,11 +1959,11 @@ echo "$as_me: error: bad value ${enableval} for malloc-debugging option" >&2;}
esac
else
malloc_debugging=
-fi
-
-# Check whether --enable-newlib-multithread was given.
+fi;
+# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given.
if test "${enable_newlib_multithread+set}" = set; then
- enableval=$enable_newlib_multithread; case "${enableval}" in
+ enableval="$enable_newlib_multithread"
+ case "${enableval}" in
yes) newlib_multithread=yes ;;
no) newlib_multithread=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-multithread option" >&5
@@ -2452,11 +1972,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-multithread option" >&2;}
esac
else
newlib_multithread=yes
-fi
-
-# Check whether --enable-newlib-iconv was given.
+fi;
+# Check whether --enable-newlib-iconv or --disable-newlib-iconv was given.
if test "${enable_newlib_iconv+set}" = set; then
- enableval=$enable_newlib_iconv; if test "${newlib_iconv+set}" != set; then
+ enableval="$enable_newlib_iconv"
+ if test "${newlib_iconv+set}" != set; then
case "${enableval}" in
yes) newlib_iconv=yes ;;
no) newlib_iconv=no ;;
@@ -2467,11 +1987,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-iconv option" >&2;}
fi
else
newlib_iconv=${newlib_iconv}
-fi
-
-# Check whether --enable-newlib-elix-level was given.
+fi;
+# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given.
if test "${enable_newlib_elix_level+set}" = set; then
- enableval=$enable_newlib_elix_level; case "${enableval}" in
+ enableval="$enable_newlib_elix_level"
+ case "${enableval}" in
0) newlib_elix_level=0 ;;
1) newlib_elix_level=1 ;;
2) newlib_elix_level=2 ;;
@@ -2483,11 +2003,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-elix-level option" >&2;}
esac
else
newlib_elix_level=0
-fi
-
-# Check whether --enable-newlib-io-float was given.
+fi;
+# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given.
if test "${enable_newlib_io_float+set}" = set; then
- enableval=$enable_newlib_io_float; case "${enableval}" in
+ enableval="$enable_newlib_io_float"
+ case "${enableval}" in
yes) newlib_io_float=yes ;;
no) newlib_io_float=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-io-float option" >&5
@@ -2496,11 +2016,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-io-float option" >&2;}
esac
else
newlib_io_float=yes
-fi
-
-# Check whether --enable-newlib-supplied-syscalls was given.
+fi;
+# Check whether --enable-newlib-supplied-syscalls or --disable-newlib-supplied-syscalls was given.
if test "${enable_newlib_supplied_syscalls+set}" = set; then
- enableval=$enable_newlib_supplied_syscalls; case "${enableval}" in
+ enableval="$enable_newlib_supplied_syscalls"
+ case "${enableval}" in
yes) newlib_may_supply_syscalls=yes ;;
no) newlib_may_supply_syscalls=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-supplied-syscalls option" >&5
@@ -2509,8 +2029,7 @@ echo "$as_me: error: bad value ${enableval} for newlib-supplied-syscalls option"
esac
else
newlib_may_supply_syscalls=yes
-fi
-
+fi;
if test x${newlib_may_supply_syscalls} = xyes; then
@@ -2536,41 +2055,26 @@ else
fi
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
if test "${ac_cv_host+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test "x$host_alias" = x; then
- ac_cv_host=$ac_cv_build
-else
- ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
{ (exit 1); exit 1; }; }
-fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
- { (exit 1); exit 1; }; };;
-esac
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
@@ -2594,7 +2098,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
- VERSION='1.16.0'
+ VERSION='1.15.0'
# Some tools Automake needs.
@@ -2623,8 +2127,8 @@ if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2637,34 +2141,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
- { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2677,41 +2179,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
- { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
+ STRIP=$ac_ct_STRIP
else
STRIP="$ac_cv_prog_STRIP"
fi
@@ -2746,8 +2234,8 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2760,32 +2248,30 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
depcc="$CC" am_compiler_list=
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2874,8 +2360,8 @@ else
fi
fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
@@ -2894,8 +2380,8 @@ fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2909,7 +2395,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -2920,7 +2406,6 @@ do
fi
done
done
-IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -2938,21 +2423,20 @@ fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable cc found in \$PATH" >&5
echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: checking whether we are using GNU C" >&5
-echo $ECHO_N "checking whether we are using GNU C... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether we are using GNU C" >&5
+echo $ECHO_N "checking whether we are using GNU C... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2972,8 +2456,8 @@ else
ac_cv_c_compiler_gnu=no
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
if test $ac_cv_c_compiler_gnu = yes; then
GCC=yes
@@ -2982,16 +2466,13 @@ if test $ac_cv_c_compiler_gnu = yes; then
CFLAGS=
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -3007,118 +2488,38 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_prog_cc_g=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
@@ -3150,8 +2551,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3164,34 +2565,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AS="${ac_tool_prefix}as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AS=$ac_cv_prog_AS
if test -n "$AS"; then
- { echo "$as_me:$LINENO: result: $AS" >&5
-echo "${ECHO_T}$AS" >&6; }
+ echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AS"; then
ac_ct_AS=$AS
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3204,41 +2603,26 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AS="as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_AS=$ac_cv_prog_ac_ct_AS
if test -n "$ac_ct_AS"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
-echo "${ECHO_T}$ac_ct_AS" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AS" = x; then
- AS=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AS=$ac_ct_AS
- fi
+ AS=$ac_ct_AS
else
AS="$ac_cv_prog_AS"
fi
@@ -3246,8 +2630,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3260,34 +2644,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3300,41 +2682,26 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AR" = x; then
- AR=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AR=$ac_ct_AR
- fi
+ AR=$ac_ct_AR
else
AR="$ac_cv_prog_AR"
fi
@@ -3342,8 +2709,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3356,34 +2723,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3396,41 +2761,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- RANLIB=$ac_ct_RANLIB
- fi
+ RANLIB=$ac_ct_RANLIB
else
RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -3438,8 +2789,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
set dummy ${ac_tool_prefix}readelf; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_READELF+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3452,34 +2803,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_READELF="${ac_tool_prefix}readelf"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
READELF=$ac_cv_prog_READELF
if test -n "$READELF"; then
- { echo "$as_me:$LINENO: result: $READELF" >&5
-echo "${ECHO_T}$READELF" >&6; }
+ echo "$as_me:$LINENO: result: $READELF" >&5
+echo "${ECHO_T}$READELF" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_READELF"; then
ac_ct_READELF=$READELF
# Extract the first word of "readelf", so it can be a program name with args.
set dummy readelf; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_READELF+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3492,41 +2841,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_READELF="readelf"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_READELF" && ac_cv_prog_ac_ct_READELF=":"
fi
fi
ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
if test -n "$ac_ct_READELF"; then
- { echo "$as_me:$LINENO: result: $ac_ct_READELF" >&5
-echo "${ECHO_T}$ac_ct_READELF" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_READELF" >&5
+echo "${ECHO_T}$ac_ct_READELF" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_READELF" = x; then
- READELF=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- READELF=$ac_ct_READELF
- fi
+ READELF=$ac_ct_READELF
else
READELF="$ac_cv_prog_READELF"
fi
@@ -3545,8 +2880,8 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3568,7 +2903,7 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -3587,22 +2922,21 @@ case $as_dir/ in
;;
esac
done
-IFS=$as_save_IFS
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
+ # removed, or if the path is relative.
INSTALL=$ac_install_sh
fi
fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -3616,17 +2950,17 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */
ac_given_INSTALL=$INSTALL
-{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
- # Check whether --enable-maintainer-mode was given.
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
- enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
else
USE_MAINTAINER_MODE=no
-fi
-
- { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
-echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
+fi;
+ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
if test $USE_MAINTAINER_MODE = yes; then
@@ -3746,89 +3080,64 @@ OBJEXT=${oext}
-{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
- for ac_i in 1 2 3 4 5 6 7; do
- ac_script="$ac_script$as_nl$ac_script"
- done
- echo "$ac_script" | sed 99q >conftest.sed
- $as_unset ac_script || ac_script=
- # Extract the first word of "sed gsed" to use in msg output
-if test -z "$SED"; then
-set dummy sed gsed; ac_prog_name=$2
-if test "${ac_cv_path_SED+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_path_SED_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in sed gsed; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
- # Check for GNU ac_path_SED and select it if it is found.
- # Check for GNU $ac_path_SED
-case `"$ac_path_SED" --version 2>&1` in
-*GNU*)
- ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo '' >> "conftest.nl"
- "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_SED_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_SED="$ac_path_SED"
- ac_path_SED_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_SED_found && break 3
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
done
done
-
-done
IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
-
-fi
-
-SED="$ac_cv_path_SED"
-if test -z "$SED"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in \$PATH" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in \$PATH" >&2;}
- { (exit 1); exit 1; }; }
fi
-else
- ac_cv_path_SED=$SED
-fi
+SED=$lt_cv_path_SED
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
-echo "${ECHO_T}$ac_cv_path_SED" >&6; }
- SED="$ac_cv_path_SED"
- rm -f conftest.sed
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
test -z "$SED" && SED=sed
Xsed="$SED -e 1s/^X//"
@@ -3851,8 +3160,8 @@ case $host in
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3865,34 +3174,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AS="${ac_tool_prefix}as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AS=$ac_cv_prog_AS
if test -n "$AS"; then
- { echo "$as_me:$LINENO: result: $AS" >&5
-echo "${ECHO_T}$AS" >&6; }
+ echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AS"; then
ac_ct_AS=$AS
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3905,41 +3212,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AS="as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_AS" && ac_cv_prog_ac_ct_AS="false"
fi
fi
ac_ct_AS=$ac_cv_prog_ac_ct_AS
if test -n "$ac_ct_AS"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
-echo "${ECHO_T}$ac_ct_AS" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AS" = x; then
- AS="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AS=$ac_ct_AS
- fi
+ AS=$ac_ct_AS
else
AS="$ac_cv_prog_AS"
fi
@@ -3947,8 +3240,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3961,34 +3254,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
DLLTOOL=$ac_cv_prog_DLLTOOL
if test -n "$DLLTOOL"; then
- { echo "$as_me:$LINENO: result: $DLLTOOL" >&5
-echo "${ECHO_T}$DLLTOOL" >&6; }
+ echo "$as_me:$LINENO: result: $DLLTOOL" >&5
+echo "${ECHO_T}$DLLTOOL" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_DLLTOOL"; then
ac_ct_DLLTOOL=$DLLTOOL
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4001,41 +3292,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_DLLTOOL" && ac_cv_prog_ac_ct_DLLTOOL="false"
fi
fi
ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
if test -n "$ac_ct_DLLTOOL"; then
- { echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
-echo "${ECHO_T}$ac_ct_DLLTOOL" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
+echo "${ECHO_T}$ac_ct_DLLTOOL" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_DLLTOOL" = x; then
- DLLTOOL="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- DLLTOOL=$ac_ct_DLLTOOL
- fi
+ DLLTOOL=$ac_ct_DLLTOOL
else
DLLTOOL="$ac_cv_prog_DLLTOOL"
fi
@@ -4043,8 +3320,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_OBJDUMP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4057,34 +3334,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
OBJDUMP=$ac_cv_prog_OBJDUMP
if test -n "$OBJDUMP"; then
- { echo "$as_me:$LINENO: result: $OBJDUMP" >&5
-echo "${ECHO_T}$OBJDUMP" >&6; }
+ echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+echo "${ECHO_T}$OBJDUMP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_OBJDUMP"; then
ac_ct_OBJDUMP=$OBJDUMP
# Extract the first word of "objdump", so it can be a program name with args.
set dummy objdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4097,41 +3372,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJDUMP="objdump"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_OBJDUMP" && ac_cv_prog_ac_ct_OBJDUMP="false"
fi
fi
ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
if test -n "$ac_ct_OBJDUMP"; then
- { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
-echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+echo "${ECHO_T}$ac_ct_OBJDUMP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_OBJDUMP" = x; then
- OBJDUMP="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- OBJDUMP=$ac_ct_OBJDUMP
- fi
+ OBJDUMP=$ac_ct_OBJDUMP
else
OBJDUMP="$ac_cv_prog_OBJDUMP"
fi
@@ -4183,9 +3444,10 @@ enable_dlopen=no
-# Check whether --enable-shared was given.
+# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
- enableval=$enable_shared; p=${PACKAGE-default}
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
@@ -4204,8 +3466,7 @@ if test "${enable_shared+set}" = set; then
esac
else
enable_shared=yes
-fi
-
+fi;
@@ -4214,9 +3475,10 @@ fi
-# Check whether --enable-static was given.
+# Check whether --enable-static or --disable-static was given.
if test "${enable_static+set}" = set; then
- enableval=$enable_static; p=${PACKAGE-default}
+ enableval="$enable_static"
+ p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
@@ -4235,7 +3497,7 @@ if test "${enable_static+set}" = set; then
esac
else
enable_static=yes
-fi
+fi;
@@ -4245,14 +3507,13 @@ fi
-
-# Check whether --with-pic was given.
+# Check whether --with-pic or --without-pic was given.
if test "${with_pic+set}" = set; then
- withval=$with_pic; pic_mode="$withval"
+ withval="$with_pic"
+ pic_mode="$withval"
else
pic_mode=default
-fi
-
+fi;
test -z "$pic_mode" && pic_mode=default
@@ -4262,9 +3523,10 @@ test -z "$pic_mode" && pic_mode=default
-# Check whether --enable-fast-install was given.
+# Check whether --enable-fast-install or --disable-fast-install was given.
if test "${enable_fast_install+set}" = set; then
- enableval=$enable_fast_install; p=${PACKAGE-default}
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
@@ -4283,8 +3545,7 @@ if test "${enable_fast_install+set}" = set; then
esac
else
enable_fast_install=yes
-fi
-
+fi;
@@ -4301,8 +3562,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4315,34 +3576,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4355,51 +3614,36 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
+ CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4412,34 +3656,74 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4453,7 +3737,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -4464,7 +3748,6 @@ do
fi
done
done
-IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -4482,23 +3765,22 @@ fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
- for ac_prog in cl.exe
+ for ac_prog in cl
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4511,38 +3793,36 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in cl.exe
+ for ac_prog in cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4555,45 +3835,29 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$ac_ct_CC" && break
done
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
+ CC=$ac_ct_CC
fi
fi
@@ -4606,35 +3870,21 @@ See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler --version >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -v >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -V >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
@@ -4659,77 +3909,47 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort. b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions. Remove them first so a
-# subsequent execution test works.
-ac_rmfiles=
-for ac_file in $ac_files
-do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
- esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link_default") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile. We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
- then :; else
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- fi
- # We set ac_cv_exeext here because the later test for it is not
- # safe: cross compilers may not add the suffix if given an `-o'
- # argument, so we may need to know it at that point already.
- # Even if this section looks crufty: it has the advantage of
- # actually working.
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
break;;
* )
break;;
esac
done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
else
- ac_file=''
-fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -4741,21 +3961,19 @@ See \`config.log' for more details." >&2;}
fi
ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
-# Check that the compiler produces executables we can run. If not, either
+# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -4774,27 +3992,22 @@ See \`config.log' for more details." >&2;}
fi
fi
fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
+# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
@@ -4805,8 +4018,9 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
break;;
* ) break;;
esac
@@ -4820,14 +4034,14 @@ See \`config.log' for more details." >&2;}
fi
rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4847,20 +4061,14 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- for ac_file in conftest.o conftest.obj conftest.*; do
- test -f "$ac_file" || continue;
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
@@ -4878,12 +4086,12 @@ fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4906,49 +4114,50 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_compiler_gnu=no
+ac_compiler_gnu=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -4964,118 +4173,38 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_prog_cc_g=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
@@ -5091,12 +4220,12 @@ else
CFLAGS=
fi
fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_cc_c89=no
+ ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -5130,17 +4259,12 @@ static char *f (char * (*g) (char **, int), char **p, ...)
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std is added to get
+ as 'x'. The following induces an error, until -std1 is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std. */
+ that's true only with -std1. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
- inside strings and character constants. */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
@@ -5155,57 +4279,205 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
return 0;
}
_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_c89=$ac_arg
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c89" != "xno" && break
+rm -f conftest.err conftest.$ac_objext
done
-rm -f conftest.$ac_ext
+rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
- x)
- { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
- xno)
- { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
*)
- CC="$CC $ac_cv_prog_cc_c89"
- { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
esac
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5214,8 +4486,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
depcc="$CC" am_compiler_list=
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5304,8 +4576,8 @@ else
fi
fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
@@ -5321,249 +4593,34 @@ else
fi
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
- # Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_GREP_found && break 3
- done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-else
- ac_cv_path_GREP=$GREP
-fi
-
-
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
+echo "$as_me:$LINENO: checking for fgrep" >&5
+echo $ECHO_N "checking for fgrep... $ECHO_C" >&6
+if test "${ac_cv_prog_fgrep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
- # Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
+ if echo 'ab*c' | (grep -F 'ab*c') >/dev/null 2>&1
+ then ac_cv_prog_fgrep='grep -F'
+ else ac_cv_prog_fgrep='fgrep'
fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_EGREP_found && break 3
- done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
-
- fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ echo "$as_me:$LINENO: checking for fgrep" >&5
-echo $ECHO_N "checking for fgrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
- then ac_cv_path_FGREP="$GREP -F"
- else
- # Extract the first word of "fgrep" to use in msg output
-if test -z "$FGREP"; then
-set dummy fgrep; ac_prog_name=$2
-if test "${ac_cv_path_FGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_path_FGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in fgrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
- # Check for GNU ac_path_FGREP and select it if it is found.
- # Check for GNU $ac_path_FGREP
-case `"$ac_path_FGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo 'FGREP' >> "conftest.nl"
- "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_FGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_FGREP="$ac_path_FGREP"
- ac_path_FGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_FGREP_found && break 3
- done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-FGREP="$ac_cv_path_FGREP"
-if test -z "$FGREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-else
- ac_cv_path_FGREP=$FGREP
-fi
-
-
- fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
-echo "${ECHO_T}$ac_cv_path_FGREP" >&6; }
- FGREP="$ac_cv_path_FGREP"
+echo "$as_me:$LINENO: result: $ac_cv_prog_fgrep" >&5
+echo "${ECHO_T}$ac_cv_prog_fgrep" >&6
+ FGREP=$ac_cv_prog_fgrep
test -z "$GREP" && GREP=grep
@@ -5586,18 +4643,18 @@ test -z "$GREP" && GREP=grep
-# Check whether --with-gnu-ld was given.
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
- withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
-fi
-
+fi;
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
- { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -5626,11 +4683,11 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
;;
esac
elif test "$with_gnu_ld" = yes; then
- { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
else
- { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
fi
if test "${lt_cv_path_LD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5663,17 +4720,17 @@ fi
LD="$lt_cv_path_LD"
if test -n "$LD"; then
- { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+ echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
{ (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
if test "${lt_cv_prog_gnu_ld+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5687,8 +4744,8 @@ case `$LD -v 2>&1 </dev/null` in
;;
esac
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
with_gnu_ld=$lt_cv_prog_gnu_ld
@@ -5700,8 +4757,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
-{ echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
-echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6
if test "${lt_cv_path_NM+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5749,8 +4806,8 @@ else
: ${lt_cv_path_NM=no}
fi
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
@@ -5760,8 +4817,8 @@ else
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_DUMPBIN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5774,27 +4831,25 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
DUMPBIN=$ac_cv_prog_DUMPBIN
if test -n "$DUMPBIN"; then
- { echo "$as_me:$LINENO: result: $DUMPBIN" >&5
-echo "${ECHO_T}$DUMPBIN" >&6; }
+ echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+echo "${ECHO_T}$DUMPBIN" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$DUMPBIN" && break
done
fi
@@ -5804,8 +4859,8 @@ if test -z "$DUMPBIN"; then
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5818,45 +4873,30 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
if test -n "$ac_ct_DUMPBIN"; then
- { echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
-echo "${ECHO_T}$ac_ct_DUMPBIN" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+echo "${ECHO_T}$ac_ct_DUMPBIN" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$ac_ct_DUMPBIN" && break
done
+test -n "$ac_ct_DUMPBIN" || ac_ct_DUMPBIN=":"
- if test "x$ac_ct_DUMPBIN" = x; then
- DUMPBIN=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- DUMPBIN=$ac_ct_DUMPBIN
- fi
+ DUMPBIN=$ac_ct_DUMPBIN
fi
@@ -5871,43 +4911,43 @@ test -z "$NM" && NM=nm
-{ echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
-echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6
if test "${lt_cv_nm_interface+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:5881: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:4921: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:5884: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:4924: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:5887: output\"" >&5)
+ (eval echo "\"\$as_me:4927: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
fi
rm -f conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
-echo "${ECHO_T}$lt_cv_nm_interface" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+echo "${ECHO_T}$lt_cv_nm_interface" >&6
-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6; }
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
fi
# find the maximum length of command line arguments
-{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
if test "${lt_cv_sys_max_cmd_len+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6026,11 +5066,11 @@ else
fi
if test -n $lt_cv_sys_max_cmd_len ; then
- { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+ echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
else
- { echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6; }
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
fi
max_cmd_len=$lt_cv_sys_max_cmd_len
@@ -6043,26 +5083,26 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
: ${MV="mv -f"}
: ${RM="rm -f"}
-{ echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
-echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6
# Try some XSI features
xsi_shell=no
( _lt_dummy="a/b/c"
test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
= c,a/b,, ) >/dev/null 2>&1 \
&& xsi_shell=yes
-{ echo "$as_me:$LINENO: result: $xsi_shell" >&5
-echo "${ECHO_T}$xsi_shell" >&6; }
+echo "$as_me:$LINENO: result: $xsi_shell" >&5
+echo "${ECHO_T}$xsi_shell" >&6
-{ echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
-echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
+echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6
lt_shell_append=no
( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
>/dev/null 2>&1 \
&& lt_shell_append=yes
-{ echo "$as_me:$LINENO: result: $lt_shell_append" >&5
-echo "${ECHO_T}$lt_shell_append" >&6; }
+echo "$as_me:$LINENO: result: $lt_shell_append" >&5
+echo "${ECHO_T}$lt_shell_append" >&6
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -6096,15 +5136,15 @@ esac
-{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
if test "${lt_cv_ld_reload_flag+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_ld_reload_flag='-r'
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
reload_flag=$lt_cv_ld_reload_flag
case $reload_flag in
"" | " "*) ;;
@@ -6130,8 +5170,8 @@ esac
-{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
-echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6
if test "${lt_cv_deplibs_check_method+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6150,7 +5190,7 @@ lt_cv_deplibs_check_method='unknown'
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
-aix[4-9]*)
+aix4* | aix5*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -6320,8 +5360,8 @@ tpf*)
esac
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -6340,8 +5380,8 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6354,34 +5394,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6394,41 +5432,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AR" = x; then
- AR="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AR=$ac_ct_AR
- fi
+ AR=$ac_ct_AR
else
AR="$ac_cv_prog_AR"
fi
@@ -6449,8 +5473,8 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6463,34 +5487,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
- { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6503,41 +5525,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
- { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
+ STRIP=$ac_ct_STRIP
else
STRIP="$ac_cv_prog_STRIP"
fi
@@ -6552,8 +5560,8 @@ test -z "$STRIP" && STRIP=:
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6566,34 +5574,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6606,41 +5612,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- RANLIB=$ac_ct_RANLIB
- fi
+ RANLIB=$ac_ct_RANLIB
else
RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -6713,8 +5705,8 @@ compiler=$CC
# Check for command to grab the raw symbol name followed by C symbol from nm.
-{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6932,11 +5924,11 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
- { echo "$as_me:$LINENO: result: failed" >&5
-echo "${ECHO_T}failed" >&6; }
+ echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
else
- { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; }
+ echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
fi
@@ -6956,11 +5948,11 @@ fi
-# Check whether --enable-libtool-lock was given.
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
if test "${enable_libtool_lock+set}" = set; then
- enableval=$enable_libtool_lock;
-fi
+ enableval="$enable_libtool_lock"
+fi;
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
@@ -6987,7 +5979,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6990 "configure"' > conftest.$ac_ext
+ echo '#line 5982 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7079,8 +6071,8 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
- { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
if test "${lt_cv_cc_needs_belf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7106,32 +6098,35 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
lt_cv_cc_needs_belf=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- lt_cv_cc_needs_belf=no
+lt_cv_cc_needs_belf=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -7140,8 +6135,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
@@ -7175,8 +6170,8 @@ ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -7210,22 +6205,24 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
@@ -7234,10 +6231,9 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
-
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether nonexistent headers
+ # OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -7247,22 +6243,24 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
@@ -7273,7 +6271,6 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
-
rm -f conftest.err conftest.$ac_ext
done
@@ -7291,8 +6288,8 @@ fi
else
ac_cv_prog_CPP=$CPP
fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
@@ -7315,22 +6312,24 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
@@ -7339,10 +6338,9 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
-
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether nonexistent headers
+ # OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -7352,22 +6350,24 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
@@ -7378,7 +6378,6 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
-
rm -f conftest.err conftest.$ac_ext
done
@@ -7401,8 +6400,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7426,31 +6425,35 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_header_stdc=no
+ac_cv_header_stdc=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
@@ -7506,7 +6509,6 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ctype.h>
-#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -7526,27 +6528,18 @@ main ()
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
- return 2;
- return 0;
+ exit(2);
+ exit (0);
}
_ACEOF
rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -7559,14 +6552,12 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
-
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
@@ -7589,9 +6580,9 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -7605,35 +6596,38 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- eval "$as_ac_Header=no"
+eval "$as_ac_Header=no"
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -7648,9 +6642,9 @@ done
for ac_header in dlfcn.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -7664,35 +6658,38 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- eval "$as_ac_Header=no"
+eval "$as_ac_Header=no"
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -7753,8 +6750,8 @@ if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
-{ echo "$as_me:$LINENO: checking for objdir" >&5
-echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
if test "${lt_cv_objdir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7768,8 +6765,8 @@ else
fi
rmdir .libs 2>/dev/null
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-echo "${ECHO_T}$lt_cv_objdir" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
objdir=$lt_cv_objdir
@@ -7861,8 +6858,8 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7914,11 +6911,11 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
@@ -7927,8 +6924,8 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
- { echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7980,11 +6977,11 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
@@ -8064,8 +7061,8 @@ lt_prog_compiler_no_builtin_flag=
if test "$GCC" = yes; then
lt_prog_compiler_no_builtin_flag=' -fno-builtin'
- { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8082,11 +7079,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8085: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7082: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8089: \$? = $ac_status" >&5
+ echo "$as_me:7086: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8099,8 +7096,8 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
@@ -8119,8 +7116,8 @@ fi
lt_prog_compiler_pic=
lt_prog_compiler_static=
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
if test "$GCC" = yes; then
lt_prog_compiler_wl='-Wl,'
@@ -8374,8 +7371,8 @@ case $host_os in
lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
;;
esac
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
@@ -8386,8 +7383,8 @@ echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic"; then
- { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
if test "${lt_prog_compiler_pic_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8404,11 +7401,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8407: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7404: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8411: \$? = $ac_status" >&5
+ echo "$as_me:7408: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8421,8 +7418,8 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
if test x"$lt_prog_compiler_pic_works" = xyes; then
case $lt_prog_compiler_pic in
@@ -8445,8 +7442,8 @@ fi
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
if test "${lt_prog_compiler_static_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8473,8 +7470,8 @@ else
LDFLAGS="$save_LDFLAGS"
fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
if test x"$lt_prog_compiler_static_works" = xyes; then
:
@@ -8488,8 +7485,8 @@ fi
- { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
if test "${lt_cv_prog_compiler_c_o+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8509,11 +7506,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8512: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7509: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8516: \$? = $ac_status" >&5
+ echo "$as_me:7513: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8535,16 +7532,16 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
- { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
if test "${lt_cv_prog_compiler_c_o+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8564,11 +7561,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8567: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7564: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8571: \$? = $ac_status" >&5
+ echo "$as_me:7568: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8590,8 +7587,8 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
@@ -8599,16 +7596,16 @@ echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
- { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
hard_links=yes
$RM conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
- { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+ echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
if test "$hard_links" = no; then
{ echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -8623,8 +7620,8 @@ fi
- { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
runpath_var=
allow_undefined_flag=
@@ -8712,7 +7709,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
# See if GNU ld supports shared libraries.
case $host_os in
- aix[3-9]*)
+ aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
@@ -8946,7 +7943,7 @@ _LT_EOF
fi
;;
- aix[4-9]*)
+ aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
@@ -8966,7 +7963,7 @@ _LT_EOF
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
- case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
@@ -9059,23 +8056,27 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
@@ -9093,10 +8094,8 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -9126,23 +8125,27 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
@@ -9160,10 +8163,8 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -9418,33 +8419,35 @@ fi
int foo(void) {}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
else
@@ -9697,8 +8700,8 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
fi
fi
-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6; }
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
test "$ld_shlibs" = no && can_build_shared=no
with_gnu_ld=$with_gnu_ld
@@ -9734,8 +8737,8 @@ x|xyes)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
- { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
$RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
@@ -9772,8 +8775,8 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
cat conftest.err 1>&5
fi
$RM conftest*
- { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
;;
esac
fi
@@ -9936,8 +8939,8 @@ esac
- { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
withGCC=$GCC
if test "$withGCC" = yes; then
case $host_os in
@@ -10020,7 +9023,7 @@ aix3*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
-aix[4-9]*)
+aix4* | aix5*)
version_type=linux
need_lib_prefix=no
need_version=no
@@ -10369,23 +9372,27 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir"; then
shlibpath_overrides_runpath=yes
fi
@@ -10394,10 +9401,8 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$save_LDFLAGS
libdir=$save_libdir
@@ -10610,8 +9615,8 @@ uts4*)
dynamic_linker=no
;;
esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -10705,8 +9710,8 @@ fi
- { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" ||
test -n "$runpath_var" ||
@@ -10730,8 +9735,8 @@ else
# directories.
hardcode_action=unsupported
fi
-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6; }
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
if test "$hardcode_action" = relink ||
test "$inherit_rpath" = yes; then
@@ -10775,8 +9780,8 @@ else
darwin*)
# if libdl is installed we need to link against it
- { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -10789,53 +9794,56 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-return dlopen ();
+dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dl_dlopen=no
+ac_cv_lib_dl_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
@@ -10849,8 +9857,8 @@ fi
;;
*)
- { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
if test "${ac_cv_func_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -10877,64 +9885,73 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef shl_load
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
+{
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char shl_load ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined __stub_shl_load || defined __stub___shl_load
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
#endif
int
main ()
{
-return shl_load ();
+return f != shl_load;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_func_shl_load=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_func_shl_load=no
+ac_cv_func_shl_load=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
if test $ac_cv_func_shl_load = yes; then
lt_cv_dlopen="shl_load"
else
- { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
if test "${ac_cv_lib_dld_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -10947,58 +9964,61 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char shl_load ();
int
main ()
{
-return shl_load ();
+shl_load ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dld_shl_load=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dld_shl_load=no
+ac_cv_lib_dld_shl_load=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
if test $ac_cv_lib_dld_shl_load = yes; then
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
else
- { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
if test "${ac_cv_func_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11025,64 +10045,73 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef dlopen
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
+{
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined __stub_dlopen || defined __stub___dlopen
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
#endif
int
main ()
{
-return dlopen ();
+return f != dlopen;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_func_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_func_dlopen=no
+ac_cv_func_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
if test $ac_cv_func_dlopen = yes; then
lt_cv_dlopen="dlopen"
else
- { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11095,58 +10124,61 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-return dlopen ();
+dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dl_dlopen=no
+ac_cv_lib_dl_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
- { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
if test "${ac_cv_lib_svld_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11159,58 +10191,61 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-return dlopen ();
+dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_svld_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_svld_dlopen=no
+ac_cv_lib_svld_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
if test $ac_cv_lib_svld_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
else
- { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
if test "${ac_cv_lib_dld_dld_link+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11223,53 +10258,56 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dld_link ();
int
main ()
{
-return dld_link ();
+dld_link ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dld_dld_link=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dld_dld_link=no
+ac_cv_lib_dld_dld_link=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
if test $ac_cv_lib_dld_dld_link = yes; then
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
fi
@@ -11309,8 +10347,8 @@ fi
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
- { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
if test "${lt_cv_dlopen_self+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11320,7 +10358,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11323 "configure"
+#line 10361 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11404,13 +10442,13 @@ rm -fr conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
- { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
if test "${lt_cv_dlopen_self_static+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11420,7 +10458,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11423 "configure"
+#line 10461 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11504,8 +10542,8 @@ rm -fr conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
fi
CPPFLAGS="$save_CPPFLAGS"
@@ -11543,13 +10581,13 @@ fi
striplib=
old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
@@ -11557,16 +10595,16 @@ else
if test -n "$STRIP" ; then
striplib="$STRIP -x"
old_striplib="$STRIP -S"
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
;;
*)
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
;;
esac
fi
@@ -11583,13 +10621,13 @@ fi
# Report which library types will actually be built
- { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
- { echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6; }
+ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
- { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
@@ -11603,21 +10641,21 @@ echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
fi
;;
- aix[4-9]*)
+ aix4* | aix5*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
- { echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
- { echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
- { echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
+ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
@@ -11643,7 +10681,7 @@ CC="$lt_save_CC"
- ac_config_commands="$ac_config_commands libtool"
+ ac_config_commands="$ac_config_commands libtool"
@@ -11655,81 +10693,157 @@ fi
if test -n "${machine_dir}"; then
case ${machine_dir} in
- a29k) subdirs="$subdirs a29k"
+ a29k)
+
+subdirs="$subdirs a29k"
;;
- arm) subdirs="$subdirs arm"
+ arm)
+
+subdirs="$subdirs arm"
;;
- bfin) subdirs="$subdirs bfin"
+ bfin)
+
+subdirs="$subdirs bfin"
;;
- cris) subdirs="$subdirs cris"
+ cris)
+
+subdirs="$subdirs cris"
;;
- crx) subdirs="$subdirs crx"
+ crx)
+
+subdirs="$subdirs crx"
;;
- d10v) subdirs="$subdirs d10v"
+ d10v)
+
+subdirs="$subdirs d10v"
;;
- d30v) subdirs="$subdirs d30v"
+ d30v)
+
+subdirs="$subdirs d30v"
;;
- fr30) subdirs="$subdirs fr30"
+ fr30)
+
+subdirs="$subdirs fr30"
;;
- frv) subdirs="$subdirs frv"
+ frv)
+
+subdirs="$subdirs frv"
;;
- h8300) subdirs="$subdirs h8300"
+ h8300)
+
+subdirs="$subdirs h8300"
;;
- h8500) subdirs="$subdirs h8500"
+ h8500)
+
+subdirs="$subdirs h8500"
;;
- hppa) subdirs="$subdirs hppa"
+ hppa)
+
+subdirs="$subdirs hppa"
;;
- i386) subdirs="$subdirs i386"
+ i386)
+
+subdirs="$subdirs i386"
;;
- i960) subdirs="$subdirs i960"
+ i960)
+
+subdirs="$subdirs i960"
;;
- iq2000) subdirs="$subdirs iq2000"
+ iq2000)
+
+subdirs="$subdirs iq2000"
;;
- m32c) subdirs="$subdirs m32c"
+ m32c)
+
+subdirs="$subdirs m32c"
;;
- m32r) subdirs="$subdirs m32r"
+ m32r)
+
+subdirs="$subdirs m32r"
;;
- m68hc11) subdirs="$subdirs m68hc11"
+ m68hc11)
+
+subdirs="$subdirs m68hc11"
;;
- m68k) subdirs="$subdirs m68k"
+ m68k)
+
+subdirs="$subdirs m68k"
;;
- m88k) subdirs="$subdirs m88k"
+ m88k)
+
+subdirs="$subdirs m88k"
;;
- mep ) subdirs="$subdirs mep"
+ mep )
+
+subdirs="$subdirs mep"
;;
- mips) subdirs="$subdirs mips"
+ mips)
+
+subdirs="$subdirs mips"
;;
- mn10200) subdirs="$subdirs mn10200"
+ mn10200)
+
+subdirs="$subdirs mn10200"
;;
- mn10300) subdirs="$subdirs mn10300"
+ mn10300)
+
+subdirs="$subdirs mn10300"
;;
- mt) subdirs="$subdirs mt"
+ mt)
+
+subdirs="$subdirs mt"
;;
- necv70) subdirs="$subdirs necv70"
+ necv70)
+
+subdirs="$subdirs necv70"
;;
- powerpc) subdirs="$subdirs powerpc"
+ powerpc)
+
+subdirs="$subdirs powerpc"
;;
- sh) subdirs="$subdirs sh"
+ sh)
+
+subdirs="$subdirs sh"
;;
- sparc) subdirs="$subdirs sparc"
+ sparc)
+
+subdirs="$subdirs sparc"
;;
- spu) subdirs="$subdirs spu"
+ spu)
+
+subdirs="$subdirs spu"
;;
- tic4x) subdirs="$subdirs tic4x"
+ tic4x)
+
+subdirs="$subdirs tic4x"
;;
- tic80) subdirs="$subdirs tic80"
+ tic80)
+
+subdirs="$subdirs tic80"
;;
- v850) subdirs="$subdirs v850"
+ v850)
+
+subdirs="$subdirs v850"
;;
- w65) subdirs="$subdirs w65"
+ w65)
+
+subdirs="$subdirs w65"
;;
- x86_64) subdirs="$subdirs x86_64"
+ x86_64)
+
+subdirs="$subdirs x86_64"
;;
- xscale) subdirs="$subdirs xscale"
+ xscale)
+
+subdirs="$subdirs xscale"
;;
- xstormy16) subdirs="$subdirs xstormy16"
+ xstormy16)
+
+subdirs="$subdirs xstormy16"
;;
- z8k) subdirs="$subdirs z8k"
+ z8k)
+
+subdirs="$subdirs z8k"
;;
esac;
fi
@@ -11745,7 +10859,7 @@ else
fi
-ac_config_files="$ac_config_files Makefile"
+ ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -11765,58 +10879,39 @@ _ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
+# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-(
- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
-
+{
(set) 2>&1 |
- case $as_nl`(ac_space=' '; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;; #(
+ ;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
- esac |
- sort
-) |
+ esac;
+} |
sed '
- /^ac_cv_env_/b end
t clear
- :clear
+ : clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
- if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
- { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
cat confcache >$cache_file
else
- { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
@@ -11825,48 +10920,63 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section. Otherwise,
+# take arguments), then we branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
-ac_script='
+cat >confdef2opt.sed <<\_ACEOF
t clear
-:clear
-s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
t quote
-s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
t quote
-b any
-:quote
-s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
- g
- s/^\n//
- s/\n/ /g
- p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
- ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`echo "$ac_i" | sed "$ac_script"`
- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
- # will be set to the directory where LIBOBJS objects are built.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -11981,45 +11091,17 @@ cat >>$CONFIG_STATUS <<\_ACEOF
## M4sh Initialization. ##
## --------------------- ##
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
fi
+DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -12029,43 +11111,8 @@ else
fi
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
+$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
@@ -12079,19 +11126,18 @@ do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
@@ -12099,120 +11145,159 @@ fi
# Name of the executable.
-as_me=`$as_basename -- "$0" ||
+as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
-# CDPATH.
-$as_unset CDPATH
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
- s/-\n.*//
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
# Exit status is that of the last command.
exit
}
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir
-fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
@@ -12221,28 +11306,7 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -12251,14 +11315,31 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
exec 6>&1
-# Save the log message, to keep $[0] and so on meaningful, and to
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by newlib $as_me 1.16.0, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by newlib $as_me 1.15.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -12266,19 +11347,30 @@ generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_commands="$ac_config_commands"
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
-_ACEOF
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
cat >>$CONFIG_STATUS <<\_ACEOF
+
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
@@ -12286,7 +11378,7 @@ current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
- -V, --version print version number and configuration settings, then exit
+ -V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
@@ -12300,21 +11392,19 @@ Configuration commands:
$config_commands
Report bugs to <bug-autoconf@gnu.org>."
-
_ACEOF
+
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-newlib config.status 1.16.0
-configured by $0, generated by GNU Autoconf 2.61,
- with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+newlib config.status 1.15.0
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
+srcdir=$srcdir
+INSTALL="$INSTALL"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
@@ -12325,42 +11415,60 @@ while test $# != 0
do
case $1 in
--*=*)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
ac_shift=:
;;
- *)
+ -*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- echo "$ac_cs_version"; exit ;;
- --debug | --debu | --deb | --de | --d | -d )
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
- --he | --h | --help | --hel | -h )
- echo "$ac_cs_usage"; exit ;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; } ;;
- *) ac_config_targets="$ac_config_targets $1"
- ac_need_defaults=false ;;
+ *) ac_config_targets="$ac_config_targets $1" ;;
esac
shift
@@ -12376,28 +11484,17 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
- echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- CONFIG_SHELL=$SHELL
- export CONFIG_SHELL
- exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
- echo "$ac_log"
-} >&5
-_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
-# INIT-COMMANDS
+# INIT-COMMANDS section.
#
+
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
@@ -12646,23 +11743,22 @@ fi
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# Handling of arguments.
+
+cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
- case $ac_config_target in
- "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
- "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
- "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool" ) CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
-
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
@@ -12673,487 +11769,386 @@ if $ac_need_defaults; then
fi
# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
+# simply because there is no reason to put it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
+# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
- tmp=
- trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
+
# Create a (secure) tmp directory for tmp files.
{
- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
#
-# Set up the sed scripts for CONFIG_FILES section.
+# CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
-if test -n "$CONFIG_FILES"; then
-
-_ACEOF
-
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-MAY_SUPPLY_SYSCALLS_TRUE!$MAY_SUPPLY_SYSCALLS_TRUE$ac_delim
-MAY_SUPPLY_SYSCALLS_FALSE!$MAY_SUPPLY_SYSCALLS_FALSE$ac_delim
-newlib_basedir!$newlib_basedir$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-CYGPATH_W!$CYGPATH_W$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-VERSION!$VERSION$ac_delim
-ACLOCAL!$ACLOCAL$ac_delim
-AUTOCONF!$AUTOCONF$ac_delim
-AUTOMAKE!$AUTOMAKE$ac_delim
-AUTOHEADER!$AUTOHEADER$ac_delim
-MAKEINFO!$MAKEINFO$ac_delim
-install_sh!$install_sh$ac_delim
-STRIP!$STRIP$ac_delim
-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-AWK!$AWK$ac_delim
-SET_MAKE!$SET_MAKE$ac_delim
-am__leading_dot!$am__leading_dot$ac_delim
-AMTAR!$AMTAR$ac_delim
-am__tar!$am__tar$ac_delim
-am__untar!$am__untar$ac_delim
-CC!$CC$ac_delim
-DEPDIR!$DEPDIR$ac_delim
-am__include!$am__include$ac_delim
-am__quote!$am__quote$ac_delim
-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
-CCDEPMODE!$CCDEPMODE$ac_delim
-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
-AS!$AS$ac_delim
-AR!$AR$ac_delim
-RANLIB!$RANLIB$ac_delim
-READELF!$READELF$ac_delim
-MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
-MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
-MAINT!$MAINT$ac_delim
-CCAS!$CCAS$ac_delim
-CCASFLAGS!$CCASFLAGS$ac_delim
-NEWLIB_CFLAGS!$NEWLIB_CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-ELIX_LEVEL_0_TRUE!$ELIX_LEVEL_0_TRUE$ac_delim
-ELIX_LEVEL_0_FALSE!$ELIX_LEVEL_0_FALSE$ac_delim
-ELIX_LEVEL_1_TRUE!$ELIX_LEVEL_1_TRUE$ac_delim
-ELIX_LEVEL_1_FALSE!$ELIX_LEVEL_1_FALSE$ac_delim
-ELIX_LEVEL_2_TRUE!$ELIX_LEVEL_2_TRUE$ac_delim
-ELIX_LEVEL_2_FALSE!$ELIX_LEVEL_2_FALSE$ac_delim
-ELIX_LEVEL_3_TRUE!$ELIX_LEVEL_3_TRUE$ac_delim
-_ACEOF
-
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
- break
- elif $ac_last_try; then
- { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
- ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
- ac_eof=`expr $ac_eof + 1`
-fi
-
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-CEOF$ac_eof
-_ACEOF
-
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@MAY_SUPPLY_SYSCALLS_TRUE@,$MAY_SUPPLY_SYSCALLS_TRUE,;t t
+s,@MAY_SUPPLY_SYSCALLS_FALSE@,$MAY_SUPPLY_SYSCALLS_FALSE,;t t
+s,@newlib_basedir@,$newlib_basedir,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@CC@,$CC,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@AS@,$AS,;t t
+s,@ac_ct_AS@,$ac_ct_AS,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@READELF@,$READELF,;t t
+s,@ac_ct_READELF@,$ac_ct_READELF,;t t
+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
+s,@MAINT@,$MAINT,;t t
+s,@CCAS@,$CCAS,;t t
+s,@CCASFLAGS@,$CCASFLAGS,;t t
+s,@NEWLIB_CFLAGS@,$NEWLIB_CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@ELIX_LEVEL_0_TRUE@,$ELIX_LEVEL_0_TRUE,;t t
+s,@ELIX_LEVEL_0_FALSE@,$ELIX_LEVEL_0_FALSE,;t t
+s,@ELIX_LEVEL_1_TRUE@,$ELIX_LEVEL_1_TRUE,;t t
+s,@ELIX_LEVEL_1_FALSE@,$ELIX_LEVEL_1_FALSE,;t t
+s,@ELIX_LEVEL_2_TRUE@,$ELIX_LEVEL_2_TRUE,;t t
+s,@ELIX_LEVEL_2_FALSE@,$ELIX_LEVEL_2_FALSE,;t t
+s,@ELIX_LEVEL_3_TRUE@,$ELIX_LEVEL_3_TRUE,;t t
+s,@ELIX_LEVEL_3_FALSE@,$ELIX_LEVEL_3_FALSE,;t t
+s,@ELIX_LEVEL_4_TRUE@,$ELIX_LEVEL_4_TRUE,;t t
+s,@ELIX_LEVEL_4_FALSE@,$ELIX_LEVEL_4_FALSE,;t t
+s,@USE_LIBTOOL_TRUE@,$USE_LIBTOOL_TRUE,;t t
+s,@USE_LIBTOOL_FALSE@,$USE_LIBTOOL_FALSE,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@oext@,$oext,;t t
+s,@aext@,$aext,;t t
+s,@lpfx@,$lpfx,;t t
+s,@libm_machine_dir@,$libm_machine_dir,;t t
+s,@machine_dir@,$machine_dir,;t t
+s,@sys_dir@,$sys_dir,;t t
+s,@SED@,$SED,;t t
+s,@DLLTOOL@,$DLLTOOL,;t t
+s,@ac_ct_DLLTOOL@,$ac_ct_DLLTOOL,;t t
+s,@OBJDUMP@,$OBJDUMP,;t t
+s,@ac_ct_OBJDUMP@,$ac_ct_OBJDUMP,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@EGREP@,$EGREP,;t t
+s,@FGREP@,$FGREP,;t t
+s,@GREP@,$GREP,;t t
+s,@LD@,$LD,;t t
+s,@DUMPBIN@,$DUMPBIN,;t t
+s,@ac_ct_DUMPBIN@,$ac_ct_DUMPBIN,;t t
+s,@NM@,$NM,;t t
+s,@LN_S@,$LN_S,;t t
+s,@lt_ECHO@,$lt_ECHO,;t t
+s,@CPP@,$CPP,;t t
+s,@subdirs@,$subdirs,;t t
+s,@HAVE_MACHINE_DIR_TRUE@,$HAVE_MACHINE_DIR_TRUE,;t t
+s,@HAVE_MACHINE_DIR_FALSE@,$HAVE_MACHINE_DIR_FALSE,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- cat >conf$$subs.sed <<_ACEOF
-ELIX_LEVEL_3_FALSE!$ELIX_LEVEL_3_FALSE$ac_delim
-ELIX_LEVEL_4_TRUE!$ELIX_LEVEL_4_TRUE$ac_delim
-ELIX_LEVEL_4_FALSE!$ELIX_LEVEL_4_FALSE$ac_delim
-USE_LIBTOOL_TRUE!$USE_LIBTOOL_TRUE$ac_delim
-USE_LIBTOOL_FALSE!$USE_LIBTOOL_FALSE$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-oext!$oext$ac_delim
-aext!$aext$ac_delim
-lpfx!$lpfx$ac_delim
-libm_machine_dir!$libm_machine_dir$ac_delim
-machine_dir!$machine_dir$ac_delim
-sys_dir!$sys_dir$ac_delim
-SED!$SED$ac_delim
-DLLTOOL!$DLLTOOL$ac_delim
-OBJDUMP!$OBJDUMP$ac_delim
-LIBTOOL!$LIBTOOL$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-FGREP!$FGREP$ac_delim
-LD!$LD$ac_delim
-DUMPBIN!$DUMPBIN$ac_delim
-ac_ct_DUMPBIN!$ac_ct_DUMPBIN$ac_delim
-NM!$NM$ac_delim
-LN_S!$LN_S$ac_delim
-lt_ECHO!$lt_ECHO$ac_delim
-CPP!$CPP$ac_delim
-subdirs!$subdirs$ac_delim
-HAVE_MACHINE_DIR_TRUE!$HAVE_MACHINE_DIR_TRUE$ac_delim
-HAVE_MACHINE_DIR_FALSE!$HAVE_MACHINE_DIR_FALSE$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 35; then
- break
- elif $ac_last_try; then
- { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
- ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
- ac_eof=`expr $ac_eof + 1`
-fi
+fi # test -n "$CONFIG_FILES"
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
-_ACEOF
-
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[ ]*$//
-}'
-fi
-
cat >>$CONFIG_STATUS <<\_ACEOF
-fi # test -n "$CONFIG_FILES"
-
-
-for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS
-do
- case $ac_tag in
- :[FHLC]) ac_mode=$ac_tag; continue;;
- esac
- case $ac_mode$ac_tag in
- :[FHL]*:*);;
- :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
- { (exit 1); exit 1; }; };;
- :[FH]-) ac_tag=-:-;;
- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
- esac
- ac_save_IFS=$IFS
- IFS=:
- set x $ac_tag
- IFS=$ac_save_IFS
- shift
- ac_file=$1
- shift
-
- case $ac_mode in
- :L) ac_source=$1;;
- :[FH])
- ac_file_inputs=
- for ac_f
- do
- case $ac_f in
- -) ac_f="$tmp/stdin";;
- *) # Look for the file first in the build tree, then in the source tree
- # (if the path is not absolute). The absolute path cannot be DOS-style,
- # because $ac_f cannot contain `:'.
- test -f "$ac_f" ||
- case $ac_f in
- [\\/$]*) false;;
- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
- esac ||
- { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
- esac
- ac_file_inputs="$ac_file_inputs $ac_f"
- done
-
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- configure_input="Generated from "`IFS=:
- echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
- if test x"$ac_file" != x-; then
- configure_input="$ac_file. $configure_input"
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- fi
-
- case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin";;
- esac
- ;;
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- ac_dir=`$as_dirname -- "$ac_file" ||
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
+
ac_builddir=.
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
case $srcdir in
- .) # We are building in place.
+ .) # No --srcdir option. We are building in place.
ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
- case $ac_mode in
- :F)
- #
- # CONFIG_FILE
- #
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
- p
- q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- ac_datarootdir_hack='
- s&@datadir@&$datadir&g
- s&@docdir@&$docdir&g
- s&@infodir@&$infodir&g
- s&@localedir@&$localedir&g
- s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
@@ -13161,43 +12156,142 @@ _ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
-
- rm -f "$tmp/stdin"
- case $ac_file in
- -) cat "$tmp/out"; rm -f "$tmp/out";;
- *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
- esac
- ;;
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
- :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
- ;;
- esac
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
- case $ac_file$ac_mode in
- "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
@@ -13207,29 +12301,18 @@ echo "$as_me: executing $ac_file commands" >&6;}
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
- dirpart=`$as_dirname -- "$mf" ||
+ dirpart=`(dirname "$mf") 2>/dev/null ||
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(//\)$' \| \
- X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$mf" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$mf" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
else
continue
fi
@@ -13251,76 +12334,49 @@ echo X"$mf" |
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
- fdir=`$as_dirname -- "$file" ||
+ fdir=`(dirname "$file") 2>/dev/null ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
- X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- { as_dir=$dirpart/$fdir
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p $dirpart/$fdir
+ else
+ as_dir=$dirpart/$fdir
as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
{ (exit 1); exit 1; }; }; }
+
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
;;
- "libtool":C)
+ libtool )
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes.
@@ -13878,10 +12934,11 @@ _LT_EOF
chmod +x "$ofile"
;;
-
esac
-done # for ac_tag
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
@@ -13911,7 +12968,7 @@ if test "$no_create" != yes; then
fi
#
-# CONFIG_SUBDIRS section.
+# CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
#
if test "$no_recursion" != yes; then
@@ -13958,12 +13015,7 @@ if test "$no_recursion" != yes; then
case $ac_arg in
*\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
- ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
-
- # Pass --silent
- if test "$silent" = yes; then
- ac_sub_configure_args="--silent $ac_sub_configure_args"
- fi
+ ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
ac_popdir=`pwd`
for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
@@ -13972,83 +13024,97 @@ if test "$no_recursion" != yes; then
# parts of a large source tree are present.
test -d "$srcdir/$ac_dir" || continue
- ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
- echo "$as_me:$LINENO: $ac_msg" >&5
- echo "$ac_msg" >&6
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ { echo "$as_me:$LINENO: configuring in $ac_dir" >&5
+echo "$as_me: configuring in $ac_dir" >&6;}
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
+
ac_builddir=.
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
case $srcdir in
- .) # We are building in place.
+ .) # No --srcdir option. We are building in place.
ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir"
@@ -14072,8 +13138,8 @@ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
# Make the cache file name correct relative to the subdirectory.
case $cache_file in
[\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
- *) # Relative name.
- ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file=$ac_top_builddir$cache_file ;;
esac
{ echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
diff --git a/newlib/libc/machine/i386/memchr.S b/newlib/libc/machine/i386/memchr.S
index 7639685be..d29a04521 100644
--- a/newlib/libc/machine/i386/memchr.S
+++ b/newlib/libc/machine/i386/memchr.S
@@ -1,6 +1,6 @@
/*
* ====================================================
- * Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
+ * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
@@ -9,23 +9,21 @@
*/
#include "i386mach.h"
-
+
.global SYM (memchr)
SOTYPE_FUNCTION(memchr)
SYM (memchr):
pushl ebp
movl esp,ebp
- pushl edi
- movzbl 12(ebp),eax
- movl 16(ebp),ecx
- movl 8(ebp),edi
+ pushl edi
+ movl 12(ebp),eax
+ movl 16(ebp),ecx
+ movl 8(ebp),edi
xorl edx,edx
testl ecx,ecx
- jz L20
-
-#ifdef __OPTIMIZE_SIZE__
+ jz L1
cld
repnz
@@ -33,79 +31,9 @@ SYM (memchr):
setnz dl
decl edi
-
-#else /* !__OPTIMIZE_SIZE__ */
-/* Do byte-wise checks until string is aligned. */
- testl $3,edi
- je L5
- cmpb (edi),al
- je L15
- incl edi
- decl ecx
- je L20
-
- testl $3,edi
- je L5
- cmpb (edi),al
- je L15
- incl edi
- decl ecx
- je L20
-
- testl $3,edi
- je L5
- cmpb (edi),al
- je L15
- incl edi
- decl ecx
- je L20
-
-/* Create a mask, then check a word at a time. */
-L5:
- movb al,ah
- movl eax,edx
- sall $16,edx
- orl edx,eax
- pushl ebx
-
- .p2align 4,,7
-L8:
- subl $4,ecx
- jc L9
- movl (edi),edx
- addl $4,edi
- xorl eax,edx
- leal -16843009(edx),ebx
- notl edx
- andl edx,ebx
- testl $-2139062144,ebx
- je L8
-
- subl $4,edi
-
-L9:
- popl ebx
- xorl edx,edx
- addl $4,ecx
- je L20
-
-/* Final byte-wise checks. */
- .p2align 4,,7
-L10:
- cmpb (edi),al
- je L15
- incl edi
- decl ecx
- jne L10
-
- xorl edi,edi
-
-#endif /* !__OPTIMIZE_SIZE__ */
-
-L15:
decl edx
andl edi,edx
-L20:
+L1:
movl edx,eax
leal -4(ebp),esp
diff --git a/newlib/libc/machine/i386/memset.S b/newlib/libc/machine/i386/memset.S
index 6eb2cd6da..ce40820ff 100644
--- a/newlib/libc/machine/i386/memset.S
+++ b/newlib/libc/machine/i386/memset.S
@@ -1,6 +1,6 @@
/*
* ====================================================
- * Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
+ * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
@@ -18,82 +18,43 @@ SYM (memset):
pushl ebp
movl esp,ebp
pushl edi
+ pushl ebx
movl 8(ebp),edi
- movzbl 12(ebp),eax
+ movl 12(ebp),eax
movl 16(ebp),ecx
cld
#ifndef __OPTIMIZE_SIZE__
-/* Less than 16 bytes won't benefit from the 'rep stosl' loop. */
+ andl $255,eax
+ movl ecx,ebx
+ testl $3,edi
+ jne .L19
cmpl $16,ecx
jbe .L19
- testl $7,edi
- je .L10
-/* It turns out that 8-byte aligned 'rep stosl' outperforms
- 4-byte aligned on some x86 platforms. */
- movb al,(edi)
- incl edi
- decl ecx
- testl $7,edi
- je .L10
-
- movb al,(edi)
- incl edi
- decl ecx
- testl $7,edi
- je .L10
-
- movb al,(edi)
- incl edi
- decl ecx
- testl $7,edi
- je .L10
-
- movb al,(edi)
- incl edi
- decl ecx
- testl $7,edi
- je .L10
-
- movb al,(edi)
- incl edi
- decl ecx
- testl $7,edi
- je .L10
-
- movb al,(edi)
- incl edi
- decl ecx
- testl $7,edi
- je .L10
-
- movb al,(edi)
- incl edi
- decl ecx
+ movl eax,edx
+ sall $8,eax
+ orl edx,eax
-/* At this point, ecx>8 and edi%8==0. */
-.L10:
- movb al,ah
movl eax,edx
sall $16,edx
orl edx,eax
- movl ecx,edx
shrl $2,ecx
- andl $3,edx
+ andl $3,ebx
rep
stosl
- movl edx,ecx
+ movl ebx,ecx
#endif /* not __OPTIMIZE_SIZE__ */
-
+
.L19:
rep
stosb
movl 8(ebp),eax
- leal -4(ebp),esp
+ leal -8(ebp),esp
+ popl ebx
popl edi
leave
ret
diff --git a/newlib/libc/machine/i386/strchr.S b/newlib/libc/machine/i386/strchr.S
index 1d98b8149..fe425d2d8 100644
--- a/newlib/libc/machine/i386/strchr.S
+++ b/newlib/libc/machine/i386/strchr.S
@@ -1,6 +1,6 @@
/*
* ====================================================
- * Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
+ * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
@@ -9,7 +9,7 @@
*/
#include "i386mach.h"
-
+
.global SYM (strchr)
SOTYPE_FUNCTION(strchr)
@@ -21,45 +21,14 @@ SYM (strchr):
pushl ebx
xorl ebx,ebx
movl 8(ebp),edi
- addb 12(ebp),bl
-
-#ifndef __OPTIMIZE_SIZE__
-/* Special case strchr(p,0). */
- je L25
-
-/* Do byte-wise checks until string is aligned. */
- test $3,edi
- je L5
- movl edi,eax
- movb (eax),cl
- testb cl,cl
- je L14
- cmpb bl,cl
- je L19
- incl edi
-
- test $3,edi
- je L5
- movl edi,eax
- movb (eax),cl
- testb cl,cl
- je L14
- cmpb bl,cl
- je L19
- incl edi
+ movb 12(ebp),bl
+#ifndef __OPTIMIZE_SIZE__
+/* check if string is aligned, if not do check one byte at a time */
test $3,edi
- je L5
- movl edi,eax
- movb (eax),cl
- testb cl,cl
- je L14
- cmpb bl,cl
- je L19
- incl edi
+ jne L9
/* create 4 byte mask which is just the desired byte repeated 4 times */
-L5:
movl ebx,ecx
sall $8,ebx
subl $4,edi
@@ -80,14 +49,15 @@ L10:
testl $-2139062144,edx
jne L9
- xorl ebx,ecx
- leal -16843009(ecx),edx
- notl ecx
- andl ecx,edx
+ movl ebx,eax
+ xorl ecx,eax
+ leal -16843009(eax),edx
+ notl eax
+ andl eax,edx
testl $-2139062144,edx
je L10
#endif /* not __OPTIMIZE_SIZE__ */
-
+
/* loop while (*s && *s++ != c) */
L9:
leal -1(edi),eax
@@ -99,7 +69,7 @@ L15:
je L14
cmpb bl,dl
jne L15
-
+
L14:
/* if (*s == c) return address otherwise return NULL */
cmpb bl,(eax)
@@ -113,60 +83,3 @@ L19:
leave
ret
-#ifndef __OPTIMIZE_SIZE__
-/* Special case strchr(p,0). */
-#if 0
- /* Hideous performance on modern machines. */
-L25:
- cld
- movl $-1,ecx
- xor eax,eax
- repnz
- scasb
- leal -1(edi),eax
- jmp L19
-#endif
-L25:
-/* Do byte-wise checks until string is aligned. */
- test $3,edi
- je L26
- movl edi,eax
- movb (eax),cl
- testb cl,cl
- je L19
- incl edi
-
- test $3,edi
- je L26
- movl edi,eax
- movb (eax),cl
- testb cl,cl
- je L19
- incl edi
-
- test $3,edi
- je L26
- movl edi,eax
- movb (eax),cl
- testb cl,cl
- je L19
- incl edi
-
-L26:
- subl $4,edi
-
-/* loop performing 4 byte mask checking for desired 0 byte */
- .p2align 4,,7
-L27:
- addl $4,edi
- movl (edi),ecx
- leal -16843009(ecx),edx
- movl ecx,eax
- notl eax
- andl eax,edx
- testl $-2139062144,edx
- je L27
-
- jmp L9
-
-#endif /* !__OPTIMIZE_SIZE__ */
diff --git a/newlib/libc/machine/i386/strlen.S b/newlib/libc/machine/i386/strlen.S
index 0e3cb640c..459b3a959 100644
--- a/newlib/libc/machine/i386/strlen.S
+++ b/newlib/libc/machine/i386/strlen.S
@@ -1,6 +1,6 @@
/*
* ====================================================
- * Copyright (C) 1998, 2002, 2008 by Red Hat Inc. All rights reserved.
+ * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
@@ -20,75 +20,12 @@ SYM (strlen):
pushl edi
movl 8(ebp),edx
-#ifdef __OPTIMIZE_SIZE__
cld
movl edx,edi
movl $4294967295,ecx
xor eax,eax
repnz
scasb
-#else
-/* Modern x86 hardware is much faster at double-word
- manipulation than with bytewise repnz scasb. */
-
-/* Do byte-wise checks until string is aligned. */
- movl edx,edi
- test $3,edi
- je L5
- movb (edi),cl
- incl edi
- testb cl,cl
- je L15
-
- test $3,edi
- je L5
- movb (edi),cl
- incl edi
- testb cl,cl
- je L15
-
- test $3,edi
- je L5
- movb (edi),cl
- incl edi
- testb cl,cl
- je L15
-
-L5:
- subl $4,edi
-
-/* loop performing 4 byte mask checking for desired 0 byte */
- .p2align 4,,7
-L10:
- addl $4,edi
- movl (edi),ecx
- leal -16843009(ecx),eax
- notl ecx
- andl ecx,eax
- testl $-2139062144,eax
- je L10
-
-/* Find which of four bytes is 0. */
- notl ecx
- incl edi
-
- testb cl,cl
- je L15
- incl edi
- shrl $8,ecx
-
- testb cl,cl
- je L15
- incl edi
- shrl $8,ecx
-
- testb cl,cl
- je L15
- incl edi
-
-#endif
-
-L15:
subl edx,edi
leal -1(edi),eax
diff --git a/newlib/libc/machine/m68k/m68kasm.h b/newlib/libc/machine/m68k/m68kasm.h
deleted file mode 100644
index a5c610af9..000000000
--- a/newlib/libc/machine/m68k/m68kasm.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* These are predefined by new versions of GNU cpp. */
-
-#ifndef __USER_LABEL_PREFIX__
-#define __USER_LABEL_PREFIX__ _
-#endif
-
-#ifndef __REGISTER_PREFIX__
-#define __REGISTER_PREFIX__
-#endif
-
-/* ANSI concatenation macros. */
-
-#define CONCAT1(a, b) CONCAT2(a, b)
-#define CONCAT2(a, b) a ## b
-
-/* Use the right prefix for global labels. */
-
-#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
-
-/* Use the right prefix for registers. */
-
-#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
-
-#define d0 REG (d0)
-#define d1 REG (d1)
-#define d2 REG (d2)
-#define d3 REG (d3)
-#define d4 REG (d4)
-#define d5 REG (d5)
-#define d6 REG (d6)
-#define d7 REG (d7)
-#define a0 REG (a0)
-#define a1 REG (a1)
-#define a2 REG (a2)
-#define a3 REG (a3)
-#define a4 REG (a4)
-#define a5 REG (a5)
-#define a6 REG (a6)
-#define fp REG (fp)
-#define sp REG (sp)
diff --git a/newlib/libc/machine/m68k/memcpy.S b/newlib/libc/machine/m68k/memcpy.S
index 3badd58bf..ed9e7b2a1 100644
--- a/newlib/libc/machine/m68k/memcpy.S
+++ b/newlib/libc/machine/m68k/memcpy.S
@@ -13,13 +13,11 @@
* they apply.
*/
-#include "m68kasm.h"
-
.text
.align 4
- .globl SYM(memcpy)
- .type SYM(memcpy), @function
+ .globl memcpy
+ .type memcpy, @function
/* memcpy, optimised
*
@@ -33,64 +31,64 @@
* to further improve speed.
*/
-SYM(memcpy):
- move.l 4(sp),a0 | dest ptr
- move.l 8(sp),a1 | src ptr
- move.l 12(sp),d1 | len
- cmp.l #8,d1 | if fewer than 8 bytes to transfer,
+memcpy:
+ move.l 4(%sp),%a0 | dest ptr
+ move.l 8(%sp),%a1 | src ptr
+ move.l 12(%sp),%d1 | len
+ cmp.l #8,%d1 | if fewer than 8 bytes to transfer,
blo .Lresidue | do not optimise
/* align dest */
- move.l a0,d0 | copy of dest
- neg.l d0
- and.l #3,d0 | look for the lower two only
+ move.l %a0,%d0 | copy of dest
+ neg.l %d0
+ and.l #3,%d0 | look for the lower two only
beq 2f | is aligned?
- sub.l d0,d1
- lsr.l #1,d0 | word align needed?
+ sub.l %d0,%d1
+ lsr.l #1,%d0 | word align needed?
bcc 1f
- move.b (a1)+,(a0)+
+ move.b (%a1)+,(%a0)+
1:
- lsr.l #1,d0 | long align needed?
+ lsr.l #1,%d0 | long align needed?
bcc 2f
- move.w (a1)+,(a0)+
+ move.w (%a1)+,(%a0)+
2:
/* long word transfers */
- move.l d1,d0
- and.l #3,d1 | byte residue
- lsr.l #3,d0
+ move.l %d1,%d0
+ and.l #3,%d1 | byte residue
+ lsr.l #3,%d0
bcc 1f | carry set for 4-byte residue
- move.l (a1)+,(a0)+
+ move.l (%a1)+,(%a0)+
1:
- lsr.l #1,d0 | number of 16-byte transfers
+ lsr.l #1,%d0 | number of 16-byte transfers
bcc .Lcopy | carry set for 8-byte residue
bra .Lcopy8
1:
- move.l (a1)+,(a0)+
- move.l (a1)+,(a0)+
+ move.l (%a1)+,(%a0)+
+ move.l (%a1)+,(%a0)+
.Lcopy8:
- move.l (a1)+,(a0)+
- move.l (a1)+,(a0)+
+ move.l (%a1)+,(%a0)+
+ move.l (%a1)+,(%a0)+
.Lcopy:
#if !defined (__mcoldfire__)
- dbra d0,1b
- sub.l #0x10000,d0
+ dbra %d0,1b
+ sub.l #0x10000,%d0
#else
- subq.l #1,d0
+ subq.l #1,%d0
#endif
bpl 1b
bra .Lresidue
1:
- move.b (a1)+,(a0)+ | move residue bytes
+ move.b (%a1)+,(%a0)+ | move residue bytes
.Lresidue:
#if !defined (__mcoldfire__)
- dbra d1,1b | loop until done
+ dbra %d1,1b | loop until done
#else
- subq.l #1,d1
+ subq.l #1,%d1
bpl 1b
#endif
- move.l 4(sp),d0 | return value
+ move.l 4(%sp),%d0 | return value
rts
diff --git a/newlib/libc/machine/m68k/memset.S b/newlib/libc/machine/m68k/memset.S
index 622cf014d..545bf7e7d 100644
--- a/newlib/libc/machine/m68k/memset.S
+++ b/newlib/libc/machine/m68k/memset.S
@@ -13,13 +13,11 @@
* they apply.
*/
-#include "m68kasm.h"
-
.text
.align 4
- .globl SYM(memset)
- .type SYM(memset), @function
+ .globl memset
+ .type memset, @function
| memset, optimised
|
@@ -40,61 +38,61 @@
|
| VG, April 2007
|
-SYM(memset):
- move.l 4(sp),a0 | dest ptr
- move.l 8(sp),d0 | value
- move.l 12(sp),d1 | len
- cmp.l #16,d1
+memset:
+ move.l 4(%sp),%a0 | dest ptr
+ move.l 8(%sp),%d0 | value
+ move.l 12(%sp),%d1 | len
+ cmp.l #16,%d1
blo .Lbset | below, byte fills
|
- move.l d2,-(sp) | need a register
- move.b d0,d2 | distribute low byte to all byte in word
- lsl.l #8,d0
- move.b d2,d0
- move.w d0,d2
- swap d0 | rotate 16
- move.w d2,d0
+ move.l %d2,-(%sp) | need a register
+ move.b %d0,%d2 | distribute low byte to all byte in word
+ lsl.l #8,%d0
+ move.b %d2,%d0
+ move.w %d0,%d2
+ swap %d0 | rotate 16
+ move.w %d2,%d0
|
- move.l a0,d2 | copy of src
- neg.l d2 | 1 2 3 ==> 3 2 1
- and.l #3,d2
+ move.l %a0,%d2 | copy of src
+ neg.l %d2 | 1 2 3 ==> 3 2 1
+ and.l #3,%d2
beq 2f | is aligned
|
- sub.l d2,d1 | fix length
- lsr.l #1,d2 | word align needed?
+ sub.l %d2,%d1 | fix length
+ lsr.l #1,%d2 | word align needed?
bcc 1f
- move.b d0,(a0)+ | fill byte
+ move.b %d0,(%a0)+ | fill byte
1:
- lsr.l #1,d2 | long align needed?
+ lsr.l #1,%d2 | long align needed?
bcc 2f
- move.w d0,(a0)+ | fill word
+ move.w %d0,(%a0)+ | fill word
2:
- move.l d1,d2 | number of long transfers (at least 3)
- lsr.l #2,d2
- subq.l #1,d2
+ move.l %d1,%d2 | number of long transfers (at least 3)
+ lsr.l #2,%d2
+ subq.l #1,%d2
1:
- move.l d0,(a0)+ | fill long words
+ move.l %d0,(%a0)+ | fill long words
.Llset:
#if !defined (__mcoldfire__)
- dbra d2,1b | loop until done
- sub.l #0x10000,d2
+ dbra %d2,1b | loop until done
+ sub.l #0x10000,%d2
#else
- subq.l #1,d2
+ subq.l #1,%d2
#endif
bpl 1b
- and.l #3,d1 | residue byte transfers, fixed
- move.l (sp)+,d2 | restore d2
+ and.l #3,%d1 | residue byte transfers, fixed
+ move.l (%sp)+,%d2 | restore d2
bra .Lbset
1:
- move.b d0,(a0)+ | fill residue bytes
+ move.b %d0,(%a0)+ | fill residue bytes
.Lbset:
#if !defined (__mcoldfire__)
- dbra d1,1b | loop until done
+ dbra %d1,1b | loop until done
#else
- subq.l #1,d1
+ subq.l #1,%d1
bpl 1b
#endif
- move.l 4(sp),d0 | return value
+ move.l 4(%sp),%d0 | return value
rts
diff --git a/newlib/libc/machine/m68k/setjmp.S b/newlib/libc/machine/m68k/setjmp.S
index 4b260efcc..02a02c4e1 100644
--- a/newlib/libc/machine/m68k/setjmp.S
+++ b/newlib/libc/machine/m68k/setjmp.S
@@ -1,4 +1,43 @@
-#include "m68kasm.h"
+/* These are predefined by new versions of GNU cpp. */
+
+#ifndef __USER_LABEL_PREFIX__
+#define __USER_LABEL_PREFIX__ _
+#endif
+
+#ifndef __REGISTER_PREFIX__
+#define __REGISTER_PREFIX__
+#endif
+
+/* ANSI concatenation macros. */
+
+#define CONCAT1(a, b) CONCAT2(a, b)
+#define CONCAT2(a, b) a ## b
+
+/* Use the right prefix for global labels. */
+
+#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
+
+/* Use the right prefix for registers. */
+
+#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
+
+#define d0 REG (d0)
+#define d1 REG (d1)
+#define d2 REG (d2)
+#define d3 REG (d3)
+#define d4 REG (d4)
+#define d5 REG (d5)
+#define d6 REG (d6)
+#define d7 REG (d7)
+#define a0 REG (a0)
+#define a1 REG (a1)
+#define a2 REG (a2)
+#define a3 REG (a3)
+#define a4 REG (a4)
+#define a5 REG (a5)
+#define a6 REG (a6)
+#define fp REG (fp)
+#define sp REG (sp)
.global SYM (setjmp)
.global SYM (longjmp)
diff --git a/newlib/libc/machine/mips/strncpy.c b/newlib/libc/machine/mips/strncpy.c
index 47413cb7c..a2ceb2c77 100644
--- a/newlib/libc/machine/mips/strncpy.c
+++ b/newlib/libc/machine/mips/strncpy.c
@@ -18,7 +18,6 @@
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
-#include <stdint.h>
#if !defined(__GNUC__) || (__GNUC__ < 3)
#define __builtin_expect(a,b) a
@@ -83,26 +82,6 @@ strncpy (char *dst0, const char *src0, size_t count)
dst = (unsigned char *)dst0;
src = (unsigned const char *)src0;
- /* Take care of any odd bytes in the source data because we
- * want to unroll where we read ahead 2 or 4 bytes at a time and then
- * check each byte for the null terminator. This can result in
- * a segfault for the case where the source pointer is unaligned,
- * the null terminator is in valid memory, but reading 2 or 4 bytes at a
- * time blindly eventually goes outside of valid memory. */
- while (((uintptr_t) src & (UNROLL_FACTOR - 1)) != 0 && count > 0)
- {
- *dst++ = ch = *src++;
- --count;
- if (ch == '\0')
- {
- end = dst + count;
- while (dst != end)
- *dst++ = '\0';
-
- return dst0;
- }
- }
-
if (__builtin_expect (count >= 4, 1))
{
odd_bytes = (count & (UNROLL_FACTOR - 1));
diff --git a/newlib/libc/machine/mn10300/memset.S b/newlib/libc/machine/mn10300/memset.S
index a927a5ef6..ac97e090d 100644
--- a/newlib/libc/machine/mn10300/memset.S
+++ b/newlib/libc/machine/mn10300/memset.S
@@ -54,8 +54,8 @@ _memset:
inc a0
sub 1, a1
lne
-.Lepilogue:
mov d3,a0
+.Lepilogue:
ret [d2,d3,a2,a3], 16
.Lend_of_memset:
.size _memset, .Lend_of_memset - _memset
diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c
index d264e2673..2b2cec381 100644
--- a/newlib/libc/machine/powerpc/vfprintf.c
+++ b/newlib/libc/machine/powerpc/vfprintf.c
@@ -253,7 +253,7 @@ __sbprintf_r(rptr, fp, fmt, ap)
/* do the work, then copy any error status */
ret = _VFPRINTF_R(rptr, &fake, fmt, ap);
- if (ret >= 0 && _fflush_r(rptr, &fake))
+ if (ret >= 0 && fflush(&fake))
ret = EOF;
if (fake._flags & __SERR)
fp->_flags |= __SERR;
@@ -368,12 +368,13 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
#ifndef _NO_LONGLONG
#define quad_t long long
#define u_quad_t unsigned long long
-#else
-#define quad_t long
-#define u_quad_t u_long
#endif
+#ifndef _NO_LONGLONG
u_quad_t _uquad; /* integer arguments %[diouxX] */
+#else
+ u_long _uquad;
+#endif
enum { OCT, DEC, HEX } base;/* base for [diouxX] conversion */
int dprec; /* a copy of prec if [diouxX], 0 otherwise */
int realsz; /* field size expanded by dprec */
@@ -540,10 +541,9 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap),
/*
* Scan the format for conversions (`%' character).
*/
-
for (;;) {
cp = fmt;
- while ((n = _mbtowc_r(data, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
+ while ((n = _mbtowc_r(_REENT, &wc, fmt, MB_CUR_MAX, &state)) > 0) {
fmt += n;
if (wc == '%') {
fmt--;
@@ -754,9 +754,14 @@ reswitch: switch (ch) {
}
#endif /* __ALTIVEC__ */
_uquad = SARG();
+#ifndef _NO_LONGLONG
if ((quad_t)_uquad < 0)
+#else
+ if ((long) _uquad < 0)
+#endif
{
- _uquad = -(quad_t)_uquad;
+
+ _uquad = -_uquad;
old_sign = sign;
sign = '-';
}
@@ -902,11 +907,11 @@ reswitch: switch (ch) {
_uquad = -(quad_t)_uquad;
}
if (flags & SHORTINT)
- _uquad <<= (sizeof(quad_t) - sizeof(short)) * 8 + 1;
+ _uquad <<= 49;
else if (flags & LONGINT)
_uquad <<= 1;
else
- _uquad <<= (sizeof(quad_t) - sizeof(long)) * 8 + 1;
+ _uquad <<= 33;
if (_uquad == 0 && sign)
{
@@ -922,19 +927,15 @@ reswitch: switch (ch) {
flags |= FIXEDPOINT;
_uquad = UFPARG();
if (flags & SHORTINT)
- _uquad <<= (sizeof(quad_t) - sizeof(short)) * 8;
+ _uquad <<= 48;
else if (!(flags & LONGINT))
- _uquad <<= (sizeof(quad_t) - sizeof(long)) * 8;
+ _uquad <<= 32;
fixed_nosign:
if (prec == -1)
prec = DEFPREC;
-#ifndef _NO_LONGLONG
cp = cvt_ufix64 (data, _uquad, prec, &expt, &ndig);
-#else
- cp = cvs_ufix32 (data, _uquad, prec, &expt, &ndig);
-#endif
/* act like %f of format "0.X" */
size = prec + 2;
diff --git a/newlib/libc/machine/spu/Makefile.am b/newlib/libc/machine/spu/Makefile.am
index 070779140..47d826c94 100644
--- a/newlib/libc/machine/spu/Makefile.am
+++ b/newlib/libc/machine/spu/Makefile.am
@@ -8,26 +8,23 @@ noinst_LIBRARIES = lib.a
AM_CCASFLAGS = $(INCLUDES)
-lib_a_SOURCES = setjmp.S assert.c clearerr.c creat.c fclose.c feof.c \
- ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S \
- fiscanf.S fopen.c fprintf.S fputc.c fputs.c fread.c freopen.c \
- fscanf.S fseek.c fsetpos.c ftell.c fwrite.c getc.c getchar.c \
- gets.c impure.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c \
- memset.c perror.c printf.S putc.c putchar.c puts.c remove.c \
- rename.c rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S \
- sleep.c sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \
- strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c \
- strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c tmpfile.c \
- tmpnam.c ungetc.c usleep.c vfiprintf.c vfiscanf.c vfprintf.c \
- vfscanf.c viprintf.c viscanf.c vprintf.c vscanf.c vsiprintf.c \
- vsiscanf.c vsniprintf.c vsnprintf.c vsprintf.c vsscanf.c \
- stack_reg_va.S spu_clock_svcs.c spu_clock_stop.c spu_timer_flih.S \
- spu_timer_slih.c spu_timer_slih_reg.c spu_timer_svcs.c \
- spu_timer_stop.c spu_timer_free.c spu_timebase.c
+lib_a_SOURCES = setjmp.S clearerr.c creat.c fclose.c feof.c ferror.c fflush.c \
+ fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S fiscanf.S fopen.c \
+ fprintf.S fputc.c fputs.c fread.c freopen.c fscanf.S fseek.c \
+ fsetpos.c ftell.c fwrite.c getc.c getchar.c gets.c iprintf.S \
+ iscanf.S memcpy.c memmove.c memset.c perror.c printf.S \
+ putc.c putchar.c puts.c remove.c rename.c rewind.c scanf.S \
+ setbuf.c setvbuf.c siprintf.S siscanf.S sleep.c sniprintf.S \
+ snprintf.S sprintf.S sscanf.S stdio.c strcat.c strchr.c strcmp.c \
+ strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
+ strrchr.c strspn.c strxfrm.c tmpfile.c tmpnam.c ungetc.c usleep.c \
+ vfiprintf.c vfiscanf.c vfprintf.c vfscanf.c viprintf.c viscanf.c \
+ vprintf.c vscanf.c vsiprintf.c vsiscanf.c vsniprintf.c vsnprintf.c \
+ vsprintf.c vsscanf.c stack_reg_va.S
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
+ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
diff --git a/newlib/libc/machine/spu/Makefile.in b/newlib/libc/machine/spu/Makefile.in
index 2eefed4b9..e6cc2384c 100644
--- a/newlib/libc/machine/spu/Makefile.in
+++ b/newlib/libc/machine/spu/Makefile.in
@@ -73,12 +73,7 @@ DIST_COMMON = $(srcdir)/../../../../config.guess \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile
+ $(srcdir)/../../../../compile
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/../../../acinclude.m4 \
@@ -93,54 +88,48 @@ LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
lib_a_AR = $(AR) $(ARFLAGS)
lib_a_LIBADD =
-am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-assert.$(OBJEXT) \
- lib_a-clearerr.$(OBJEXT) lib_a-creat.$(OBJEXT) \
- lib_a-fclose.$(OBJEXT) lib_a-feof.$(OBJEXT) \
- lib_a-ferror.$(OBJEXT) lib_a-fflush.$(OBJEXT) \
- lib_a-fgetc.$(OBJEXT) lib_a-fgetpos.$(OBJEXT) \
- lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
- lib_a-fiprintf.$(OBJEXT) lib_a-fiscanf.$(OBJEXT) \
- lib_a-fopen.$(OBJEXT) lib_a-fprintf.$(OBJEXT) \
- lib_a-fputc.$(OBJEXT) lib_a-fputs.$(OBJEXT) \
- lib_a-fread.$(OBJEXT) lib_a-freopen.$(OBJEXT) \
- lib_a-fscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
- lib_a-fsetpos.$(OBJEXT) lib_a-ftell.$(OBJEXT) \
- lib_a-fwrite.$(OBJEXT) lib_a-getc.$(OBJEXT) \
- lib_a-getchar.$(OBJEXT) lib_a-gets.$(OBJEXT) \
- lib_a-impure.$(OBJEXT) lib_a-iprintf.$(OBJEXT) \
- lib_a-iscanf.$(OBJEXT) lib_a-memcmp.$(OBJEXT) \
- lib_a-memcpy.$(OBJEXT) lib_a-memmove.$(OBJEXT) \
- lib_a-memset.$(OBJEXT) lib_a-perror.$(OBJEXT) \
- lib_a-printf.$(OBJEXT) lib_a-putc.$(OBJEXT) \
- lib_a-putchar.$(OBJEXT) lib_a-puts.$(OBJEXT) \
- lib_a-remove.$(OBJEXT) lib_a-rename.$(OBJEXT) \
- lib_a-rewind.$(OBJEXT) lib_a-scanf.$(OBJEXT) \
- lib_a-setbuf.$(OBJEXT) lib_a-setvbuf.$(OBJEXT) \
- lib_a-siprintf.$(OBJEXT) lib_a-siscanf.$(OBJEXT) \
- lib_a-sleep.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
- lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
- lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
- lib_a-strcat.$(OBJEXT) lib_a-strchr.$(OBJEXT) \
- lib_a-strcmp.$(OBJEXT) lib_a-strcpy.$(OBJEXT) \
- lib_a-strcspn.$(OBJEXT) lib_a-strlen.$(OBJEXT) \
- lib_a-strncat.$(OBJEXT) lib_a-strncmp.$(OBJEXT) \
- lib_a-strncpy.$(OBJEXT) lib_a-strpbrk.$(OBJEXT) \
- lib_a-strrchr.$(OBJEXT) lib_a-strspn.$(OBJEXT) \
- lib_a-strxfrm.$(OBJEXT) lib_a-tmpfile.$(OBJEXT) \
- lib_a-tmpnam.$(OBJEXT) lib_a-ungetc.$(OBJEXT) \
- lib_a-usleep.$(OBJEXT) lib_a-vfiprintf.$(OBJEXT) \
- lib_a-vfiscanf.$(OBJEXT) lib_a-vfprintf.$(OBJEXT) \
- lib_a-vfscanf.$(OBJEXT) lib_a-viprintf.$(OBJEXT) \
- lib_a-viscanf.$(OBJEXT) lib_a-vprintf.$(OBJEXT) \
- lib_a-vscanf.$(OBJEXT) lib_a-vsiprintf.$(OBJEXT) \
- lib_a-vsiscanf.$(OBJEXT) lib_a-vsniprintf.$(OBJEXT) \
- lib_a-vsnprintf.$(OBJEXT) lib_a-vsprintf.$(OBJEXT) \
- lib_a-vsscanf.$(OBJEXT) lib_a-stack_reg_va.$(OBJEXT) \
- lib_a-spu_clock_svcs.$(OBJEXT) lib_a-spu_clock_stop.$(OBJEXT) \
- lib_a-spu_timer_flih.$(OBJEXT) lib_a-spu_timer_slih.$(OBJEXT) \
- lib_a-spu_timer_slih_reg.$(OBJEXT) \
- lib_a-spu_timer_svcs.$(OBJEXT) lib_a-spu_timer_stop.$(OBJEXT) \
- lib_a-spu_timer_free.$(OBJEXT) lib_a-spu_timebase.$(OBJEXT)
+am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-clearerr.$(OBJEXT) \
+ lib_a-creat.$(OBJEXT) lib_a-fclose.$(OBJEXT) \
+ lib_a-feof.$(OBJEXT) lib_a-ferror.$(OBJEXT) \
+ lib_a-fflush.$(OBJEXT) lib_a-fgetc.$(OBJEXT) \
+ lib_a-fgetpos.$(OBJEXT) lib_a-fgets.$(OBJEXT) \
+ lib_a-fileno.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
+ lib_a-fiscanf.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
+ lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
+ lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
+ lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
+ lib_a-fseek.$(OBJEXT) lib_a-fsetpos.$(OBJEXT) \
+ lib_a-ftell.$(OBJEXT) lib_a-fwrite.$(OBJEXT) \
+ lib_a-getc.$(OBJEXT) lib_a-getchar.$(OBJEXT) \
+ lib_a-gets.$(OBJEXT) lib_a-iprintf.$(OBJEXT) \
+ lib_a-iscanf.$(OBJEXT) lib_a-memcpy.$(OBJEXT) \
+ lib_a-memmove.$(OBJEXT) lib_a-memset.$(OBJEXT) \
+ lib_a-perror.$(OBJEXT) lib_a-printf.$(OBJEXT) \
+ lib_a-putc.$(OBJEXT) lib_a-putchar.$(OBJEXT) \
+ lib_a-puts.$(OBJEXT) lib_a-remove.$(OBJEXT) \
+ lib_a-rename.$(OBJEXT) lib_a-rewind.$(OBJEXT) \
+ lib_a-scanf.$(OBJEXT) lib_a-setbuf.$(OBJEXT) \
+ lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
+ lib_a-siscanf.$(OBJEXT) lib_a-sleep.$(OBJEXT) \
+ lib_a-sniprintf.$(OBJEXT) lib_a-snprintf.$(OBJEXT) \
+ lib_a-sprintf.$(OBJEXT) lib_a-sscanf.$(OBJEXT) \
+ lib_a-stdio.$(OBJEXT) lib_a-strcat.$(OBJEXT) \
+ lib_a-strchr.$(OBJEXT) lib_a-strcmp.$(OBJEXT) \
+ lib_a-strcpy.$(OBJEXT) lib_a-strcspn.$(OBJEXT) \
+ lib_a-strlen.$(OBJEXT) lib_a-strncat.$(OBJEXT) \
+ lib_a-strncmp.$(OBJEXT) lib_a-strncpy.$(OBJEXT) \
+ lib_a-strpbrk.$(OBJEXT) lib_a-strrchr.$(OBJEXT) \
+ lib_a-strspn.$(OBJEXT) lib_a-strxfrm.$(OBJEXT) \
+ lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
+ lib_a-ungetc.$(OBJEXT) lib_a-usleep.$(OBJEXT) \
+ lib_a-vfiprintf.$(OBJEXT) lib_a-vfiscanf.$(OBJEXT) \
+ lib_a-vfprintf.$(OBJEXT) lib_a-vfscanf.$(OBJEXT) \
+ lib_a-viprintf.$(OBJEXT) lib_a-viscanf.$(OBJEXT) \
+ lib_a-vprintf.$(OBJEXT) lib_a-vscanf.$(OBJEXT) \
+ lib_a-vsiprintf.$(OBJEXT) lib_a-vsiscanf.$(OBJEXT) \
+ lib_a-vsniprintf.$(OBJEXT) lib_a-vsnprintf.$(OBJEXT) \
+ lib_a-vsprintf.$(OBJEXT) lib_a-vsscanf.$(OBJEXT) \
+ lib_a-stack_reg_va.$(OBJEXT)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp =
@@ -267,26 +256,23 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
noinst_LIBRARIES = lib.a
AM_CCASFLAGS = $(INCLUDES)
-lib_a_SOURCES = setjmp.S assert.c clearerr.c creat.c fclose.c feof.c \
- ferror.c fflush.c fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S \
- fiscanf.S fopen.c fprintf.S fputc.c fputs.c fread.c freopen.c \
- fscanf.S fseek.c fsetpos.c ftell.c fwrite.c getc.c getchar.c \
- gets.c impure.c iprintf.S iscanf.S memcmp.c memcpy.c memmove.c \
- memset.c perror.c printf.S putc.c putchar.c puts.c remove.c \
- rename.c rewind.c scanf.S setbuf.c setvbuf.c siprintf.S siscanf.S \
- sleep.c sniprintf.S snprintf.S sprintf.S sscanf.S stdio.c strcat.c \
- strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c \
- strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c tmpfile.c \
- tmpnam.c ungetc.c usleep.c vfiprintf.c vfiscanf.c vfprintf.c \
- vfscanf.c viprintf.c viscanf.c vprintf.c vscanf.c vsiprintf.c \
- vsiscanf.c vsniprintf.c vsnprintf.c vsprintf.c vsscanf.c \
- stack_reg_va.S spu_clock_svcs.c spu_clock_stop.c spu_timer_flih.S \
- spu_timer_slih.c spu_timer_slih_reg.c spu_timer_svcs.c \
- spu_timer_stop.c spu_timer_free.c spu_timebase.c
+lib_a_SOURCES = setjmp.S clearerr.c creat.c fclose.c feof.c ferror.c fflush.c \
+ fgetc.c fgetpos.c fgets.c fileno.c fiprintf.S fiscanf.S fopen.c \
+ fprintf.S fputc.c fputs.c fread.c freopen.c fscanf.S fseek.c \
+ fsetpos.c ftell.c fwrite.c getc.c getchar.c gets.c iprintf.S \
+ iscanf.S memcpy.c memmove.c memset.c perror.c printf.S \
+ putc.c putchar.c puts.c remove.c rename.c rewind.c scanf.S \
+ setbuf.c setvbuf.c siprintf.S siscanf.S sleep.c sniprintf.S \
+ snprintf.S sprintf.S sscanf.S stdio.c strcat.c strchr.c strcmp.c \
+ strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c \
+ strrchr.c strspn.c strxfrm.c tmpfile.c tmpnam.c ungetc.c usleep.c \
+ vfiprintf.c vfiscanf.c vfprintf.c vfscanf.c viprintf.c viscanf.c \
+ vprintf.c vscanf.c vsiprintf.c vsiscanf.c vsniprintf.c vsnprintf.c \
+ vsprintf.c vsscanf.c stack_reg_va.S
lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS)
-ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
+ACLOCAL_AMFLAGS = -I ../../.. -I ../../../..
CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
all: all-am
@@ -441,24 +427,12 @@ lib_a-stack_reg_va.o: stack_reg_va.S
lib_a-stack_reg_va.obj: stack_reg_va.S
$(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-stack_reg_va.obj `if test -f 'stack_reg_va.S'; then $(CYGPATH_W) 'stack_reg_va.S'; else $(CYGPATH_W) '$(srcdir)/stack_reg_va.S'; fi`
-lib_a-spu_timer_flih.o: spu_timer_flih.S
- $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-spu_timer_flih.o `test -f 'spu_timer_flih.S' || echo '$(srcdir)/'`spu_timer_flih.S
-
-lib_a-spu_timer_flih.obj: spu_timer_flih.S
- $(CCAS) $(lib_a_CCASFLAGS) $(CCASFLAGS) -c -o lib_a-spu_timer_flih.obj `if test -f 'spu_timer_flih.S'; then $(CYGPATH_W) 'spu_timer_flih.S'; else $(CYGPATH_W) '$(srcdir)/spu_timer_flih.S'; fi`
-
.c.o:
$(COMPILE) -c $<
.c.obj:
$(COMPILE) -c `$(CYGPATH_W) '$<'`
-lib_a-assert.o: assert.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-assert.o `test -f 'assert.c' || echo '$(srcdir)/'`assert.c
-
-lib_a-assert.obj: assert.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-assert.obj `if test -f 'assert.c'; then $(CYGPATH_W) 'assert.c'; else $(CYGPATH_W) '$(srcdir)/assert.c'; fi`
-
lib_a-clearerr.o: clearerr.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clearerr.o `test -f 'clearerr.c' || echo '$(srcdir)/'`clearerr.c
@@ -591,18 +565,6 @@ lib_a-gets.o: gets.c
lib_a-gets.obj: gets.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gets.obj `if test -f 'gets.c'; then $(CYGPATH_W) 'gets.c'; else $(CYGPATH_W) '$(srcdir)/gets.c'; fi`
-lib_a-impure.o: impure.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-impure.o `test -f 'impure.c' || echo '$(srcdir)/'`impure.c
-
-lib_a-impure.obj: impure.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-impure.obj `if test -f 'impure.c'; then $(CYGPATH_W) 'impure.c'; else $(CYGPATH_W) '$(srcdir)/impure.c'; fi`
-
-lib_a-memcmp.o: memcmp.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcmp.o `test -f 'memcmp.c' || echo '$(srcdir)/'`memcmp.c
-
-lib_a-memcmp.obj: memcmp.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcmp.obj `if test -f 'memcmp.c'; then $(CYGPATH_W) 'memcmp.c'; else $(CYGPATH_W) '$(srcdir)/memcmp.c'; fi`
-
lib_a-memcpy.o: memcpy.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy.o `test -f 'memcpy.c' || echo '$(srcdir)/'`memcpy.c
@@ -872,54 +834,6 @@ lib_a-vsscanf.o: vsscanf.c
lib_a-vsscanf.obj: vsscanf.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsscanf.obj `if test -f 'vsscanf.c'; then $(CYGPATH_W) 'vsscanf.c'; else $(CYGPATH_W) '$(srcdir)/vsscanf.c'; fi`
-
-lib_a-spu_clock_svcs.o: spu_clock_svcs.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_clock_svcs.o `test -f 'spu_clock_svcs.c' || echo '$(srcdir)/'`spu_clock_svcs.c
-
-lib_a-spu_clock_svcs.obj: spu_clock_svcs.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_clock_svcs.obj `if test -f 'spu_clock_svcs.c'; then $(CYGPATH_W) 'spu_clock_svcs.c'; else $(CYGPATH_W) '$(srcdir)/spu_clock_svcs.c'; fi`
-
-lib_a-spu_clock_stop.o: spu_clock_stop.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_clock_stop.o `test -f 'spu_clock_stop.c' || echo '$(srcdir)/'`spu_clock_stop.c
-
-lib_a-spu_clock_stop.obj: spu_clock_stop.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_clock_stop.obj `if test -f 'spu_clock_stop.c'; then $(CYGPATH_W) 'spu_clock_stop.c'; else $(CYGPATH_W) '$(srcdir)/spu_clock_stop.c'; fi`
-
-lib_a-spu_timer_slih.o: spu_timer_slih.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_slih.o `test -f 'spu_timer_slih.c' || echo '$(srcdir)/'`spu_timer_slih.c
-
-lib_a-spu_timer_slih.obj: spu_timer_slih.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_slih.obj `if test -f 'spu_timer_slih.c'; then $(CYGPATH_W) 'spu_timer_slih.c'; else $(CYGPATH_W) '$(srcdir)/spu_timer_slih.c'; fi`
-
-lib_a-spu_timer_slih_reg.o: spu_timer_slih_reg.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_slih_reg.o `test -f 'spu_timer_slih_reg.c' || echo '$(srcdir)/'`spu_timer_slih_reg.c
-
-lib_a-spu_timer_slih_reg.obj: spu_timer_slih_reg.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_slih_reg.obj `if test -f 'spu_timer_slih_reg.c'; then $(CYGPATH_W) 'spu_timer_slih_reg.c'; else $(CYGPATH_W) '$(srcdir)/spu_timer_slih_reg.c'; fi`
-
-lib_a-spu_timer_svcs.o: spu_timer_svcs.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_svcs.o `test -f 'spu_timer_svcs.c' || echo '$(srcdir)/'`spu_timer_svcs.c
-
-lib_a-spu_timer_svcs.obj: spu_timer_svcs.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_svcs.obj `if test -f 'spu_timer_svcs.c'; then $(CYGPATH_W) 'spu_timer_svcs.c'; else $(CYGPATH_W) '$(srcdir)/spu_timer_svcs.c'; fi`
-
-lib_a-spu_timer_stop.o: spu_timer_stop.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_stop.o `test -f 'spu_timer_stop.c' || echo '$(srcdir)/'`spu_timer_stop.c
-
-lib_a-spu_timer_stop.obj: spu_timer_stop.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_stop.obj `if test -f 'spu_timer_stop.c'; then $(CYGPATH_W) 'spu_timer_stop.c'; else $(CYGPATH_W) '$(srcdir)/spu_timer_stop.c'; fi`
-
-lib_a-spu_timer_free.o: spu_timer_free.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_free.o `test -f 'spu_timer_free.c' || echo '$(srcdir)/'`spu_timer_free.c
-
-lib_a-spu_timer_free.obj: spu_timer_free.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timer_free.obj `if test -f 'spu_timer_free.c'; then $(CYGPATH_W) 'spu_timer_free.c'; else $(CYGPATH_W) '$(srcdir)/spu_timer_free.c'; fi`
-
-lib_a-spu_timebase.o: spu_timebase.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timebase.o `test -f 'spu_timebase.c' || echo '$(srcdir)/'`spu_timebase.c
-
-lib_a-spu_timebase.obj: spu_timebase.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spu_timebase.obj `if test -f 'spu_timebase.c'; then $(CYGPATH_W) 'spu_timebase.c'; else $(CYGPATH_W) '$(srcdir)/spu_timebase.c'; fi`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
diff --git a/newlib/libc/machine/spu/assert.c b/newlib/libc/machine/spu/assert.c
deleted file mode 100644
index f1dd33047..000000000
--- a/newlib/libc/machine/spu/assert.c
+++ /dev/null
@@ -1,41 +0,0 @@
-#include <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/*
- * SPU specific assert: just directly call exit(6), and use fprintf. That
- * way we do not pull in the abort, signal.o code, nor (the likely
- * otherwise unused) fiprintf.
- */
-
-/* func can be NULL, in which case no function information is given. */
-void
-_DEFUN (__assert_func, (file, line, func, failedexpr),
- const char *file _AND
- int line _AND
- const char *func _AND
- const char *failedexpr)
-{
- fprintf(stderr,
- "assertion \"%s\" failed: file \"%s\", line %d%s%s\n",
- failedexpr, file, line,
- func ? ", function: " : "", func ? func : "");
- /*
- * On the SPU, we do not have signaling. Previously, standard newlib
- * abort code was used. That eventually leads to a kill(SIGABRT), and
- * for SPU too an exit(SIGABRT). SIGABRT was 6, so just use that value
- * here.
- */
- exit(6);
- /* NOTREACHED */
-}
-
-void
-_DEFUN (__assert, (file, line, failedexpr),
- const char *file _AND
- int line _AND
- const char *failedexpr)
-{
- __assert_func (file, line, NULL, failedexpr);
- /* NOTREACHED */
-}
diff --git a/newlib/libc/machine/spu/fprintf.S b/newlib/libc/machine/spu/fprintf.S
index c4a3efa77..ddd02550e 100644
--- a/newlib/libc/machine/spu/fprintf.S
+++ b/newlib/libc/machine/spu/fprintf.S
@@ -33,7 +33,6 @@
.text
.align 4
GLOBL fprintf
- .type fprintf, @function
fprintf:
stqd $0, 16($sp) /* save caller address */
il $2, 2 /* number of fixed arguments */
@@ -54,4 +53,3 @@ fprintf:
a $sp, $sp, $2
lqd $0, 16($sp) /* load caller address */
bi $0 /* return to caller */
- .size fprintf, .-fprintf
diff --git a/newlib/libc/machine/spu/fscanf.S b/newlib/libc/machine/spu/fscanf.S
index e0d5f7fec..5b51e1dbe 100644
--- a/newlib/libc/machine/spu/fscanf.S
+++ b/newlib/libc/machine/spu/fscanf.S
@@ -33,7 +33,6 @@
.text
.align 4
GLOBL fscanf
- .type fscanf, @function
fscanf:
stqd $0, 16($sp) /* save caller address */
il $2, 2 /* number of fixed arguments */
@@ -54,4 +53,3 @@ fscanf:
a $sp, $sp, $2
lqd $0, 16($sp) /* load caller address */
bi $0 /* return to caller */
- .size fscanf, .-fscanf
diff --git a/newlib/libc/machine/spu/impure.c b/newlib/libc/machine/spu/impure.c
deleted file mode 100644
index 5fbe0e5f5..000000000
--- a/newlib/libc/machine/spu/impure.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <reent.h>
-
-/* Note that there is a copy of this in sys/reent.h. */
-#ifndef __ATTRIBUTE_IMPURE_PTR__
-#define __ATTRIBUTE_IMPURE_PTR__
-#endif
-
-#ifndef __ATTRIBUTE_IMPURE_DATA__
-#define __ATTRIBUTE_IMPURE_DATA__
-#endif
-
-struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT(_impure_data);
-struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &_impure_data;
-struct _reent *_CONST __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &_impure_data;
diff --git a/newlib/libc/machine/spu/include/spu_timer.h b/newlib/libc/machine/spu/include/spu_timer.h
deleted file mode 100644
index 4116aac9f..000000000
--- a/newlib/libc/machine/spu/include/spu_timer.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-#ifndef _SPU_TIMER_H_
-#define _SPU_TIMER_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-/* Clock services. */
-extern void spu_clock_start (void);
-extern int spu_clock_stop (void);
-extern uint64_t spu_clock_read (void);
-
-/* Timer services. */
-extern int spu_timer_alloc (int interval, void (*func) (int));
-extern int spu_timer_free (int id);
-extern int spu_timer_start (int id);
-extern int spu_timer_stop (int id);
-extern unsigned spu_timebase (void);
-
-/* Interrupt services. */
-extern void spu_slih_register (unsigned event_mask,
- unsigned (*slih) (unsigned));
-extern unsigned spu_clock_slih (unsigned event_mask);
-
-/* Number of supported timers. */
-#define SPU_TIMER_NTIMERS 4
-
-/* Recommended minimun spu timer interval time from (cat /proc/cpuinfo)
- * QS20 100/14318000 = 6.98 usec
- * QS21/QS22 100/26666666 = 3.75 usec
- * PS3 100/79800000 = 1.25 usec */
-#define SPU_TIMER_MIN_INTERVAL 100
-
-/* Clock error codes. */
-#define SPU_CLOCK_ERR_NOT_RUNNING -2
-#define SPU_CLOCK_ERR_STILL_RUNNING -3
-#define SPU_CLOCK_ERR_TIMERS_ACTIVE -4
-
-/* Timer error codes. */
-#define SPU_TIMER_ERR_INVALID_PARM -10
-#define SPU_TIMER_ERR_NONE_FREE -11
-#define SPU_TIMER_ERR_INVALID_ID -12
-#define SPU_TIMER_ERR_ACTIVE -13
-#define SPU_TIMER_ERR_NOT_ACTIVE -14
-#define SPU_TIMER_ERR_NOCLOCK -15
-#define SPU_TIMER_ERR_FREE -16
-#define SPU_TIMER_ERR_NOT_STOPPED -17
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/newlib/libc/machine/spu/memcmp.c b/newlib/libc/machine/spu/memcmp.c
deleted file mode 100644
index a0f5449d9..000000000
--- a/newlib/libc/machine/spu/memcmp.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- (C) Copyright 2008
- International Business Machines Corporation
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * 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.
- * Neither the names of the copyright holders nor the names of their
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
- 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.
-*/
-
-#include <stddef.h>
-#include "strncmp.h"
-
-/*
- * Compare the two strings s1 and s2 of length n. Returns an integer less
- * than, equal to, or greater than zero if s1 is found, respectively,
- * to be less than, to match, or be greater than s2.
- */
-int memcmp(const void *s1, const void *s2, size_t n)
-{
- vec_uint4 end_v;
- return _strncmp_internal (s1, s2, n, &end_v, 0 /* no zero check */);
-}
diff --git a/newlib/libc/machine/spu/mk_syscalls b/newlib/libc/machine/spu/mk_syscalls
index 8ed87e5fa..db9ea9409 100644
--- a/newlib/libc/machine/spu/mk_syscalls
+++ b/newlib/libc/machine/spu/mk_syscalls
@@ -69,7 +69,6 @@ while ($line = <DEFS>) {
print SOURCE " .text\n";
print SOURCE " .align 4\n";
print SOURCE " GLOBL ", $name, "\n";
- print SOURCE " .type ", $name, ", \@function\n";
print SOURCE $name, ":\n";
print SOURCE " stqd \$0, 16(\$sp) \/\* save caller address \*\/\n";
@@ -94,8 +93,6 @@ while ($line = <DEFS>) {
print SOURCE " lqd \$0, 16(\$sp) \/\* load caller address \*\/\n";
print SOURCE " bi \$0 \/\* return to caller \*\/\n";
- print SOURCE " .size ", $name, ", .-", $name, "\n";
-
close(SOURCE);
}
diff --git a/newlib/libc/machine/spu/printf.S b/newlib/libc/machine/spu/printf.S
index d4485c93a..36feaf7aa 100644
--- a/newlib/libc/machine/spu/printf.S
+++ b/newlib/libc/machine/spu/printf.S
@@ -33,7 +33,6 @@
.text
.align 4
GLOBL printf
- .type printf, @function
printf:
stqd $0, 16($sp) /* save caller address */
il $2, 1 /* number of fixed arguments */
@@ -48,4 +47,3 @@ printf:
a $sp, $sp, $2
lqd $0, 16($sp) /* load caller address */
bi $0 /* return to caller */
- .size printf, .-printf
diff --git a/newlib/libc/machine/spu/scanf.S b/newlib/libc/machine/spu/scanf.S
index 040065868..f547d8ecf 100644
--- a/newlib/libc/machine/spu/scanf.S
+++ b/newlib/libc/machine/spu/scanf.S
@@ -33,7 +33,6 @@
.text
.align 4
GLOBL scanf
- .type scanf, @function
scanf:
stqd $0, 16($sp) /* save caller address */
il $2, 1 /* number of fixed arguments */
@@ -48,4 +47,3 @@ scanf:
a $sp, $sp, $2
lqd $0, 16($sp) /* load caller address */
bi $0 /* return to caller */
- .size scanf, .-scanf
diff --git a/newlib/libc/machine/spu/setjmp.S b/newlib/libc/machine/spu/setjmp.S
index 891806bb0..dfa1bd0c4 100644
--- a/newlib/libc/machine/spu/setjmp.S
+++ b/newlib/libc/machine/spu/setjmp.S
@@ -36,7 +36,6 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
.text
.align 2
.global setjmp
- .type setjmp, @function
setjmp:
stqd $80, 2*16($3)
stqd $81, 3*16($3)
@@ -98,7 +97,6 @@ setjmp:
setjmp_ret:
bi $0
- .size setjmp, .-setjmp
/*
int longjmp( jmp_buf env, int val );
@@ -106,7 +104,6 @@ setjmp_ret:
.text
.align 2
.global longjmp
- .type longjmp, @function
longjmp:
lr $127, $1
@@ -179,5 +176,4 @@ longjmp:
longjmp_ret:
bi $0
- .size longjmp, .-longjmp
diff --git a/newlib/libc/machine/spu/snprintf.S b/newlib/libc/machine/spu/snprintf.S
index 17d03e376..90bd98a03 100644
--- a/newlib/libc/machine/spu/snprintf.S
+++ b/newlib/libc/machine/spu/snprintf.S
@@ -33,7 +33,6 @@
.text
.align 4
GLOBL snprintf
- .type snprintf, @function
snprintf:
stqd $0, 16($sp) /* save caller address */
il $2, 3 /* number of fixed arguments */
@@ -48,4 +47,3 @@ snprintf:
a $sp, $sp, $2
lqd $0, 16($sp) /* load caller address */
bi $0 /* return to caller */
- .size snprintf, .-snprintf
diff --git a/newlib/libc/machine/spu/sprintf.S b/newlib/libc/machine/spu/sprintf.S
index 9464aed19..56fca77ea 100644
--- a/newlib/libc/machine/spu/sprintf.S
+++ b/newlib/libc/machine/spu/sprintf.S
@@ -33,7 +33,6 @@
.text
.align 4
GLOBL sprintf
- .type sprintf, @function
sprintf:
stqd $0, 16($sp) /* save caller address */
il $2, 2 /* number of fixed arguments */
@@ -48,4 +47,3 @@ sprintf:
a $sp, $sp, $2
lqd $0, 16($sp) /* load caller address */
bi $0 /* return to caller */
- .size sprintf, .-sprintf
diff --git a/newlib/libc/machine/spu/spu_clock_stop.c b/newlib/libc/machine/spu/spu_clock_stop.c
deleted file mode 100644
index da31b42c6..000000000
--- a/newlib/libc/machine/spu/spu_clock_stop.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* SPU clock stop library service. */
-#include <spu_timer.h>
-#include "spu_timer_internal.h"
-
-/* Stops the SPU clock:
- * decrements clock start count
- * when count is zero, disables the decrementer event and stops the
- decrementer
- Returns 0 on success and <0 on failure:
- * SPU_CLOCK_ERR_NOT_RUNNING - clock was already off
- * SPU_CLOCK_ERR_TIMERS_ACTIVE - active timers exist
- * SPU_CLOCK_ERR_STILL_RUNNING - start count was decremented but clock was
- not stopped */
-int
-spu_clock_stop (void)
-{
- if (__spu_clock_startcnt == 0)
- return SPU_CLOCK_ERR_NOT_RUNNING;
-
- if (__spu_clock_startcnt == 1 && (__spu_timers_active || __spu_timers_handled))
- return SPU_CLOCK_ERR_TIMERS_ACTIVE;
-
- /* Don't stop clock if the clock is still in use. */
- if (--__spu_clock_startcnt != 0)
- return SPU_CLOCK_ERR_STILL_RUNNING;
-
- /* Clock stopped, stop decrementer. */
- __disable_spu_decr ();
-
- /* Clock is enabled on clock start - restore to original state (saved at start). */
- if (__likely (!__spu_clock_state_was_enabled))
- {
- spu_idisable ();
- }
-
- return 0;
-}
diff --git a/newlib/libc/machine/spu/spu_clock_svcs.c b/newlib/libc/machine/spu/spu_clock_svcs.c
deleted file mode 100644
index 6cc2af4a9..000000000
--- a/newlib/libc/machine/spu/spu_clock_svcs.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* SPU clock start and read library services. */
-#include <spu_timer.h>
-#include "spu_timer_internal.h"
-
-/* The software managed timebase value. */
-volatile uint64_t __spu_tb_val __attribute__ ((aligned (16)));
-
-/* Timeout value of the current interval. */
-volatile int __spu_tb_timeout __attribute__ ((aligned (16)));
-
-/* Clock start count (clock is running if >0). */
-volatile unsigned __spu_clock_startcnt __attribute__ ((aligned (16)));
-
-/* Saved interrupt state from clock_start. */
-volatile unsigned __spu_clock_state_was_enabled;
-
-/* Initializes the software managed timebase, enables the decrementer event,
- starts the decrementer and enables interrupts. Must be called before
- clock or timer services can be used. Should only be called by base app/lib
- code (not from an interrupt/timer handler).
- Returns with interrupts ENABLED. */
-void
-spu_clock_start (void)
-{
- /* Increment clock start and return if it was already running. */
- if (++__spu_clock_startcnt > 1)
- return;
-
- __spu_clock_state_was_enabled = spu_readch (SPU_RdMachStat) & 0x1;
-
- spu_idisable ();
- __spu_tb_timeout = CLOCK_START_VALUE;
- __spu_tb_val = 0;
-
- /* Disable, write, enable the decrementer. */
- __enable_spu_decr (__spu_tb_timeout, __disable_spu_decr ());
-
- spu_ienable ();
-
- return;
-}
-
-/* Returns a monotonically increasing, 64-bit counter, in timebase units,
- relative to the last call to spu_clock_start(). */
-uint64_t
-spu_clock_read (void)
-{
- int64_t time;
- unsigned was_enabled;
-
- /* Return 0 if clock is off. */
- if (__spu_clock_startcnt == 0)
- return 0LL;
-
- was_enabled = spu_readch (SPU_RdMachStat) & 0x1;
- spu_idisable ();
-
- time = __spu_tb_val + (__spu_tb_timeout - spu_readch (SPU_RdDec));
-
- if (__likely (was_enabled))
- spu_ienable ();
- return time;
-}
diff --git a/newlib/libc/machine/spu/spu_timebase.c b/newlib/libc/machine/spu/spu_timebase.c
deleted file mode 100644
index cb8f34d94..000000000
--- a/newlib/libc/machine/spu/spu_timebase.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-#include <spu_timer.h>
-#include <stdio.h>
-
-/* This function queries /proc/cpuinfo and returns the SPU time base in
- Hertz. */
-unsigned int
-spu_timebase (void)
-{
- FILE *f;
- unsigned tb = 0;
- char line[64];
- if ((f = fopen ("/proc/cpuinfo", "r")))
- {
- while (fgets (line, sizeof (line), f))
- if (sscanf (line, "timebase : %u", &tb))
- break;
- fclose (f);
- }
- return (tb);
-}
-
diff --git a/newlib/libc/machine/spu/spu_timer_flih.S b/newlib/libc/machine/spu/spu_timer_flih.S
deleted file mode 100644
index 63f5f074c..000000000
--- a/newlib/libc/machine/spu/spu_timer_flih.S
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* First-level interrupt handler. */
-
-/* The following two convenience macros assist in the coding of the
- saving and restoring the volatile register starting from register
- 2 up to register 79.
-
- saveregs first, last Saves registers from first to the last.
- restoreregs first, last Restores registers from last down to first.
-
- Note: first must be less than or equal to last. */
-
-.macro saveregs first, last
- stqd $\first, -(STACK_SKIP+\first)*16($SP)
-.if \last-\first
- saveregs "(\first+1)",\last
-.endif
-.endm
-
-
-.macro restoreregs first, last
- lqd $\last, (82-\last)*16($SP)
-.if \last-\first
- restoreregs \first,"(\last-1)"
-.endif
-.endm
-
- .section .interrupt,"ax"
- .align 3
- .type spu_flih, @function
-spu_flih:
- /* Adjust the stack pointer to skip the maximum register save area
- (STACK_SKIP quadword registers) in case an interrupt occurred while
- executing a leaf function that used the stack area without actually
- allocating its own stack frame. */
- .set STACK_SKIP, 125
-
- /* Save the current link register on a new stack frame for the
- normal spu_flih() version of this file. */
- stqd $0, -(STACK_SKIP+80)*16($SP)
- stqd $SP, -(STACK_SKIP+82)*16($SP) /* Save back chain pointer. */
-
- saveregs 2, 39
-
- il $2, -(STACK_SKIP+82)*16 /* Stack frame size. */
- rdch $3, $SPU_RdEventStat /* Read event status. */
-
- rdch $6, $SPU_RdEventMask /* Read event mask. */
- hbrp /* Open a slot for instruction prefetch. */
-
- saveregs 40,59
-
- clz $4, $3 /* Get first slih index. */
- stqd $6, -(STACK_SKIP+1)*16($SP) /* Save event mask on stack. */
-
- saveregs 60, 67
-
- /* Do not disable/ack the decrementer event here.
- The timer library manages this and expects it
- to be enabled upon entry to the SLIH. */
- il $7, 0x20
- andc $5, $3, $7
- andc $7, $6, $5 /* Clear event bits. */
- saveregs 68, 69
-
- wrch $SPU_WrEventAck, $3 /* Ack events(s) - include decrementer event. */
- wrch $SPU_WrEventMask, $7 /* Disable event(s) - exclude decrementer event. */
-
- saveregs 70, 79
-
- a $SP, $SP, $2 /* Instantiate flih stack frame. */
-next_event:
- /* Fetch and dispatch the event handler for the first non-zero event. The
- dispatch handler is indexed into the __spu_slih_handlers array using the
- count of zero off the event status as an index. */
- ila $5, __spu_slih_handlers /* Slih array offset. */
-
- shli $4, $4, 2 /* Slih entry offset. */
- lqx $5, $4, $5 /* Load slih address. */
- rotqby $5, $5, $4 /* Rotate to word 0. */
- bisl $0, $5 /* Branch to slih. */
-
- clz $4, $3 /* Get next slih index. */
- brnz $3, next_event
-
-
- lqd $2, 81*16($SP) /* Read event mask from stack. */
-
- restoreregs 40, 79
-
- wrch $SPU_WrEventMask, $2 /* Restore event mask. */
- hbrp /* Open a slot for instruction pre-fetch. */
-
- restoreregs 2, 39
-
- /* Restore the link register from the new stack frame for the
- normal spu_flih() version of this file. */
- lqd $0, 2*16($SP)
-
- lqd $SP, 0*16($SP) /* restore stack pointer from back chain ptr. */
-
- irete /* Return from interrupt and re-enable interrupts. */
- .size spu_flih, .-spu_flih
-/* spu_slih_handlers[]
- Here we initialize 33 default event handlers. The first entry in this array
- corresponds to the event handler for the event associated with bit 0 of
- Channel 0 (External Event Status). The 32nd entry in this array corresponds
- to bit 31 of Channel 0 (DMA Tag Status Update Event). The 33rd entry in
- this array is a special case entry to handle "phantom events" which occur
- when the channel count for Channel 0 is 1, causing an asynchronous SPU
- interrupt, but the value returned for a read of Channel 0 is 0. The index
- calculated into this array by spu_flih() for this case is 32, hence the
- 33rd entry. */
-.data
- .align 4
- .extern __spu_default_slih
- .global __spu_slih_handlers
- .type __spu_slih_handlers, @object
-__spu_slih_handlers:
- .rept 33
- .long __spu_default_slih
- .endr
- .size __spu_slih_handlers, .-__spu_slih_handlers
diff --git a/newlib/libc/machine/spu/spu_timer_free.c b/newlib/libc/machine/spu/spu_timer_free.c
deleted file mode 100644
index 9fb3e0cda..000000000
--- a/newlib/libc/machine/spu/spu_timer_free.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* SPU timer free library service. */
-#include <spu_timer.h>
-#include "spu_timer_internal.h"
-
-
-/* Frees an allocated timer. The timer must be in the stopped state for this
- to succeed. Maybe be called:
- * after allocated, before it's started
- * after it's been explicitly stopped
- Returns 0 on success, timer sucessfully deallocated. Returns <0 on failure
- * SPU_TIMER_INVALID_ID - id out of range
- * SPU_TIMER_ERR_FREE - id in free state
- * SPU_TIMER_ERR_ACTIVE - id in handled or active state */
-int
-spu_timer_free (int id)
-{
- spu_timer_t *t, **pn;
- unsigned was_enabled;
-
- if (id < 0 || id >= SPU_TIMER_NTIMERS)
- return SPU_TIMER_ERR_INVALID_ID;
-
- if (__spu_timers[id].state == SPU_TIMER_STOPPED)
- {
-
- was_enabled = spu_readch (SPU_RdMachStat) & 0x1;
- spu_idisable ();
-
- t = __spu_timers_stopped;
- pn = &__spu_timers_stopped;
-
- while (t && (t->id != id))
- {
- pn = &t->next;
- t = t->next;
- }
-#ifdef SPU_TIMER_DEBUG
- if (!t)
- ABORT ();
-#endif
- *pn = t->next;
-
- /* Add timer back to free list (mask). */
- __spu_timers_avail |= (1 << (id));
- __spu_timers[id].state = SPU_TIMER_FREE;
-
- if (__likely (was_enabled))
- spu_ienable ();
-
- return 0;
- }
-
- /* Handle invalid states. */
- return (__spu_timers[id].state == SPU_TIMER_FREE) ?
- SPU_TIMER_ERR_FREE : SPU_TIMER_ERR_ACTIVE;
-}
diff --git a/newlib/libc/machine/spu/spu_timer_internal.h b/newlib/libc/machine/spu/spu_timer_internal.h
deleted file mode 100644
index a438561b9..000000000
--- a/newlib/libc/machine/spu/spu_timer_internal.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* Internal definitions for SPU timer library. */
-#ifndef _SPU_TIMER_INTERNAL_H_
-#define _SPU_TIMER_INTERNAL_H_
-
-#include <spu_intrinsics.h>
-#include <spu_mfcio.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#ifdef SPU_TIMER_DEBUG
-#include <stdio.h>
-#include <assert.h>
-#endif
-
-/* The timer state tells which list its on. */
-typedef enum spu_timer_state
-{
- SPU_TIMER_FREE = 0,
- SPU_TIMER_ACTIVE = 1,
- SPU_TIMER_HANDLED = 2,
- SPU_TIMER_STOPPED = 3
-} spu_timer_state_t;
-
-typedef struct spu_timer
-{
- int tmout __attribute__ ((aligned (16))); /* Time until expiration (tb). */
- int intvl __attribute__ ((aligned (16))); /* Interval. */
- int id __attribute__ ((aligned (16)));
- spu_timer_state_t state __attribute__ ((aligned (16)));
- void (*func) (int) __attribute__ ((aligned (16))); /* Handler. */
- struct spu_timer *next __attribute__ ((aligned (16)));
-} spu_timer_t;
-
-
-/* Max decrementer value. */
-#define DECR_MAX 0xFFFFFFFFU
-
- /* Arbitrary non-triggering value. */
-#define CLOCK_START_VALUE 0x7FFFFFFF
-
-#define MIN_INTVL 1
-#define MAX_INTVL INT_MAX
-
-/* Timers within 15 tics will expire together. */
-#define TIMER_INTERVAL_WINDOW 15
-
-/* Disables the decrementer and returns the saved event mask for a subsequent
- call to __enable_spu_decr. The decrementer interrupt is acknowledged in the
- flih when the event is received, but is required also as part of the
- procedure to stop the decrementer. */
-static inline unsigned
-__disable_spu_decr (void)
-{
- unsigned mask = spu_readch (SPU_RdEventMask);
- spu_writech (SPU_WrEventMask, mask & ~MFC_DECREMENTER_EVENT);
- spu_writech (SPU_WrEventAck, MFC_DECREMENTER_EVENT);
- spu_sync_c ();
- return mask;
-}
-
-/* Writes and enables the decrementer, along with the given event mask. */
-static inline void
-__enable_spu_decr (int val, unsigned mask)
-{
- spu_writech (SPU_WrDec, (val));
- spu_writech (SPU_WrEventMask, mask | MFC_DECREMENTER_EVENT);
- spu_sync_c ();
-}
-
-/* These are shared between modules but are not inlined, to save space. */
-extern void __spu_timer_start (int id, int reset);
-extern void __reset_spu_decr (int val);
-
-/* The timers. */
-extern spu_timer_t __spu_timers[];
-
-/* Active timer list. */
-extern spu_timer_t *__spu_timers_active;
-
-/* Stopped (allocated) timer list. */
-extern spu_timer_t *__spu_timers_stopped;
-
-/* List of timers being handled. */
-extern spu_timer_t *__spu_timers_handled;
-
-/* Bitmask of available timers. */
-extern unsigned __spu_timers_avail;
-
-/* The software managed timebase value. */
-extern volatile uint64_t __spu_tb_val;
-
-/* Timeout value of the current interval. */
-extern volatile int __spu_tb_timeout;
-
-/* Clock start count (clock is running if >0). */
-extern volatile unsigned __spu_clock_startcnt;
-
-/* Saved interrupt state from clock_start. */
-extern volatile unsigned __spu_clock_state_was_enabled;
-
-#define __likely(_c) __builtin_expect((_c), 1)
-#define __unlikely(_c) __builtin_expect((_c), 0)
-
-#define ABORT() \
-{\
- fprintf(stderr, "Internal error, aborting: %s:%d\n", __FILE__, __LINE__);\
- assert(0);\
-}
-
-#endif
diff --git a/newlib/libc/machine/spu/spu_timer_slih.c b/newlib/libc/machine/spu/spu_timer_slih.c
deleted file mode 100644
index 93cfa5ea2..000000000
--- a/newlib/libc/machine/spu/spu_timer_slih.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* Second Level Interrupt handler and related services for SPU timers. */
-#include "spu_timer_internal.h"
-/* Resets decrementer to the specified value. Also updates software timebase
- to account for the time between the last decrementer reset and now. There
- are two cases:
- * Called by application to start a new timer.
- * Called by spu_clock to active the next timer.
- In both cases, the amount of time is the current interval timeout minus the
- current decrementer value. */
-void
-__reset_spu_decr (int val)
-{
-
- /* The interrupt occurs when the msb goes from 0 to 1 or when the decrementer
- goes from 0 to -1. To be precisely accurate we should set the timer to
- the intverval -1, unless the interval passed in is 0 in which case it
- should be left at 0. */
- int enable_val = (__likely (val)) ? val - 1 : 0;
-
- /* Decrementer must be stopped before writing it - minimize the time
- stopped. */
- unsigned mask = __disable_spu_decr ();
-
- /* Perform tb correction before resettting the decrementer. the corrected
- value is the current timeout value minus the current decrementer value.
- Occasionally the read returns 0 - a second read will clear this
- condition. */
- int decval0 = spu_readch (SPU_RdDec);
- int decval = spu_readch (SPU_RdDec);
- /* Restart decrementer with next timeout val. */
- __enable_spu_decr (enable_val, mask);
-
- /* Update the timebase values before enabling for interrupts. */
- __spu_tb_val += __spu_tb_timeout - decval;
- __spu_tb_timeout = enable_val;
-}
-
-/* Update software timebase and timeout value for the 'next to expire' timer.
- Called when starting a new timer so the timer list will have timeouts
- relative to the current time. */
-static inline void
-__update_spu_tb_val (void)
-{
- int elapsed = __spu_tb_timeout - spu_readch (SPU_RdDec);
-#ifdef SPU_TIMER_DEBUG
- if (elapsed < 0)
- ABORT ();
-#endif
- __spu_tb_val += elapsed;
-
- /* Adjust the timeout for the timer next to expire. Note this could cause
- the timeout to go negative, if it was just about to expire when we called
- spu_timer_start. This is OK, since this can happen any time interrupts
- are disabled. We just schedule an immediate timeout in this case. */
- if (__spu_timers_active)
- {
- __spu_timers_active->tmout -= elapsed;
- if (__spu_timers_active->tmout < 0)
- __spu_timers_active->tmout = 0;
- }
-}
-
-/* Add an allocated timer to the active list. The active list is sorted by
- timeout value. The timer at the head of the list is the timer that will
- expire next. The rest of the timers have a timeout value that is relative
- to the timer ahead of it on the list. This relative value is determined
- here, when the timer is added to the active list. When its position in the
- list is found, the timer's timeout value is set to its interval minus the
- sum of all the timeout values ahead of it. The timeout value for the timer
- following the newly added timer is then adjusted to a new relative value. If
- the newly added timer is at the head of the list, the decrementer is reset.
- This function is called by SLIH to restart multiple timers (reset == 0) or
- by spu_timer_start() to start a single timer (reset == 1). */
-void
-__spu_timer_start (int id, int reset)
-{
- spu_timer_t *t;
- spu_timer_t **pn;
- spu_timer_t *start = &__spu_timers[id];
- unsigned tmout_time = 0;
- unsigned my_intvl = start->intvl;
- unsigned was_enabled = spu_readch (SPU_RdMachStat) & 0x1;
-
- spu_idisable ();
-
- t = __spu_timers_active;
- pn = &__spu_timers_active;
-
- /* If the active list is empty, just add the timer with the timeout set to
- the interval. Otherwise find the place in the list for the timer, setting
- its timeout to its interval minus the sum of timeouts ahead of it. */
- start->state = SPU_TIMER_ACTIVE;
- if (__likely (!t))
- {
- __spu_timers_active = start;
- start->next = NULL;
- start->tmout = my_intvl;
- }
- else
- {
-
- /* Update swtb and timeout val of the next timer, so all times are
- relative to now. */
- if (reset)
- __update_spu_tb_val ();
-
- while (t && (my_intvl >= (tmout_time + t->tmout)))
- {
- tmout_time += t->tmout;
- pn = &t->next;;
- t = t->next;
- }
- start->next = t;
- start->tmout = my_intvl - tmout_time;
- *pn = start;
-
- /* Adjust timeout for timer after us. */
- if (t)
- t->tmout -= start->tmout;
- }
-
- if (reset && (__spu_timers_active == start))
- __reset_spu_decr (__spu_timers_active->tmout);
-
- if (__unlikely (was_enabled))
- spu_ienable ();
-}
-
-/* SLIH for decrementer. Manages software timebase and timers.
- Called by SPU FLIH. Assumes decrementer is still running
- (event not yet acknowledeged). */
-unsigned int
-spu_clock_slih (unsigned status)
-{
- int decr_reset_val;
- spu_timer_t *active, *handled;
- unsigned was_enabled = spu_readch (SPU_RdMachStat) & 0x1;
-
- status &= ~MFC_DECREMENTER_EVENT;
-
- spu_idisable ();
-
- /* The decrementer has now expired. The decrementer event was acknowledged
- in the FLIH but not disabled. The decrementer will continue to run while
- we're running the clock/timer handler. The software clock keeps running,
- and accounts for all the time spent running handlers. Add the current
- timeout to the software timebase and set the timeout to DECR_MAX. This
- allows the "clock read" code to continue to work while we're in here, and
- gives us the most possible time to finish before another underflow. */
- __spu_tb_val += __spu_tb_timeout;
- __spu_tb_timeout = DECR_MAX;
-
- /* For all timers that have the current timeout value, move them from the
- active list to the handled list and call their handlers. Note that the
- handled/stopped lists may be manipulated by the handlers if they wish to
- stop/free the timers. Note that only the first expired timer will reflect
- the real timeout value; the rest of the timers that had the same timeout
- value will have a relative value of zero. */
- if (__spu_timers_active)
- {
- __spu_timers_active->tmout = 0;
- while ((active = __spu_timers_active)
- && (active->tmout <= TIMER_INTERVAL_WINDOW))
- {
- __spu_timers_active = active->next;
- active->next = __spu_timers_handled;
- __spu_timers_handled = active;
- active->state = SPU_TIMER_HANDLED;
- (*active->func) (active->id);
- }
- }
-
- /* put the handled timers back on the list and restart decrementer. */
- while ((handled = __spu_timers_handled) != NULL)
- {
- __spu_timers_handled = handled->next;
- __spu_timer_start (handled->id, 0);
- }
-
- /* Reset the decrementer before returning. If we have any active timers, we
- set it to the timeout value for the timer at the head of the list, else
- the default clock value. */
- decr_reset_val = __spu_timers_active ? __spu_timers_active->tmout : CLOCK_START_VALUE;
-
- __reset_spu_decr (decr_reset_val);
-
- if (__likely (was_enabled))
- spu_ienable ();
-
- return status;
-}
diff --git a/newlib/libc/machine/spu/spu_timer_slih_reg.c b/newlib/libc/machine/spu/spu_timer_slih_reg.c
deleted file mode 100644
index cd1e86fbb..000000000
--- a/newlib/libc/machine/spu/spu_timer_slih_reg.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-
-/* Services for SLIH registration. */
-#include <spu_intrinsics.h>
-#include <spu_timer.h>
-
-#define SPU_EVENT_ID(_mask) \
- (spu_extract(spu_cntlz(spu_promote(_mask, 0)), 0))
-typedef unsigned (*spu_slih_t) (unsigned);
-
-extern spu_slih_t __spu_slih_handlers[];
-
-/* This function is called whenever an event occurs for which no second level
- event handler was registered. The default event handler does nothing and
- zeros the most significant event bit indicating that the event was processed
- (when in reality, it was discarded). */
-unsigned
-__spu_default_slih (unsigned events)
-{
- unsigned int mse;
-
- mse = 0x80000000 >> SPU_EVENT_ID (events);
- events &= ~mse;
-
- return (events);
-}
-
-/* Registers a SPU second level interrupt handler for the events specified by
- mask. The event mask consists of a set of bits corresponding to the event
- status bits (see channel 0 description). A mask containing multiple 1 bits
- will set the second level event handler for each of the events. */
-void
-spu_slih_register (unsigned mask, spu_slih_t func)
-{
- unsigned int id;
-
- while (mask)
- {
- id = SPU_EVENT_ID (mask);
- __spu_slih_handlers[id] = (func) ? func : __spu_default_slih;
- mask &= ~(0x80000000 >> id);
- }
-}
diff --git a/newlib/libc/machine/spu/spu_timer_stop.c b/newlib/libc/machine/spu/spu_timer_stop.c
deleted file mode 100644
index 94286c914..000000000
--- a/newlib/libc/machine/spu/spu_timer_stop.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* SPU timer stop library service. */
-#include <spu_timer.h>
-#include "spu_timer_internal.h"
-
-/* Stop a timer. Moves it from either the active or handled list to the
- stopped list. Returns 0 on sucess, timer was successfully stopped.
- Returns <0 - Failure:
- * SPU_TIMER_ERR_NOT_ACTIVE - timer was not active
- * SPU_TIMER_ERR_INVALID_ID - invalid timer id
- * SPU_TIMER_ERR_NOCLOCK - spu clock is not running */
-int
-spu_timer_stop (int id)
-{
- spu_timer_t *t, **pn;
- unsigned was_enabled;
-
- if (id < 0 || id >= SPU_TIMER_NTIMERS)
- return SPU_TIMER_ERR_INVALID_ID;
-
- if (__spu_clock_startcnt == 0)
- return SPU_TIMER_ERR_NOCLOCK;
-
-
- /* Free or stopped states. */
- if (__spu_timers[id].state == SPU_TIMER_ACTIVE ||
- __spu_timers[id].state == SPU_TIMER_HANDLED)
- {
- was_enabled = spu_readch (SPU_RdMachStat) & 0x1;
- spu_idisable ();
-
- /* Timer is on either active list or handled list. */
- t = (__spu_timers[id].state == SPU_TIMER_ACTIVE)
- ? __spu_timers_active : __spu_timers_handled;
-
- pn = (__spu_timers[id].state == SPU_TIMER_ACTIVE)
- ? &__spu_timers_active : &__spu_timers_handled;
-
- while (t && t->id != id)
- {
- pn = &t->next;
- t = t->next;
- }
-#ifdef SPU_TIMER_DEBUG
- if (!t)
- ABORT (); /* Internal error. */
-#endif
- /* Fix timeout of next timer and decrementer if we were at the head of
- the active list. */
- if (t->next)
- {
- t->next->tmout += t->tmout;
- if (__spu_timers_active == t)
- __reset_spu_decr (t->next->tmout);
- }
- else
- __reset_spu_decr (CLOCK_START_VALUE);
-
- *pn = t->next; /* Update this elements to pointer. */
- t->next = __spu_timers_stopped;
- __spu_timers_stopped = t;
-
- __spu_timers[id].state = SPU_TIMER_STOPPED;
-
- if (__likely (was_enabled))
- spu_ienable ();
-
- return 0;
- }
-
- return SPU_TIMER_ERR_NOT_ACTIVE;
-}
diff --git a/newlib/libc/machine/spu/spu_timer_svcs.c b/newlib/libc/machine/spu/spu_timer_svcs.c
deleted file mode 100644
index 8e7013ccd..000000000
--- a/newlib/libc/machine/spu/spu_timer_svcs.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-
-/* SPU timer start and alloc library services. */
-#include <spu_timer.h>
-#include "spu_timer_internal.h"
-
-/* The timers. */
-spu_timer_t __spu_timers[SPU_TIMER_NTIMERS] __attribute__ ((aligned (16)));
-
-/* Active timer list. */
-spu_timer_t *__spu_timers_active;
-
-/* Stopped (allocated) timer list. */
-spu_timer_t *__spu_timers_stopped;
-
-/* List of timers being handled. */
-spu_timer_t *__spu_timers_handled;
-
-/* Bitmask of available timers. */
-unsigned __spu_timers_avail =
- ((1 << (SPU_TIMER_NTIMERS - 1)) + ((1 << (SPU_TIMER_NTIMERS - 1)) - 1));
-
-/* Allocates an SPU interval timer and returns the timer ID. Must be called
- before starting a timer. interval specifies the expiration interval in
- timebase units. func specifies the function pointer to expiration handler.
- Returns the timer ID on success or <0 on Failure:
- * SPU_TIMER_ERR_NONE_FREE - no free timers to allocate
- * SPU_TIMER_ERR_INVALID_PARM - invalid parm */
-int
-spu_timer_alloc (int interval, void (*func) (int))
-{
- unsigned was_enabled;
- int id;
- if (interval < MIN_INTVL || interval > MAX_INTVL || func == NULL)
- return SPU_TIMER_ERR_INVALID_PARM;
-
- was_enabled = spu_readch (SPU_RdMachStat) & 0x1;
-
- /* Get id of next available timer. */
- id = spu_extract ((spu_sub ((unsigned) 31,
- spu_cntlz (spu_promote
- (__spu_timers_avail, 0)))), 0);
-
- /* No timers avail. */
- if (id == -1)
- return SPU_TIMER_ERR_NONE_FREE;
-
- /* Higher order bits represent lower timer ids. */
- __spu_timers_avail &= ~(1 << (id));
- id = (SPU_TIMER_NTIMERS - 1) - id;
-
- /* Initialize timer and put it on stopped list. */
- (__spu_timers + id)->func = func;
- (__spu_timers + id)->intvl = interval;
- (__spu_timers + id)->id = id;
- (__spu_timers + id)->state = SPU_TIMER_STOPPED;
-
- spu_idisable ();
- (__spu_timers + id)->next = __spu_timers_stopped;
- __spu_timers_stopped = &__spu_timers[id];
-
- if (__likely (was_enabled))
- spu_ienable ();
- return id;
-}
-
-/* External interface for starting a timer. See description of
- __spu_timer_start(). Returns 0 on success and <0 on failure:
- * SPU_TIMER_ERR_INVALID_ID - invalid id
- * SPU_TIMER_ERR_NOCLOCK - clock is off
- * SPU_TIMER_ERR_NOT_STOPPED - timer not in stopped state */
-int
-spu_timer_start (int id)
-{
- if (id < 0 || id >= SPU_TIMER_NTIMERS)
- return SPU_TIMER_ERR_INVALID_ID;
-
- if (__spu_clock_startcnt == 0)
- return SPU_TIMER_ERR_NOCLOCK;
-
- if (__spu_timers[id].state != SPU_TIMER_STOPPED)
- return SPU_TIMER_ERR_NOT_STOPPED;
-
- __spu_timer_start (id, 1);
-
- return 0;
-}
diff --git a/newlib/libc/machine/spu/sscanf.S b/newlib/libc/machine/spu/sscanf.S
index a3dbb0193..980955aaf 100644
--- a/newlib/libc/machine/spu/sscanf.S
+++ b/newlib/libc/machine/spu/sscanf.S
@@ -33,7 +33,6 @@
.text
.align 4
GLOBL sscanf
- .type sscanf, @function
sscanf:
stqd $0, 16($sp) /* save caller address */
il $2, 2 /* number of fixed arguments */
@@ -48,4 +47,3 @@ sscanf:
a $sp, $sp, $2
lqd $0, 16($sp) /* load caller address */
bi $0 /* return to caller */
- .size sscanf, .-sscanf
diff --git a/newlib/libc/machine/spu/stack_reg_va.S b/newlib/libc/machine/spu/stack_reg_va.S
index 754e4e6a7..5a0b632e8 100644
--- a/newlib/libc/machine/spu/stack_reg_va.S
+++ b/newlib/libc/machine/spu/stack_reg_va.S
@@ -85,7 +85,6 @@
.text
.global __stack_reg_va
- .type __stack_reg_va, @function
__stack_reg_va:
@@ -165,6 +164,3 @@ save_regs_2:
ai ptr, ptr, -16
brz tmp, save_regs_1 /* if (tmp == 0) jump */
bi link /* finish to make va_list */
-
- .size __stack_reg_va, .-__stack_reg_va
-
diff --git a/newlib/libc/machine/spu/straddr.h b/newlib/libc/machine/spu/straddr.h
deleted file mode 100644
index 3de594df6..000000000
--- a/newlib/libc/machine/spu/straddr.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- (C) Copyright 2008
- International Business Machines Corporation,
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * 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.
- * Neither the names of the copyright holders nor the names of their
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
- 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.
-*/
-
-#include <spu_intrinsics.h>
-#include "vec_literal.h"
-
-/*
- * Supply the inline _straddr for use by strncpy and strncat.
-*
-* _straddr: search the string s, and return the address of the first byte
-* containing zero.
-*/
-static inline char *_straddr(const char *s)
-{
- unsigned int cnt, cmp, skip, mask;
- vec_uchar16 *ptr, data;
-
- /*
- * Compensate for unaligned strings.
- */
- ptr = (vec_uchar16 *)s; /* implicit (s & ~0xf) */
- skip = (unsigned int)(ptr) & 0xf;
- /*
- * skip the first skip bytes starting at (s & ~0xf).
- */
- mask = 0xFFFF >> skip;
-
- data = *ptr;
- cmp = spu_extract(spu_gather(spu_cmpeq(data, 0)), 0);
- cmp &= mask;
-
- cnt = spu_extract(spu_cntlz(spu_promote(cmp, 0)), 0);
-
- while (cnt == 32) {
- data = *++ptr;
- cnt = spu_extract(spu_cntlz(spu_gather(spu_cmpeq(data, 0))), 0);
- /*
- * The first 16 bits for gather on a byte vector are zero, so if cnt
- * is 32, none of the 16 bytes in data was zero. And, there are (cnt -
- * 16) non-zero bytes in data.
- */
- }
- /*
- * The first non-zero byte is at ptr aligned down plus the number of
- * non-zero bytes seen.
- */
- return ((char*) (((int) ptr & ~0xf) + (cnt - 16)));
-}
diff --git a/newlib/libc/machine/spu/strcat.c b/newlib/libc/machine/spu/strcat.c
index 9a5185c1b..902049e6c 100644
--- a/newlib/libc/machine/spu/strcat.c
+++ b/newlib/libc/machine/spu/strcat.c
@@ -1,6 +1,9 @@
/*
- (C) Copyright 2008
+ (C) Copyright 2001,2006,
International Business Machines Corporation,
+ Sony Computer Entertainment, Incorporated,
+ Toshiba Corporation,
+
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -27,20 +30,26 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-
+#include <spu_intrinsics.h>
#include <stddef.h>
#include <string.h>
-#include "straddr.h"
-#include "strcpy.h"
-/*
- * Appends the string pointed to by src (up to and including the /0
- * character) to the array pointed to by dest overwriting the
+/* Appends the string pointed to by src (up to and including the /0
+ * character) to the array pointed to by dest (overwriting the
* /0 character at the end of dest. The strings may not overlap and
* the dest string must have enough space for the result.
*/
+
char *strcat(char * __restrict__ dest, const char * __restrict__ src)
{
- _strncpy(_straddr(dest), src, 0, 0, 0);
- return dest;
+ size_t d_len, s_len;
+
+ /* Determine the length of the src and dest input arrays.
+ */
+ d_len = strlen(dest);
+ s_len = strlen(src);
+
+ (void)memcpy((void *)(dest+d_len), (const void *)src, s_len + 1);
+
+ return ((char *)dest);
}
diff --git a/newlib/libc/machine/spu/strcpy.c b/newlib/libc/machine/spu/strcpy.c
index 69045bae8..4d71cf483 100644
--- a/newlib/libc/machine/spu/strcpy.c
+++ b/newlib/libc/machine/spu/strcpy.c
@@ -1,6 +1,9 @@
/*
- (C) Copyright 2008
+ (C) Copyright 2001,2006,
International Business Machines Corporation,
+ Sony Computer Entertainment, Incorporated,
+ Toshiba Corporation,
+
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -27,15 +30,19 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <spu_intrinsics.h>
#include <stddef.h>
-#include "strcpy.h"
-/*
- * Copy the string pointed to by src (up to and including the /0
+/* Copy the string pointed to by src (up to and including the /0
* character) into the array pointed to by dest. If copy between
* two arrays that overlap, then behavior is undefined.
*/
+
char * strcpy(char * __restrict__ dest, const char * __restrict__ src)
{
- return _strncpy(dest, src, 0, 0, 0);
+ /* Due to the need to support all alignment variances, this
+ * function can not easily be optimized. As a result, it is
+ * serviced using strlen and memcpy.
+ */
+ return ((char *)memcpy((void *)dest, (const void *)src, strlen(src)+1));
}
diff --git a/newlib/libc/machine/spu/strcpy.h b/newlib/libc/machine/spu/strcpy.h
deleted file mode 100644
index b407eaf5b..000000000
--- a/newlib/libc/machine/spu/strcpy.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- (C) Copyright 2008
- International Business Machines Corporation,
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * 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.
- * Neither the names of the copyright holders nor the names of their
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER
- 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.
-*/
-
-#include <spu_intrinsics.h>
-#include "vec_literal.h"
-
-/*
- * Supply an inline _strncpy for strcpy/cat and strncpy/cat. Relies on
- * checklen and lastzero code being optimized out when they are constant
- * zero values.
- */
-static inline void * _strncpy(char * __restrict__ dest, const char *
- __restrict__ src, size_t maxlen, int
- checklen, int lastzero)
-{
- int adjust, offset, soffset, doffset, shift;
- vec_uchar16 *vsrc, *vdest;
- vec_uchar16 sdata1, sdata2, sdata, shuffle;
- vec_uchar16 mask1, maskzero, cmp0;
- vec_uint4 nonzeroes, gathered_cmp, vtmp, vtmp2;
- vec_uint4 curlen; /* assumes size_t is 4 bytes */
- const vec_uint4 val31 = { 31, 31, 31, 31 };
- const vec_uint4 val_0123 = { 0x00010203, 0x04050607, 0x08090A0B, 0x0C0D0E0F };
- const vec_uchar16 all_ones = { 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,
- 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff };
-
- vsrc = (vec_uchar16 *) src;
- vdest = (vec_uchar16 *) dest;
- soffset = (int) src & 15;
- doffset = (int) dest & 15;
-
- if (checklen) {
- /*
- * Set curlen so it is the number of bytes we would copy if starting
- * from vdest & ~0xf.
- *
- * curlen could probably be replaced by comparing vdest plus some
- * offset to dest + maxlen, that would help mainly in the while loop
- * but would lose only one instruction (the curlen -= 16).
- */
- curlen = spu_splats((unsigned int) (maxlen + doffset));
- }
-
- /*
- * Setup a shuffle pattern to align the source string with the
- * alignment of the destination string.
- */
- vtmp = spu_cmpgt(spu_promote(doffset, 0), spu_promote(soffset, 0));
- adjust = spu_extract(vtmp, 0);
- offset = soffset - doffset;
- offset += adjust & 16;
- shuffle = spu_splats((unsigned char) offset);
- shuffle = (vec_uchar16) spu_add((vec_uint4) shuffle, val_0123);
-
- vsrc += adjust;
- sdata1 = *vsrc++;
- sdata2 = *vsrc++;
- sdata = spu_shuffle(sdata1, sdata2, shuffle);
-
- /*
- * mask out leading bytes
- */
- mask1 = spu_rlmaskqwbyte(all_ones, -doffset);
-
- cmp0 = spu_and(mask1, spu_cmpeq(sdata, 0));
- nonzeroes = spu_cntlz(spu_gather(cmp0));
- /*
- * First element of nonzeroes - 15 is the number of leading non-zero
- * bytes plus 1 for the zero byte.
- */
- if (checklen) {
- vtmp = spu_add(curlen, 15);
- vtmp2 = spu_cmpgt(nonzeroes, vtmp);
- nonzeroes = spu_sel(nonzeroes, vtmp, vtmp2);
- }
-
- vtmp = spu_cmpgt(nonzeroes, val31);
- /*
- * Note: using immediate (constant 31) vs a vector value (val31) does
- * not give different results, and we have to have a vector val31 for
- * the spu_sel below, so use val31 everywhere.
- */
- vtmp = spu_sel(nonzeroes, val31, vtmp);
- /*
- * So vtmp is now min(nonzeroes, 31), the number of bytes + 16 that we
- * want to copy from the first 16 bytes of the source.
- */
- if (checklen) {
- curlen = spu_sub(vtmp, curlen);
- curlen = spu_sub(15, curlen);
- }
-
- /*
- * We want a right shift 0xff with fill by ones of (vtmp - 15) bytes, but
- * that doesn't exist so use spu_slqwbyte and vtmp all ones left by
- * (31 - vtmp). Note: this can also use spu_rlqwbytebc with spu_rlqw.
- */
- shift = spu_extract(spu_sub(val31, vtmp), 0);
- maskzero = spu_slqwbyte(all_ones, shift);
- maskzero = spu_and(mask1, maskzero);
- *vdest = spu_sel(*vdest, sdata, maskzero);
-
- vtmp = spu_cmpgt(nonzeroes, val31);
- if (checklen) {
- vtmp2 = spu_cmpgt(curlen, 0);
- vtmp = spu_and(vtmp, vtmp2);
- }
- if (spu_extract(vtmp, 0)) {
- sdata1 = sdata2;
- sdata2 = *vsrc++;
- sdata = spu_shuffle(sdata1, sdata2, shuffle);
- cmp0 = spu_cmpeq(sdata, 0);
- gathered_cmp = spu_gather(cmp0);
- /*
- * Copy 16 bytes at a time.
- */
- while ((spu_extract(gathered_cmp, 0) == 0) &&
- (!checklen || (spu_extract(curlen, 0) > 15))) {
- if (checklen)
- curlen = spu_add(curlen, -16);
- *++vdest = sdata;
- sdata1 = sdata2;
- sdata2 = *vsrc++;
- sdata = spu_shuffle(sdata1, sdata2, shuffle);
- cmp0 = spu_cmpeq(sdata, 0);
- gathered_cmp = spu_gather(cmp0);
- }
- /*
- * Copy 0 to 15 trailing bytes, either up to the smaller of curlen or
- * the number of non-zero bytes.
- */
- nonzeroes = spu_cntlz(gathered_cmp);
- if (checklen) {
- vtmp = spu_add(curlen, 15);
- vtmp2 = spu_cmpgt(nonzeroes, vtmp);
- nonzeroes = spu_sel(nonzeroes, vtmp, vtmp2);
- curlen = spu_sub(nonzeroes, curlen);
- curlen = spu_sub(15, curlen);
- }
- shift = spu_extract(spu_sub(val31, nonzeroes), 0);
- maskzero = spu_slqwbyte(all_ones, shift);
- ++vdest;
- *vdest = spu_sel(*vdest, sdata, maskzero);
- }
-
- if (checklen && lastzero) {
- /*
- * For strncat.
- */
- dest[maxlen - spu_extract(curlen, 0)] = '\0';
- }
-
- /* Pad null bytes if the length of the "src" is less than "n" (strncpy). */
- if (checklen && !lastzero && spu_extract(curlen, 0))
- memset(dest + maxlen - spu_extract(curlen, 0), 0, spu_extract(curlen, 0));
- return (dest);
-}
diff --git a/newlib/libc/machine/spu/strlen.c b/newlib/libc/machine/spu/strlen.c
index a8403e045..8a7ae07ab 100644
--- a/newlib/libc/machine/spu/strlen.c
+++ b/newlib/libc/machine/spu/strlen.c
@@ -33,36 +33,34 @@
#include <spu_intrinsics.h>
#include <stddef.h>
-/*
- * Calculates the length of the string s, not including the terminating
+/* Calculates the length of the string s, not including the terminating
* \0 character.
*/
size_t strlen(const char *s)
{
+ size_t len;
unsigned int cnt, cmp, skip, mask;
vec_uchar16 *ptr, data;
- /*
- * Compensate for initial mis-aligned string.
+ /* Compensate for initial mis-aligned string.
*/
- ptr = (vec_uchar16 *)s; /* implicit 16 byte alignment when dereferenced */
+ ptr = (vec_uchar16 *)s;
skip = (unsigned int)(ptr) & 15;
mask = 0xFFFF >> skip;
- data = *ptr;
+ data = *ptr++;
cmp = spu_extract(spu_gather(spu_cmpeq(data, 0)), 0);
cmp &= mask;
cnt = spu_extract(spu_cntlz(spu_promote(cmp, 0)), 0);
+ len = cnt - (skip + 16);
while (cnt == 32) {
- data = *++ptr;
+ data = *ptr++;
+ len -= 16;
cnt = spu_extract(spu_cntlz(spu_gather(spu_cmpeq(data, 0))), 0);
+ len += cnt;
}
- /*
- * The length is ptr aligned down to a 16 byte boundary, plus the offset
- * to the zero byte, minus the starting address s.
- */
- return ((((int) ptr & ~0xf) + (cnt - 16)) - (int) s);
+ return (len);
}
diff --git a/newlib/libc/machine/spu/strncat.c b/newlib/libc/machine/spu/strncat.c
index 3eeea7a77..4348a06ee 100644
--- a/newlib/libc/machine/spu/strncat.c
+++ b/newlib/libc/machine/spu/strncat.c
@@ -1,6 +1,9 @@
/*
- (C) Copyright 2008
+ (C) Copyright 2001,2006,
International Business Machines Corporation,
+ Sony Computer Entertainment, Incorporated,
+ Toshiba Corporation,
+
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -27,20 +30,68 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <spu_intrinsics.h>
#include <stddef.h>
#include <string.h>
-#include "straddr.h"
-#include "strcpy.h"
-/*
- * Appends the string pointed to by src (up to and including the /0
+/* Appends the string pointed to by src (up to and including the /0
* character) to the array pointed to by dest (overwriting the
* /0 character at the end of dest. The strings may not overlap and
* the dest string must have enough space for the result.
*/
-char * strncat(char * __restrict__ dest, const char * __restrict__ src,
- size_t n)
+
+char * strncat(char * __restrict__ dest, const char * __restrict__ src, size_t n)
{
- _strncpy(_straddr(dest), src, n, 1, 1);
- return dest;
+ unsigned int cmp, skip, mask, len;
+ vec_uchar16 *ptr, data;
+ vec_uint4 cnt, gt, N;
+ char *dst;
+
+ /* Determine the starting location to begin concatenation.
+ */
+ dst = dest + strlen(dest);
+
+ /* Copy the src image until either the src string terminates
+ * or n characters are copied.
+ */
+ N = spu_promote((unsigned int)n, 0);
+
+ /* Determine the string length, not including termination character,
+ * clamped to n characters.
+ */
+ ptr = (vec_uchar16 *)src;
+ skip = (unsigned int)(ptr) & 15;
+ mask = 0xFFFF >> skip;
+
+ data = *ptr++;
+ cmp = spu_extract(spu_gather(spu_cmpeq(data, 0)), 0);
+ cmp &= mask;
+
+ cnt = spu_cntlz(spu_promote(cmp, 0));
+ len = spu_extract(cnt, 0) - (skip + 16);
+
+ gt = spu_cmpgt(spu_promote(len, 0), N);
+
+ while (spu_extract(spu_andc(spu_cmpeq(cnt, 32), gt), 0)) {
+ data = *ptr++;
+ len -= 16;
+ cnt = spu_cntlz(spu_gather(spu_cmpeq(data, 0)));
+ len += spu_extract(cnt, 0);
+
+ gt = spu_cmpgt(spu_promote(len, 0), N);
+ }
+
+ /* len = MIN(len, n)
+ */
+ len = spu_extract(spu_sel(spu_promote(len, 0), N, gt), 0);
+
+ /* Perform a memcpy of the resulting length
+ */
+ (void)memcpy((void *)dst, (const void *)src, len);
+
+ /* Terminate the resulting concetenated string.
+ */
+ dst[len] = '\0';
+
+ return (dest);
}
diff --git a/newlib/libc/machine/spu/strncmp.c b/newlib/libc/machine/spu/strncmp.c
index d96504ca6..54d1fb9f4 100644
--- a/newlib/libc/machine/spu/strncmp.c
+++ b/newlib/libc/machine/spu/strncmp.c
@@ -30,17 +30,102 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stddef.h>
#include <spu_intrinsics.h>
-#include "strncmp.h"
+#include <stddef.h>
+#include "vec_literal.h"
-/*
- * Compare the two strings s1 and s2 of length n. Returns an integer less
- * than, equal to, or greater than zero if s1 is found, respectively,
+/* Compare the two strings s1 and s2 of length n. Returns an integer
+ * less than, equal to, or greater than zero if s1 is found, respectively,
* to be less than, to match, or be greater than s2.
*/
+
int strncmp(const char *s1, const char *s2, size_t n)
{
- vec_uint4 end_v;
- return _strncmp_internal (s1, s2, n, &end_v, 1);
+ unsigned int offset1, offset2;
+ vec_int4 n_v;
+ vec_uint4 cnt1_v, cnt2_v, max_cnt_v;
+ vec_uint4 gt_v, lt_v, mask_v, end1_v, end2_v, end_v, neq_v;
+ vec_uint4 shift_n_v, shift_eos_v, max_shift_v;
+ vec_uchar16 shuffle1, shuffle2;
+ vec_uchar16 data1A, data1B, data1, data2A, data2B, data2;
+ vec_uchar16 *ptr1, *ptr2;
+
+ data1 = data2 = spu_splats((unsigned char)0);
+
+ ptr1 = (vec_uchar16 *)s1;
+ ptr2 = (vec_uchar16 *)s2;
+
+ offset1 = (unsigned int)(ptr1) & 15;
+ offset2 = (unsigned int)(ptr2) & 15;
+
+ shuffle1 = (vec_uchar16)spu_add((vec_uint4)spu_splats((unsigned char)offset1),
+ VEC_LITERAL(vec_uint4, 0x00010203, 0x04050607, 0x08090A0B, 0x0C0D0E0F));
+ shuffle2 = (vec_uchar16)spu_add((vec_uint4)spu_splats((unsigned char)offset2),
+ VEC_LITERAL(vec_uint4, 0x00010203, 0x04050607, 0x08090A0B, 0x0C0D0E0F));
+ data1A = *ptr1++;
+ data2A = *ptr2++;
+
+ n_v = spu_promote((int)n, 0);
+
+ do {
+ data1B = *ptr1++;
+ data2B = *ptr2++;
+
+ /* Quadword align each of the input strings so that
+ * we operate on full quadwords.
+ */
+ data1 = spu_shuffle(data1A, data1B, shuffle1);
+ data2 = spu_shuffle(data2A, data2B, shuffle2);
+
+ data1A = data1B;
+ data2A = data2B;
+
+ neq_v = spu_gather(spu_xor(spu_cmpeq(data1, data2), -1));
+
+ end1_v = spu_gather(spu_cmpeq(data1, 0));
+ end2_v = spu_gather(spu_cmpeq(data2, 0));
+ end_v = spu_or(end1_v, end2_v), 0;
+
+ n_v = spu_add(n_v, -16);
+
+ /* Repeat until either
+ * 1) the character count expired,
+ * 2) a null character is discovered in one of the input strings, or
+ * 3) the strings do not compare equal.
+ */
+ } while (spu_extract(spu_and(spu_cmpeq(spu_or(end_v, neq_v), 0), spu_cmpgt(n_v, 0)), 0));
+
+ /* Construct a mask to eliminate characters that are not of interest
+ * in the comparison. Theses include characters that are beyond the
+ * n character count and beyond the first null character.
+ */
+ cnt1_v = spu_cntlz(end1_v);
+ cnt2_v = spu_cntlz(end2_v);
+
+ max_cnt_v = spu_sel(cnt1_v, cnt2_v, spu_cmpgt(cnt2_v, cnt1_v));
+
+ mask_v = spu_splats((unsigned int)0xFFFF);
+
+ shift_n_v = spu_andc((__vector unsigned int)spu_sub(0, n_v), spu_cmpgt(n_v, -1));
+ shift_eos_v = spu_sub(32, max_cnt_v);
+
+ max_shift_v = spu_sel(shift_n_v, shift_eos_v, spu_cmpgt(shift_eos_v, shift_n_v));
+
+ mask_v = spu_and(spu_sl(mask_v, spu_extract(max_shift_v, 0)), mask_v);
+
+ /* Determine if greater then or less then in the case that they are
+ * not equal. gt_v is either 1 (in the case s1 is greater then s2), or
+ * -1 (in the case that s2 is greater then s1).
+ */
+ gt_v = spu_gather(spu_cmpgt(data1, data2));
+ lt_v = spu_gather(spu_cmpgt(data2, data1));
+
+ gt_v = spu_sub(-1, spu_sl(spu_cmpgt(gt_v, lt_v), 1));
+
+ /* Construct a mask to be applied to gt_v if the strings are discovered
+ * to be equal.
+ */
+ mask_v = spu_cmpeq(spu_and(neq_v, mask_v), 0);
+
+ return (spu_extract(spu_andc(gt_v, mask_v), 0));
}
diff --git a/newlib/libc/machine/spu/strncmp.h b/newlib/libc/machine/spu/strncmp.h
deleted file mode 100644
index f464564bc..000000000
--- a/newlib/libc/machine/spu/strncmp.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- (C) Copyright 2001,2006,2008
- International Business Machines Corporation,
- Sony Computer Entertainment, Incorporated,
- Toshiba Corporation,
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- * 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.
- * Neither the names of the copyright holders nor the names of their
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-*/
-#include <spu_intrinsics.h>
-#include <stddef.h>
-
-/*
- * Internal _strncmp_internal for strncmp and memcmp:
- *
- * Compare the two strings s1 and s2 of length n. Returns an integer less
- * than, equal to, or greater than zero if s1 is found, respectively,
- * to be less than, to match, or be greater than s2. Check for zero bytes
- * only if check_zeroes is set. In additin, the vector value *end_v will
- * contain all zeroes if we hit a NUL character that caused the comparison
- * to complete, *end_v is modified only if check_zeroes is set.
- */
-static inline int
-_strncmp_internal(const char *s1, const char *s2, size_t n, vec_uint4
- *end_v, int check_zeroes)
-{
- unsigned int offset1, offset2;
- vec_int4 n_v;
- vec_uint4 cnt1_v, cnt2_v, max_cnt_v;
- vec_uint4 gt_v, lt_v, mask_v, end1_v, end2_v, neq_v, tmp1_v;
- vec_uint4 shift_n_v, shift_eos_v, max_shift_v;
- vec_uchar16 shuffle1, shuffle2;
- vec_uchar16 data1A, data1B, data1, data2A, data2B, data2;
- vec_uchar16 *ptr1, *ptr2;
-
- data1 = data2 = spu_splats((unsigned char)0);
-
- ptr1 = (vec_uchar16 *)s1;
- ptr2 = (vec_uchar16 *)s2;
-
- offset1 = (unsigned int)(ptr1) & 15;
- offset2 = (unsigned int)(ptr2) & 15;
-
- shuffle1 = (vec_uchar16)
- spu_add((vec_uint4)spu_splats((unsigned char)offset1),
- ((vec_uint4) {0x00010203, 0x04050607, 0x08090A0B, 0x0C0D0E0F}));
- shuffle2 = (vec_uchar16)
- spu_add((vec_uint4)spu_splats((unsigned char)offset2),
- ((vec_uint4) {0x00010203, 0x04050607, 0x08090A0B, 0x0C0D0E0F}));
- data1A = *ptr1++;
- data2A = *ptr2++;
-
- n_v = spu_promote((int)n, 0);
-
- do {
- data1B = *ptr1++;
- data2B = *ptr2++;
-
- /*
- * Quadword align each of the input strings so that we operate on full
- * quadwords.
- */
- data1 = spu_shuffle(data1A, data1B, shuffle1);
- data2 = spu_shuffle(data2A, data2B, shuffle2);
-
- data1A = data1B;
- data2A = data2B;
-
- neq_v = spu_gather(spu_xor(spu_cmpeq(data1, data2), -1));
-
- if (check_zeroes) {
- end1_v = spu_gather(spu_cmpeq(data1, 0));
- end2_v = spu_gather(spu_cmpeq(data2, 0));
- *end_v = spu_or(end1_v, end2_v);
- }
-
- n_v = spu_add(n_v, -16);
-
- /*
- * Repeat until either
- * 1) the character count expired
- * 2) check_zeroes is set and a null character is discovered in one of
- * the input strings
- * 3) the strings do not compare equal
- */
- if (check_zeroes) {
- tmp1_v = spu_or(*end_v, neq_v);
- tmp1_v = spu_cmpeq(tmp1_v, 0);
- } else {
- tmp1_v = spu_cmpeq(neq_v, 0);
- }
- tmp1_v = spu_and(tmp1_v, spu_cmpgt(n_v, 0));
- } while (spu_extract(tmp1_v, 0));
-
- /*
- * Construct a mask to eliminate characters that are not of interest
- * in the comparison.
- */
- mask_v = spu_splats((unsigned int)0xFFFF);
- shift_n_v =
- spu_andc((__vector unsigned int)spu_sub(0, n_v), spu_cmpgt(n_v, -1));
- if (check_zeroes) {
- cnt1_v = spu_cntlz(end1_v);
- cnt2_v = spu_cntlz(end2_v);
- max_cnt_v = spu_sel(cnt1_v, cnt2_v, spu_cmpgt(cnt2_v, cnt1_v));
- shift_eos_v = spu_sub(32, max_cnt_v);
- max_shift_v =
- spu_sel(shift_n_v, shift_eos_v, spu_cmpgt(shift_eos_v, shift_n_v));
- mask_v = spu_and(spu_sl(mask_v, spu_extract(max_shift_v, 0)), mask_v);
- } else {
- mask_v = spu_and(spu_sl(mask_v, spu_extract(shift_n_v, 0)), mask_v);
- }
-
- /*
- * Determine if greater then or less then in the case that they are
- * not equal. gt_v is either 1 (in the case s1 is greater then s2), or
- * -1 (in the case that s2 is greater then s1).
- *
- * There are no byte vector math instructions, so we can't subtract
- * data1 from data2.
- */
- gt_v = spu_gather(spu_cmpgt(data1, data2));
- lt_v = spu_gather(spu_cmpgt(data2, data1));
- gt_v = spu_sub(-1, spu_sl(spu_cmpgt(gt_v, lt_v), 1));
-
- /*
- * Construct a mask to be applied to gt_v if the strings are discovered
- * to be equal.
- */
- mask_v = spu_cmpeq(spu_and(neq_v, mask_v), 0);
- return (spu_extract(spu_andc(gt_v, mask_v), 0));
-}
diff --git a/newlib/libc/machine/spu/strncpy.c b/newlib/libc/machine/spu/strncpy.c
index 9c70b0401..334c3bb6c 100644
--- a/newlib/libc/machine/spu/strncpy.c
+++ b/newlib/libc/machine/spu/strncpy.c
@@ -1,6 +1,9 @@
/*
- (C) Copyright 2008
+ (C) Copyright 2001,2006,
International Business Machines Corporation,
+ Sony Computer Entertainment, Incorporated,
+ Toshiba Corporation,
+
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -27,16 +30,58 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <spu_intrinsics.h>
#include <stddef.h>
#include <string.h>
-#include "strcpy.h"
-/*
- * Copy the string up to n character from memory area src to memory area
- * dest. The memory areas may not overlap. The strncpy subroutine returns
- * a pointer to dest.
+/* Copy the string up to n character from memory area src to
+ * memory area dest. The memory areas may not overlap. The
+ * strncpy subroutine returns a pointer to dest.
*/
char * strncpy(char * __restrict__ dest, const char * __restrict__ src, size_t n)
{
- return _strncpy(dest, src, n, 1, 0);
+ unsigned int len;
+ unsigned int cmp, skip, mask;
+ vec_uchar16 *ptr, data;
+ vec_uint4 cnt, gt, N;
+
+ N = spu_promote((unsigned int)n, 0);
+
+ /* Determine the string length, including termination character,
+ * clamped to n characters.
+ */
+ ptr = (vec_uchar16 *)src;
+ skip = (unsigned int)(ptr) & 15;
+ mask = 0xFFFF >> skip;
+
+ data = *ptr++;
+ cmp = spu_extract(spu_gather(spu_cmpeq(data, 0)), 0);
+ cmp &= mask;
+
+ cnt = spu_cntlz(spu_promote(cmp, 0));
+ len = spu_extract(cnt, 0) - (skip + 15);
+
+ gt = spu_cmpgt(spu_promote(len, 0), N);
+
+ while (spu_extract(spu_andc(spu_cmpeq(cnt, 32), gt), 0)) {
+ data = *ptr++;
+ len -= 16;
+ cnt = spu_cntlz(spu_gather(spu_cmpeq(data, 0)));
+ len += spu_extract(cnt, 0);
+
+ gt = spu_cmpgt(spu_promote(len, 0), N);
+ }
+
+ /* len = MIN(len, n)
+ */
+ len = spu_extract(spu_sel(spu_promote((unsigned int)len, 0), N, gt), 0);
+
+ /* Padding
+ */
+ if (len != n) {
+ memset(dest + len, 0, n - len);
+ }
+ /* Perform a memcpy of the resulting length
+ */
+ return ((char *)memcpy((void *)dest, (const void *)src, len));
}
diff --git a/newlib/libc/machine/spu/sys/dirent.h b/newlib/libc/machine/spu/sys/dirent.h
index 6a158ec4a..876d3c1e8 100644
--- a/newlib/libc/machine/spu/sys/dirent.h
+++ b/newlib/libc/machine/spu/sys/dirent.h
@@ -32,9 +32,6 @@
*/
#ifndef _SYS_DIRENT_H
#define _SYS_DIRENT_H
-#ifdef __cplusplus
-extern "C" {
-#endif
#define MAXNAMLEN 255
@@ -57,7 +54,4 @@ struct dirent *readdir (DIR *);
void rewinddir(DIR *);
void seekdir(DIR *dir, off_t offset);
off_t telldir(DIR *dir);
-#ifdef __cplusplus
-}
-#endif
#endif
diff --git a/newlib/libc/machine/spu/sys/errno.h b/newlib/libc/machine/spu/sys/errno.h
index 85aafcfd5..28a327774 100644
--- a/newlib/libc/machine/spu/sys/errno.h
+++ b/newlib/libc/machine/spu/sys/errno.h
@@ -19,6 +19,10 @@
on which it is based, except values used or returned by syscalls must
be those of the Linux ppc. */
+/* errno is not a global variable, because that would make using it
+ non-reentrant. Instead, its address is returned by the function
+ __errno. */
+
#ifndef _SYS_ERRNO_H_
#ifdef __cplusplus
extern "C" {
@@ -27,8 +31,10 @@ extern "C" {
#include <sys/reent.h>
-extern struct _reent _impure_data;
-#define errno (_impure_data._errno)
+#ifndef _REENT_ONLY
+#define errno (*__errno())
+extern int *__errno _PARAMS ((void));
+#endif
/* Please don't use these variables directly.
Use strerror instead. */
diff --git a/newlib/libc/machine/spu/sys/linux_syscalls.h b/newlib/libc/machine/spu/sys/linux_syscalls.h
deleted file mode 100644
index f14564139..000000000
--- a/newlib/libc/machine/spu/sys/linux_syscalls.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
-(C) Copyright IBM Corp. 2008
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice,
-this list of conditions and the following disclaimer.
-* 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.
-* Neither the name of IBM 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
-
-Author: Ken Werner <ken.werner@de.ibm.com>
-*/
-
-#ifndef __LINUX_SYSCALLS_H
-#define __LINUX_SYSCALLS_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The system call numbers. See kernel source file
- include/asm-powerpc/unistd.h. */
-#define __NR_read 3
-#define __NR_write 4
-#define __NR_open 5
-#define __NR_close 6
-#define __NR_waitpid 7
-#define __NR_creat 8
-#define __NR_link 9
-#define __NR_unlink 10
-
-#define __NR_chdir 12
-#define __NR_time 13
-#define __NR_mkdod 14
-#define __NR_chmod 15
-#define __NR_lchown 16
-
-#define __NR_lseek 19
-#define __NR_getpid 20
-
-#define __NR_setuid 23
-#define __NR_getuid 24
-#define __NR_stime 25
-
-#define __NR_alarm 27
-
-#define __NR_access 33
-#define __NR_nice 34
-
-#define __NR_sync 36
-#define __NR_kill 37
-#define __NR_rename 38
-#define __NR_mkdir 39
-#define __NR_rmdir 40
-#define __NR_dup 41
-#define __NR_pipe 42
-#define __NR_times 43
-
-#define __NR_brk 45
-#define __NR_setgid 46
-#define __NR_getgid 47
-
-#define __NR_geteuid 49
-#define __NR_getegid 50
-
-#define __NR_ioctl 54
-#define __NR_fcntl 55
-
-#define __NR_setpgid 57
-
-#define __NR_umask 60
-#define __NR_chroot 61
-
-#define __NR_dup2 63
-#define __NR_getppid 64
-#define __NR_getpgrp 65
-#define __NR_setsid 66
-
-#define __NR_sgetmask 68
-#define __NR_ssetmask 69
-#define __NR_setreuid 70
-#define __NR_setregid 71
-
-#define __NR_sethostname 74
-#define __NR_setrlimit 75
-
-#define __NR_getrusage 77
-#define __NR_gettimeofday 78
-#define __NR_settimeofday 79
-#define __NR_getgroups 80
-#define __NR_setgroups 81
-
-#define __NR_symlink 83
-
-#define __NR_readlink 85
-
-#define __NR_mmap 90
-#define __NR_munmap 91
-#define __NR_truncate 92
-#define __NR_ftruncate 93
-#define __NR_fchmod 94
-#define __NR_fchown 95
-#define __NR_getpriority 96
-#define __NR_setpriority 97
-
-#define __NR_socketcall 102
-#define __NR_syslog 103
-#define __NR_setitimer 104
-#define __NR_getitimer 105
-#define __NR_newstat 106
-#define __NR_newlstat 107
-#define __NR_newfstat 108
-
-#define __NR_vhangup 111
-
-#define __NR_wait4 114
-
-#define __NR_sysinfo 116
-
-#define __NR_fsync 118
-
-#define __NR_setdomainname 121
-#define __NR_newuname 122
-
-#define __NR_adjtimex 124
-#define __NR_mprotect 125
-
-#define __NR_getpgid 132
-#define __NR_fchdir 133
-#define __NR_bdflush 134
-
-#define __NR_personality 136
-
-#define __NR_setfsuid 138
-#define __NR_setfsgid 139
-#define __NR__llseek 140
-#define __NR_getdents 141
-#define __NR__newselect 142
-#define __NR_flock 143
-#define __NR_msync 144
-#define __NR_readv 145
-#define __NR_writev 146
-#define __NR_getsid 147
-#define __NR_fdatasync 148
-
-#define __NR_mlock 150
-#define __NR_munlock 151
-#define __NR_mlockall 152
-#define __NR_munlockall 153
-#define __NR_sched_setparam 154
-#define __NR_sched_getparam 155
-#define __NR_sched_setscheduler 156
-#define __NR_sched_getscheduler 157
-#define __NR_sched_yield 158
-#define __NR_sched_get_priority_max 159
-#define __NR_sched_get_priority_min 160
-#define __NR_sched_rr_get_interval 161
-#define __NR_nanosleep 162
-#define __NR_mremap 163
-#define __NR_setresuid 164
-#define __NR_getresuid 165
-
-#define __NR_poll 167
-
-#define __NR_setresgid 169
-#define __NR_getresgid 170
-#define __NR_prctl 171
-
-#define __NR_pread64 179
-#define __NR_pwrite64 180
-#define __NR_chown 181
-#define __NR_getcwd 182
-#define __NR_capget 183
-#define __NR_capset 184
-
-#define __NR_sendfile 185
-
-#define __NR_getrlimit 190
-#define __NR_readahead 191
-
-#define __NR_getdents64 202
-#define __NR_pivot_root 203
-
-#define __NR_madvise 205
-#define __NR_mincore 206
-#define __NR_gettid 207
-#define __NR_tkill 208
-#define __NR_setxattr 209
-#define __NR_lsetxattr 210
-#define __NR_fsetxattr 211
-#define __NR_getxattr 212
-#define __NR_lgetxattr 213
-#define __NR_fgetxattr 214
-#define __NR_listxattr 215
-#define __NR_llistxattr 216
-#define __NR_flistxattr 217
-#define __NR_removexattr 218
-#define __NR_lremovexattr 219
-#define __NR_fremovexattr 220
-#define __NR_futex 221
-#define __NR_sched_setaffinity 222
-#define __NR_sched_getaffinity 223
-
-#define __NR_io_setup 227
-#define __NR_io_destroy 228
-#define __NR_io_getevents 229
-#define __NR_io_submit 230
-#define __NR_io_cancel 231
-
-#define __NR_fadvise64 233
-
-#define __NR_epoll_create 236
-#define __NR_epoll_ctl 237
-#define __NR_epoll_wait 238
-#define __NR_remap_file_pages 239
-#define __NR_timer_create 240
-#define __NR_timer_settime 241
-#define __NR_timer_gettime 242
-#define __NR_timer_getoverrun 243
-#define __NR_timer_delete 244
-#define __NR_clock_settime 245
-#define __NR_clock_gettime 246
-#define __NR_clock_getres 247
-#define __NR_clock_nanosleep 248
-
-#define __NR_tgkill 250
-#define __NR_utimes 251
-#define __NR_statfs64 252
-#define __NR_fstatfs64 253
-
-#define __NR_rtas 255
-
-#define __NR_unshare 282
-#define __NR_splice 283
-#define __NR_tee 284
-#define __NR_vmsplice 285
-#define __NR_openat 286
-#define __NR_mkdirat 287
-#define __NR_mknodat 288
-#define __NR_fchownat 289
-#define __NR_futimesat 290
-#define __NR_fstatat64 291
-#define __NR_unlinkat 292
-#define __NR_renameat 293
-#define __NR_linkat 294
-#define __NR_symlinkat 295
-#define __NR_readlinkat 296
-#define __NR_fchmodat 297
-#define __NR_faccessat 298
-#define __NR_get_robust_list 299
-#define __NR_set_robust_list 300
-#define __NR_move_pages 301
-#define __NR_getcpu 302
-
-#define __NR_utimensat 304
-#define __NR_signalfd 305
-#define __NR_timerfd 306
-#define __NR_eventfd 307
-#define __NR_sync_file_range2 308
-
-
-/* System callbacks from the SPU. See kernel source file
- include/asm-powerpc/spu.h. */
-struct spu_syscall_block
-{
- unsigned long long nr_ret; /* System call nr and return value. */
- unsigned long long parm[6]; /* System call arguments. */
-};
-
-/* Issues a Linux system call. */
-int __linux_syscall (struct spu_syscall_block *s);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/newlib/libc/machine/spu/sys/sched.h b/newlib/libc/machine/spu/sys/sched.h
index 60d95c925..90c274c37 100644
--- a/newlib/libc/machine/spu/sys/sched.h
+++ b/newlib/libc/machine/spu/sys/sched.h
@@ -1,12 +1,6 @@
#ifndef _SYS_SCHED_H
#define _SYS_SCHED_H
-#ifdef __cplusplus
-extern "C" {
-#endif
int sched_yield(void);
-#ifdef __cplusplus
-}
-#endif
#endif
diff --git a/newlib/libc/machine/spu/sys/syscall.h b/newlib/libc/machine/spu/sys/syscall.h
index caac53105..3a358a61b 100644
--- a/newlib/libc/machine/spu/sys/syscall.h
+++ b/newlib/libc/machine/spu/sys/syscall.h
@@ -1,10 +1,4 @@
#ifndef _SYS_SYSCALL_H
#define _SYS_SYSCALL_H
-#ifdef __cplusplus
-extern "C" {
-#endif
int __send_to_ppe(unsigned int signalcode, unsigned int opcode, void *data);
-#ifdef __cplusplus
-}
-#endif
#endif
diff --git a/newlib/libc/posix/Makefile.am b/newlib/libc/posix/Makefile.am
index 2091b4110..649451645 100644
--- a/newlib/libc/posix/Makefile.am
+++ b/newlib/libc/posix/Makefile.am
@@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
GENERAL_SOURCES = \
- closedir.c creat.c _isatty.c isatty.c \
+ closedir.c creat.c isatty.c \
opendir.c readdir.c \
readdir_r.c rewinddir.c sleep.c usleep.c \
telldir.c
diff --git a/newlib/libc/posix/Makefile.in b/newlib/libc/posix/Makefile.in
index e301129fb..1ac32b7a7 100644
--- a/newlib/libc/posix/Makefile.in
+++ b/newlib/libc/posix/Makefile.in
@@ -56,11 +56,10 @@ ARFLAGS = cru
lib_a_AR = $(AR) $(ARFLAGS)
lib_a_LIBADD =
am__objects_1 = lib_a-closedir.$(OBJEXT) lib_a-creat.$(OBJEXT) \
- lib_a-_isatty.$(OBJEXT) lib_a-isatty.$(OBJEXT) \
- lib_a-opendir.$(OBJEXT) lib_a-readdir.$(OBJEXT) \
- lib_a-readdir_r.$(OBJEXT) lib_a-rewinddir.$(OBJEXT) \
- lib_a-sleep.$(OBJEXT) lib_a-usleep.$(OBJEXT) \
- lib_a-telldir.$(OBJEXT)
+ lib_a-isatty.$(OBJEXT) lib_a-opendir.$(OBJEXT) \
+ lib_a-readdir.$(OBJEXT) lib_a-readdir_r.$(OBJEXT) \
+ lib_a-rewinddir.$(OBJEXT) lib_a-sleep.$(OBJEXT) \
+ lib_a-usleep.$(OBJEXT) lib_a-telldir.$(OBJEXT)
am__objects_2 = lib_a-scandir.$(OBJEXT) lib_a-seekdir.$(OBJEXT)
am__objects_3 = lib_a-execl.$(OBJEXT) lib_a-execle.$(OBJEXT) \
lib_a-execlp.$(OBJEXT) lib_a-execv.$(OBJEXT) \
@@ -78,9 +77,8 @@ am__objects_4 = lib_a-popen.$(OBJEXT)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libposix_la_LIBADD =
-am__objects_6 = closedir.lo creat.lo _isatty.lo isatty.lo opendir.lo \
- readdir.lo readdir_r.lo rewinddir.lo sleep.lo usleep.lo \
- telldir.lo
+am__objects_6 = closedir.lo creat.lo isatty.lo opendir.lo readdir.lo \
+ readdir_r.lo rewinddir.lo sleep.lo usleep.lo telldir.lo
am__objects_7 = scandir.lo seekdir.lo
am__objects_8 = execl.lo execle.lo execlp.lo execv.lo execve.lo \
execvp.lo
@@ -272,7 +270,7 @@ target_alias = @target_alias@
AUTOMAKE_OPTIONS = cygnus
INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
GENERAL_SOURCES = \
- closedir.c creat.c _isatty.c isatty.c \
+ closedir.c creat.c isatty.c \
opendir.c readdir.c \
readdir_r.c rewinddir.c sleep.c usleep.c \
telldir.c
@@ -383,12 +381,6 @@ lib_a-creat.o: creat.c
lib_a-creat.obj: creat.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-creat.obj `if test -f 'creat.c'; then $(CYGPATH_W) 'creat.c'; else $(CYGPATH_W) '$(srcdir)/creat.c'; fi`
-lib_a-_isatty.o: _isatty.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-_isatty.o `test -f '_isatty.c' || echo '$(srcdir)/'`_isatty.c
-
-lib_a-_isatty.obj: _isatty.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-_isatty.obj `if test -f '_isatty.c'; then $(CYGPATH_W) '_isatty.c'; else $(CYGPATH_W) '$(srcdir)/_isatty.c'; fi`
-
lib_a-isatty.o: isatty.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-isatty.o `test -f 'isatty.c' || echo '$(srcdir)/'`isatty.c
diff --git a/newlib/libc/posix/_isatty.c b/newlib/libc/posix/_isatty.c
deleted file mode 100644
index 7260211ef..000000000
--- a/newlib/libc/posix/_isatty.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* isatty.c */
-
-/* Dumb implementation so programs will at least run. */
-
-#include <sys/stat.h>
-
-int
-_DEFUN(_isatty, (fd), int fd)
-{
- struct stat buf;
-
- if (fstat (fd, &buf) < 0)
- return 0;
- if (S_ISCHR (buf.st_mode))
- return 1;
- return 0;
-}
diff --git a/newlib/libc/posix/isatty.c b/newlib/libc/posix/isatty.c
index afd5ec85e..2732ca2a0 100644
--- a/newlib/libc/posix/isatty.c
+++ b/newlib/libc/posix/isatty.c
@@ -1,10 +1,17 @@
/* isatty.c */
-#include <unistd.h>
-#include <reent.h>
+/* Dumb implementation so programs will at least run. */
+
+#include <sys/stat.h>
int
_DEFUN(isatty, (fd), int fd)
{
- return _isatty (fd);
+ struct stat buf;
+
+ if (fstat (fd, &buf) < 0)
+ return 0;
+ if (S_ISCHR (buf.st_mode))
+ return 1;
+ return 0;
}
diff --git a/newlib/libc/reent/Makefile.am b/newlib/libc/reent/Makefile.am
index 0d21285a1..b695e2941 100644
--- a/newlib/libc/reent/Makefile.am
+++ b/newlib/libc/reent/Makefile.am
@@ -37,7 +37,6 @@ GENERAL_SOURCES = \
fstatr.c \
getreent.c \
gettimeofdayr.c \
- isattyr.c \
linkr.c \
lseekr.c \
openr.c \
diff --git a/newlib/libc/reent/Makefile.in b/newlib/libc/reent/Makefile.in
index 5677cc4aa..282e28d9d 100644
--- a/newlib/libc/reent/Makefile.in
+++ b/newlib/libc/reent/Makefile.in
@@ -58,13 +58,13 @@ lib_a_LIBADD =
am__objects_1 = lib_a-closer.$(OBJEXT) lib_a-reent.$(OBJEXT) \
lib_a-impure.$(OBJEXT) lib_a-fcntlr.$(OBJEXT) \
lib_a-fstatr.$(OBJEXT) lib_a-getreent.$(OBJEXT) \
- lib_a-gettimeofdayr.$(OBJEXT) lib_a-isattyr.$(OBJEXT) \
- lib_a-linkr.$(OBJEXT) lib_a-lseekr.$(OBJEXT) \
- lib_a-openr.$(OBJEXT) lib_a-readr.$(OBJEXT) \
- lib_a-renamer.$(OBJEXT) lib_a-signalr.$(OBJEXT) \
- lib_a-signgam.$(OBJEXT) lib_a-sbrkr.$(OBJEXT) \
- lib_a-statr.$(OBJEXT) lib_a-timesr.$(OBJEXT) \
- lib_a-unlinkr.$(OBJEXT) lib_a-writer.$(OBJEXT)
+ lib_a-gettimeofdayr.$(OBJEXT) lib_a-linkr.$(OBJEXT) \
+ lib_a-lseekr.$(OBJEXT) lib_a-openr.$(OBJEXT) \
+ lib_a-readr.$(OBJEXT) lib_a-renamer.$(OBJEXT) \
+ lib_a-signalr.$(OBJEXT) lib_a-signgam.$(OBJEXT) \
+ lib_a-sbrkr.$(OBJEXT) lib_a-statr.$(OBJEXT) \
+ lib_a-timesr.$(OBJEXT) lib_a-unlinkr.$(OBJEXT) \
+ lib_a-writer.$(OBJEXT)
@HAVE_STDIO64_DIR_TRUE@am__objects_2 = lib_a-fstat64r.$(OBJEXT) \
@HAVE_STDIO64_DIR_TRUE@ lib_a-lseek64r.$(OBJEXT) \
@HAVE_STDIO64_DIR_TRUE@ lib_a-open64r.$(OBJEXT)
@@ -81,9 +81,9 @@ lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libreent_la_LIBADD =
am__objects_6 = closer.lo reent.lo impure.lo fcntlr.lo fstatr.lo \
- getreent.lo gettimeofdayr.lo isattyr.lo linkr.lo lseekr.lo \
- openr.lo readr.lo renamer.lo signalr.lo signgam.lo sbrkr.lo \
- statr.lo timesr.lo unlinkr.lo writer.lo
+ getreent.lo gettimeofdayr.lo linkr.lo lseekr.lo openr.lo \
+ readr.lo renamer.lo signalr.lo signgam.lo sbrkr.lo statr.lo \
+ timesr.lo unlinkr.lo writer.lo
@HAVE_STDIO64_DIR_TRUE@am__objects_7 = fstat64r.lo lseek64r.lo \
@HAVE_STDIO64_DIR_TRUE@ open64r.lo
am__objects_8 = $(am__objects_7)
@@ -295,7 +295,6 @@ GENERAL_SOURCES = \
fstatr.c \
getreent.c \
gettimeofdayr.c \
- isattyr.c \
linkr.c \
lseekr.c \
openr.c \
@@ -450,12 +449,6 @@ lib_a-gettimeofdayr.o: gettimeofdayr.c
lib_a-gettimeofdayr.obj: gettimeofdayr.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gettimeofdayr.obj `if test -f 'gettimeofdayr.c'; then $(CYGPATH_W) 'gettimeofdayr.c'; else $(CYGPATH_W) '$(srcdir)/gettimeofdayr.c'; fi`
-lib_a-isattyr.o: isattyr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-isattyr.o `test -f 'isattyr.c' || echo '$(srcdir)/'`isattyr.c
-
-lib_a-isattyr.obj: isattyr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-isattyr.obj `if test -f 'isattyr.c'; then $(CYGPATH_W) 'isattyr.c'; else $(CYGPATH_W) '$(srcdir)/isattyr.c'; fi`
-
lib_a-linkr.o: linkr.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linkr.o `test -f 'linkr.c' || echo '$(srcdir)/'`linkr.c
diff --git a/newlib/libc/reent/isattyr.c b/newlib/libc/reent/isattyr.c
deleted file mode 100644
index 05d47d323..000000000
--- a/newlib/libc/reent/isattyr.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Reentrant versions of isatty system call. */
-
-#include <reent.h>
-#include <unistd.h>
-#include <_syslist.h>
-
-/* Some targets provides their own versions of these functions. Those
- targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS. */
-
-#ifdef _REENT_ONLY
-#ifndef REENTRANT_SYSCALLS_PROVIDED
-#define REENTRANT_SYSCALLS_PROVIDED
-#endif
-#endif
-
-#ifdef REENTRANT_SYSCALLS_PROVIDED
-
-int _dummy_isatty_syscalls = 1;
-
-#else
-
-/* We use the errno variable used by the system dependent layer. */
-#undef errno
-extern int errno;
-
-/*
-FUNCTION
- <<_isatty_r>>---Reentrant version of isatty
-
-INDEX
- _isatty_r
-
-ANSI_SYNOPSIS
- #include <reent.h>
- int _isatty_r(struct _reent *<[ptr]>,
- int <[fd]>);
-
-TRAD_SYNOPSIS
- #include <reent.h>
- int _isatty_r(<[ptr]>, <[fd]>)
- struct _reent *<[ptr]>;
- int <[fd]>;
-
-DESCRIPTION
- This is a reentrant version of <<isatty>>. It
- takes a pointer to the global data block, which holds
- <<errno>>.
-*/
-
-int
-_isatty_r (ptr, fd)
- struct _reent *ptr;
- int fd;
-{
- int ret;
-
- errno = 0;
- if ((ret = _isatty (fd)) == -1 && errno != 0)
- ptr->_errno = errno;
- return ret;
-}
-
-#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
diff --git a/newlib/libc/search/hash.h b/newlib/libc/search/hash.h
index 6491814d6..db9e96dd8 100644
--- a/newlib/libc/search/hash.h
+++ b/newlib/libc/search/hash.h
@@ -38,8 +38,6 @@
*/
#include <sys/param.h>
-#define __need_size_t
-#include <stddef.h>
/* Check that newlib understands the byte order of its target system. */
#ifndef BYTE_ORDER
diff --git a/newlib/libc/stdio/Makefile.am b/newlib/libc/stdio/Makefile.am
index b50b87188..4d3daaefb 100644
--- a/newlib/libc/stdio/Makefile.am
+++ b/newlib/libc/stdio/Makefile.am
@@ -128,8 +128,6 @@ endif !ELIX_LEVEL_2
endif !ELIX_LEVEL_1
LIBADD_OBJS = \
- $(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
- $(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
$(lpfx)vfiprintf.$(oext) $(lpfx)vfprintf.$(oext) \
$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext)
@@ -163,24 +161,12 @@ $(lpfx)vfprintf.$(oext): vfprintf.c
$(lpfx)vfiprintf.$(oext): vfprintf.c
$(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
-$(lpfx)svfprintf.$(oext): vfprintf.c
- $(LIB_COMPILE) -fshort-enums -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
-
-$(lpfx)svfiprintf.$(oext): vfprintf.c
- $(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
-
$(lpfx)vfscanf.$(oext): vfscanf.c
$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
$(lpfx)vfiscanf.$(oext): vfscanf.c
$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
-$(lpfx)svfscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
-
-$(lpfx)svfiscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
-
CHEWOUT_FILES = \
clearerr.def \
diprintf.def \
@@ -288,10 +274,6 @@ $(lpfx)sprintf.$(oext): local.h
$(lpfx)siscanf.$(oext): local.h
$(lpfx)sscanf.$(oext): local.h
$(lpfx)stdio.$(oext): local.h
-$(lpfx)svfiprintf.$(oext): local.h
-$(lpfx)svfiscanf.$(oext): local.h floatio.h
-$(lpfx)svfprintf.$(oext): local.h
-$(lpfx)svfscanf.$(oext): local.h floatio.h
$(lpfx)ungetc.$(oext): local.h
$(lpfx)vfiprintf.$(oext): local.h
$(lpfx)vfprintf.$(oext): local.h
diff --git a/newlib/libc/stdio/Makefile.in b/newlib/libc/stdio/Makefile.in
index be8cd4554..3b80e35bc 100644
--- a/newlib/libc/stdio/Makefile.in
+++ b/newlib/libc/stdio/Makefile.in
@@ -54,11 +54,8 @@ CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
lib_a_AR = $(AR) $(ARFLAGS)
-am__DEPENDENCIES_1 = $(lpfx)svfiprintf.$(oext) \
- $(lpfx)svfprintf.$(oext) $(lpfx)svfiscanf.$(oext) \
- $(lpfx)svfscanf.$(oext) $(lpfx)vfiprintf.$(oext) \
- $(lpfx)vfprintf.$(oext) $(lpfx)vfscanf.$(oext) \
- $(lpfx)vfiscanf.$(oext)
+am__DEPENDENCIES_1 = $(lpfx)vfiprintf.$(oext) $(lpfx)vfprintf.$(oext) \
+ $(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext)
am__objects_1 = lib_a-clearerr.$(OBJEXT) lib_a-fclose.$(OBJEXT) \
lib_a-fdopen.$(OBJEXT) lib_a-feof.$(OBJEXT) \
lib_a-ferror.$(OBJEXT) lib_a-fflush.$(OBJEXT) \
@@ -441,8 +438,6 @@ GENERAL_SOURCES = \
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_4_SOURCES =
@ELIX_LEVEL_1_TRUE@ELIX_4_SOURCES =
LIBADD_OBJS = \
- $(lpfx)svfiprintf.$(oext) $(lpfx)svfprintf.$(oext) \
- $(lpfx)svfiscanf.$(oext) $(lpfx)svfscanf.$(oext) \
$(lpfx)vfiprintf.$(oext) $(lpfx)vfprintf.$(oext) \
$(lpfx)vfscanf.$(oext) $(lpfx)vfiscanf.$(oext)
@@ -1350,24 +1345,12 @@ $(lpfx)vfprintf.$(oext): vfprintf.c
$(lpfx)vfiprintf.$(oext): vfprintf.c
$(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -c $(srcdir)/vfprintf.c -o $@
-$(lpfx)svfprintf.$(oext): vfprintf.c
- $(LIB_COMPILE) -fshort-enums -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
-
-$(lpfx)svfiprintf.$(oext): vfprintf.c
- $(LIB_COMPILE) -fshort-enums -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfprintf.c -o $@
-
$(lpfx)vfscanf.$(oext): vfscanf.c
$(LIB_COMPILE) -c $(srcdir)/vfscanf.c -o $@
$(lpfx)vfiscanf.$(oext): vfscanf.c
$(LIB_COMPILE) -DINTEGER_ONLY -c $(srcdir)/vfscanf.c -o $@
-$(lpfx)svfscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
-
-$(lpfx)svfiscanf.$(oext): vfscanf.c
- $(LIB_COMPILE) -DINTEGER_ONLY -DSTRING_ONLY -c $(srcdir)/vfscanf.c -o $@
-
.c.def:
$(CHEW) < $< > $*.def 2> $*.ref
touch stmp-def
@@ -1405,10 +1388,6 @@ $(lpfx)sprintf.$(oext): local.h
$(lpfx)siscanf.$(oext): local.h
$(lpfx)sscanf.$(oext): local.h
$(lpfx)stdio.$(oext): local.h
-$(lpfx)svfiprintf.$(oext): local.h
-$(lpfx)svfiscanf.$(oext): local.h floatio.h
-$(lpfx)svfprintf.$(oext): local.h
-$(lpfx)svfscanf.$(oext): local.h floatio.h
$(lpfx)ungetc.$(oext): local.h
$(lpfx)vfiprintf.$(oext): local.h
$(lpfx)vfprintf.$(oext): local.h
diff --git a/newlib/libc/stdio/asiprintf.c b/newlib/libc/stdio/asiprintf.c
index 97474fd1a..aab3b4410 100644
--- a/newlib/libc/stdio/asiprintf.c
+++ b/newlib/libc/stdio/asiprintf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1990, 2007 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@@ -40,7 +40,7 @@ _DEFUN(_asiprintf_r, (ptr, strp, fmt),
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
@@ -67,7 +67,7 @@ _DEFUN(asiprintf, (strp, fmt),
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfiprintf_r (_REENT, &f, fmt, ap);
+ ret = _vfiprintf_r (_REENT, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
diff --git a/newlib/libc/stdio/asniprintf.c b/newlib/libc/stdio/asniprintf.c
index d4ff901e8..dd74b7c8c 100644
--- a/newlib/libc/stdio/asniprintf.c
+++ b/newlib/libc/stdio/asniprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2008 Eric Blake
+/* Copyright (C) 2007 Eric Blake
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
@@ -48,7 +48,7 @@ _DEFUN(_asniprintf_r, (ptr, buf, lenp, fmt),
f._bf._size = f._w = len;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < 0)
return NULL;
@@ -95,7 +95,7 @@ _DEFUN(asniprintf, (buf, lenp, fmt),
f._bf._size = f._w = len;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < 0)
return NULL;
diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c
index bb7057a34..ef9bd8900 100644
--- a/newlib/libc/stdio/asnprintf.c
+++ b/newlib/libc/stdio/asnprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2008 Eric Blake
+/* Copyright (C) 2007 Eric Blake
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
@@ -48,7 +48,7 @@ _DEFUN(_asnprintf_r, (ptr, buf, lenp, fmt),
f._bf._size = f._w = len;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < 0)
return NULL;
@@ -95,7 +95,7 @@ _DEFUN(asnprintf, (buf, lenp, fmt),
f._bf._size = f._w = len;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < 0)
return NULL;
diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c
index 59a08c808..d72a4a7e9 100644
--- a/newlib/libc/stdio/asprintf.c
+++ b/newlib/libc/stdio/asprintf.c
@@ -40,7 +40,7 @@ _DEFUN(_asprintf_r, (ptr, strp, fmt),
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
@@ -67,7 +67,7 @@ _DEFUN(asprintf, (strp, fmt),
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
va_start (ap, fmt);
- ret = _svfprintf_r (_REENT, &f, fmt, ap);
+ ret = _vfprintf_r (_REENT, &f, fmt, ap);
va_end (ap);
if (ret >= 0)
{
diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c
index b0eb19192..53bb50bfa 100644
--- a/newlib/libc/stdio/dprintf.c
+++ b/newlib/libc/stdio/dprintf.c
@@ -45,7 +45,6 @@ Supporting OS subroutines required: <<sbrk>>, <<write>>.
#include <stdio.h>
#include <unistd.h>
#include <stdarg.h>
-#include "local.h"
int
_DEFUN(_dprintf_r, (ptr, fd, format),
diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c
index 33e2e7b26..24bd6c10e 100644
--- a/newlib/libc/stdio/fflush.c
+++ b/newlib/libc/stdio/fflush.c
@@ -164,8 +164,6 @@ _DEFUN(_fflush_r, (ptr, fp),
fp->_p = fp->_bf._base;
if (fp->_flags & __SOFF)
fp->_offset = curoff;
- if (HASUB (fp))
- FREEUB (ptr, fp);
}
else
{
diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c
index 2a0d36247..247f8c6ad 100644
--- a/newlib/libc/stdio/freopen.c
+++ b/newlib/libc/stdio/freopen.c
@@ -167,7 +167,7 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp),
/*
* F_SETFL doesn't change textmode. Don't mess with modes of ttys.
*/
- if (0 <= f && ! _isatty_r (ptr, f)
+ if (0 <= f && ! isatty (f)
&& setmode (f, oflags & (O_BINARY | O_TEXT)) == -1)
f = -1;
#endif
diff --git a/newlib/libc/stdio/ftell.c b/newlib/libc/stdio/ftell.c
index 816cafa76..2aa10b2c7 100644
--- a/newlib/libc/stdio/ftell.c
+++ b/newlib/libc/stdio/ftell.c
@@ -118,12 +118,9 @@ _DEFUN(_ftell_r, (ptr, fp),
return -1L;
}
- /* Find offset of underlying I/O object, then adjust for buffered
- bytes. Flush a write stream, since the offset may be altered if
- the stream is appending. Do not flush a read stream, since we
- must not lose the ungetc buffer. */
- if (fp->_flags & __SWR)
- _fflush_r (ptr, fp);
+ /* Find offset of underlying I/O object, then
+ adjust for buffered bytes. */
+ _fflush_r (ptr, fp); /* may adjust seek offset on append stream */
if (fp->_flags & __SOFF)
pos = fp->_offset;
else
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 5dc2e6223..f02f91d57 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -34,15 +34,7 @@
extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
-extern int _EXFUN(__ssvfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
-extern int _EXFUN(__ssvfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
-int _EXFUN(_svfprintf_r,(struct _reent *, FILE *, const char *,
- va_list)
- _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
-int _EXFUN(_svfiprintf_r,(struct _reent *, FILE *, const char *,
- va_list)
- _ATTRIBUTE ((__format__ (__printf__, 3, 0))));
extern FILE *_EXFUN(__sfp,(struct _reent *));
extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*));
extern int _EXFUN(__srefill_r,(struct _reent *,FILE *));
diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c
index a3f47e2f7..d13f162b2 100644
--- a/newlib/libc/stdio/makebuf.c
+++ b/newlib/libc/stdio/makebuf.c
@@ -107,7 +107,7 @@ _DEFUN(__smakebuf_r, (ptr, fp),
fp->_flags |= __SMBF;
fp->_bf._base = fp->_p = (unsigned char *) p;
fp->_bf._size = size;
- if (couldbetty && _isatty_r (ptr, fp->_file))
+ if (couldbetty && isatty (fp->_file))
fp->_flags |= __SLBF;
}
}
diff --git a/newlib/libc/stdio/rget.c b/newlib/libc/stdio/rget.c
index 9474bd9f6..0444acee3 100644
--- a/newlib/libc/stdio/rget.c
+++ b/newlib/libc/stdio/rget.c
@@ -36,10 +36,6 @@ _DEFUN(__srget_r, (ptr, fp),
struct _reent *ptr _AND
register FILE *fp)
{
- /* Ensure that any fake std stream is resolved before
- we call __srefill_r so we may access the true read buffer. */
- CHECK_INIT(ptr, fp);
-
if (__srefill_r (ptr, fp) == 0)
{
fp->_r--;
diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c
index d6a0e1983..296a16ee0 100644
--- a/newlib/libc/stdio/siprintf.c
+++ b/newlib/libc/stdio/siprintf.c
@@ -119,7 +119,7 @@ _siprintf_r(ptr, str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
va_end (ap);
*f._p = 0;
return (ret);
@@ -152,7 +152,7 @@ siprintf(str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfiprintf_r (_REENT, &f, fmt, ap);
+ ret = _vfiprintf_r (_REENT, &f, fmt, ap);
va_end (ap);
*f._p = 0;
return (ret);
diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c
index a64e2a891..15b25c196 100644
--- a/newlib/libc/stdio/siscanf.c
+++ b/newlib/libc/stdio/siscanf.c
@@ -152,7 +152,7 @@ siscanf(str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = __ssvfiscanf_r (_REENT, &f, fmt, ap);
+ ret = __svfiscanf_r (_REENT, &f, fmt, ap);
va_end (ap);
return ret;
}
@@ -190,7 +190,7 @@ _siscanf_r(ptr, str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = __ssvfiscanf_r (ptr, &f, fmt, ap);
+ ret = __svfiscanf_r (ptr, &f, fmt, ap);
va_end (ap);
return ret;
}
diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c
index 98a2c2509..8cd06ce86 100644
--- a/newlib/libc/stdio/sniprintf.c
+++ b/newlib/libc/stdio/sniprintf.c
@@ -64,7 +64,7 @@ _sniprintf_r (ptr, str, size, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < EOF)
ptr->_errno = EOVERFLOW;
@@ -108,7 +108,7 @@ sniprintf (str, size, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < EOF)
ptr->_errno = EOVERFLOW;
diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c
index 13414e3d1..52db2dd2c 100644
--- a/newlib/libc/stdio/snprintf.c
+++ b/newlib/libc/stdio/snprintf.c
@@ -63,7 +63,7 @@ _snprintf_r(ptr, str, size, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < EOF)
ptr->_errno = EOVERFLOW;
@@ -107,7 +107,7 @@ snprintf(str, size, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
va_end (ap);
if (ret < EOF)
ptr->_errno = EOVERFLOW;
diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c
index 48d811cf6..bdff0797d 100644
--- a/newlib/libc/stdio/sprintf.c
+++ b/newlib/libc/stdio/sprintf.c
@@ -583,7 +583,7 @@ _sprintf_r(ptr, str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
va_end (ap);
*f._p = 0;
return (ret);
@@ -616,7 +616,7 @@ sprintf(str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = _svfprintf_r (_REENT, &f, fmt, ap);
+ ret = _vfprintf_r (_REENT, &f, fmt, ap);
va_end (ap);
*f._p = 0;
return (ret);
diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c
index b09390380..c0921e1e1 100644
--- a/newlib/libc/stdio/sscanf.c
+++ b/newlib/libc/stdio/sscanf.c
@@ -433,7 +433,7 @@ sscanf(str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = __ssvfscanf_r (_REENT, &f, fmt, ap);
+ ret = __svfscanf_r (_REENT, &f, fmt, ap);
va_end (ap);
return ret;
}
@@ -471,7 +471,7 @@ _sscanf_r(ptr, str, fmt, va_alist)
#else
va_start (ap);
#endif
- ret = __ssvfscanf_r (ptr, &f, fmt, ap);
+ ret = __svfscanf_r (ptr, &f, fmt, ap);
va_end (ap);
return ret;
}
diff --git a/newlib/libc/stdio/vasiprintf.c b/newlib/libc/stdio/vasiprintf.c
index 671bbdb08..b16efe794 100644
--- a/newlib/libc/stdio/vasiprintf.c
+++ b/newlib/libc/stdio/vasiprintf.c
@@ -53,7 +53,7 @@ _DEFUN(_vasiprintf_r, (ptr, strp, fmt, ap),
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
if (ret >= 0)
{
*f._p = 0;
diff --git a/newlib/libc/stdio/vasniprintf.c b/newlib/libc/stdio/vasniprintf.c
index bf9b7c5eb..1e5d600c7 100644
--- a/newlib/libc/stdio/vasniprintf.c
+++ b/newlib/libc/stdio/vasniprintf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2008 Eric Blake
+/* Copyright (C) 2007 Eric Blake
* Permission to use, copy, modify, and distribute this software
* is freely granted, provided that this notice is preserved.
*/
@@ -47,7 +47,7 @@ _DEFUN(_vasniprintf_r, (ptr, buf, lenp, fmt, ap),
}
f._bf._size = f._w = len;
f._file = -1; /* No file. */
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
if (ret < 0)
return NULL;
*lenp = ret;
diff --git a/newlib/libc/stdio/vasnprintf.c b/newlib/libc/stdio/vasnprintf.c
index 2dda30a7a..740aa0700 100644
--- a/newlib/libc/stdio/vasnprintf.c
+++ b/newlib/libc/stdio/vasnprintf.c
@@ -47,7 +47,7 @@ _DEFUN(_vasnprintf_r, (ptr, buf, lenp, fmt, ap),
}
f._bf._size = f._w = len;
f._file = -1; /* No file. */
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
if (ret < 0)
return NULL;
*lenp = ret;
diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c
index 525c6963a..90539d1d8 100644
--- a/newlib/libc/stdio/vasprintf.c
+++ b/newlib/libc/stdio/vasprintf.c
@@ -53,7 +53,7 @@ _DEFUN(_vasprintf_r, (ptr, strp, fmt, ap),
f._bf._base = f._p = NULL;
f._bf._size = f._w = 0;
f._file = -1; /* No file. */
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
if (ret >= 0)
{
*f._p = 0;
diff --git a/newlib/libc/stdio/vdiprintf.c b/newlib/libc/stdio/vdiprintf.c
index 51bdb000e..b9b94735c 100644
--- a/newlib/libc/stdio/vdiprintf.c
+++ b/newlib/libc/stdio/vdiprintf.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
-#include "local.h"
int
_DEFUN(_vdiprintf_r, (ptr, fd, format, ap),
diff --git a/newlib/libc/stdio/vdprintf.c b/newlib/libc/stdio/vdprintf.c
index bfb19c95b..8a20235ef 100644
--- a/newlib/libc/stdio/vdprintf.c
+++ b/newlib/libc/stdio/vdprintf.c
@@ -10,7 +10,6 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
-#include "local.h"
int
_DEFUN(_vdprintf_r, (ptr, fd, format, ap),
diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c
index 1846d7c1e..e9c7c9e1a 100644
--- a/newlib/libc/stdio/vfprintf.c
+++ b/newlib/libc/stdio/vfprintf.c
@@ -116,18 +116,10 @@ static char *rcsid = "$Id$";
#ifdef INTEGER_ONLY
# define VFPRINTF vfiprintf
-# ifdef STRING_ONLY
-# define _VFPRINTF_R _svfiprintf_r
-# else
-# define _VFPRINTF_R _vfiprintf_r
-# endif
+# define _VFPRINTF_R _vfiprintf_r
#else
# define VFPRINTF vfprintf
-# ifdef STRING_ONLY
-# define _VFPRINTF_R _svfprintf_r
-# else
-# define _VFPRINTF_R _vfprintf_r
-# endif
+# define _VFPRINTF_R _vfprintf_r
# ifndef NO_FLOATING_POINT
# define FLOATING_POINT
# endif
@@ -166,100 +158,6 @@ static char *rcsid = "$Id$";
# undef _NO_LONGLONG
#endif
-#ifdef STRING_ONLY
-static int
-_DEFUN(__sprint_r, (ptr, fp, uio),
- struct _reent *ptr _AND
- FILE *fp _AND
- register struct __suio *uio)
-{
- register size_t len;
- register int w;
- register struct __siov *iov;
- register _CONST char *p = NULL;
-
- iov = uio->uio_iov;
- len = 0;
-
- if (uio->uio_resid == 0) {
- uio->uio_iovcnt = 0;
- return (0);
- }
-
- do {
- while (len == 0) {
- p = iov->iov_base;
- len = iov->iov_len;
- iov++;
- }
- w = fp->_w;
- if (len >= w && fp->_flags & (__SMBF | __SOPT)) {
- /* must be asprintf family */
- unsigned char *str;
- int curpos = (fp->_p - fp->_bf._base);
- /* Choose a geometric growth factor to avoid
- * quadratic realloc behavior, but use a rate less
- * than (1+sqrt(5))/2 to accomodate malloc
- * overhead. asprintf EXPECTS us to overallocate, so
- * that it can add a trailing \0 without
- * reallocating. The new allocation should thus be
- * max(prev_size*1.5, curpos+len+1). */
- int newsize = fp->_bf._size * 3 / 2;
- if (newsize < curpos + len + 1)
- newsize = curpos + len + 1;
- if (fp->_flags & __SOPT)
- {
- /* asnprintf leaves original buffer alone. */
- str = (unsigned char *)_malloc_r (ptr, newsize);
- if (!str)
- {
- ptr->_errno = ENOMEM;
- goto err;
- }
- memcpy (str, fp->_bf._base, curpos);
- fp->_flags = (fp->_flags & ~__SOPT) | __SMBF;
- }
- else
- {
- str = (unsigned char *)_realloc_r (ptr, fp->_bf._base,
- newsize);
- if (!str) {
- /* Free unneeded buffer. */
- _free_r (ptr, fp->_bf._base);
- /* Ensure correct errno, even if free
- * changed it. */
- ptr->_errno = ENOMEM;
- goto err;
- }
- }
- fp->_bf._base = str;
- fp->_p = str + curpos;
- fp->_bf._size = newsize;
- w = len;
- fp->_w = newsize - curpos;
- }
- if (len < w)
- w = len;
- (void)memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (w));
- fp->_w -= w;
- fp->_p += w;
- w = len; /* pretend we copied all */
- p += w;
- len -= w;
- } while ((uio->uio_resid -= w) != 0);
-
- uio->uio_resid = 0;
- uio->uio_iovcnt = 0;
- return 0;
-
-err:
- fp->_flags |= __SERR;
- uio->uio_resid = 0;
- uio->uio_iovcnt = 0;
- return EOF;
-}
-
-#else /* !STRING_ONLY */
/*
* Flush out all the vectors defined by the given uio,
* then reset it so that it can be reused.
@@ -324,7 +222,6 @@ _DEFUN(__sbprintf, (rptr, fp, fmt, ap),
#endif
return (ret);
}
-#endif /* !STRING_ONLY */
#ifdef FLOATING_POINT
@@ -425,8 +322,8 @@ union arg_val
};
static union arg_val *
-_EXFUN(get_arg, (struct _reent *data, int n, char *fmt,
- va_list *ap, int *numargs, union arg_val *args,
+_EXFUN(get_arg, (struct _reent *data, int n, char *fmt,
+ va_list *ap, int *numargs, union arg_val *args,
int *arg_type, char **last_fmt));
#endif /* !_NO_POS_ARGS */
@@ -463,8 +360,7 @@ _EXFUN(get_arg, (struct _reent *data, int n, char *fmt,
int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, _CONST char *, va_list));
-#ifndef STRING_ONLY
-int
+int
_DEFUN(VFPRINTF, (fp, fmt0, ap),
FILE * fp _AND
_CONST char *fmt0 _AND
@@ -474,9 +370,8 @@ _DEFUN(VFPRINTF, (fp, fmt0, ap),
result = _VFPRINTF_R (_REENT, fp, fmt0, ap);
return result;
}
-#endif /* STRING_ONLY */
-int
+int
_DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
struct _reent *data _AND
FILE * fp _AND
@@ -622,14 +517,12 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
(u_long)GET_ARG (N, ap, u_int))
#endif
-#ifndef STRING_ONLY
- /* Initialize std streams if not dealing with sprintf family. */
CHECK_INIT (data, fp);
_flockfile (fp);
/* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
if (cantwrite (data, fp)) {
- _funlockfile (fp);
+ _funlockfile (fp);
return (EOF);
}
@@ -639,19 +532,6 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
_funlockfile (fp);
return (__sbprintf (data, fp, fmt0, ap));
}
-#else /* STRING_ONLY */
- /* Create initial buffer if we are called by asprintf family. */
- if (fp->_flags & __SMBF && !fp->_bf._base)
- {
- fp->_bf._base = fp->_p = _malloc_r (data, 64);
- if (!fp->_p)
- {
- data->_errno = ENOMEM;
- return EOF;
- }
- fp->_bf._size = 64;
- }
-#endif /* STRING_ONLY */
fmt = (char *)fmt0;
uio.uio_iov = iovp = iov;
@@ -930,7 +810,7 @@ reswitch: switch (ch) {
(wchar_t)GET_ARG (N, ap, wint_t),
&ps)) == -1) {
fp->_flags |= __SERR;
- goto error;
+ goto error;
}
}
else
@@ -1108,7 +988,7 @@ reswitch: switch (ch) {
#ifndef _NO_LONGLONG
if (flags & QUADINT)
*GET_ARG (N, ap, quad_ptr_t) = ret;
- else
+ else
#endif
if (flags & LONGINT)
*GET_ARG (N, ap, long_ptr_t) = ret;
@@ -1450,9 +1330,7 @@ done:
error:
if (malloc_buf != NULL)
_free_r (data, malloc_buf);
-#ifndef STRING_ONLY
_funlockfile (fp);
-#endif
return (__sferror (fp) ? EOF : ret);
/* NOTREACHED */
}
@@ -1614,7 +1492,7 @@ exponent(char *p0, int exp, int fmtch)
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.
-
+
The name of Red Hat Incorporated may not be used to endorse
or promote products derived from this software without specific
prior written permission.
@@ -1639,24 +1517,24 @@ typedef enum {
DOT, /* '.' */
STAR, /* '*' */
FLAG, /* format flag */
- OTHER, /* all other chars */
+ OTHER, /* all other chars */
MAX_CH_CLASS /* place-holder */
} CH_CLASS;
-typedef enum {
+typedef enum {
START, /* start */
SFLAG, /* seen a flag */
WDIG, /* seen digits in width area */
WIDTH, /* processed width */
SMOD, /* seen spec modifier */
- SDOT, /* seen dot */
+ SDOT, /* seen dot */
VARW, /* have variable width specifier */
VARP, /* have variable precision specifier */
PREC, /* processed precision */
VWDIG, /* have digits in variable width specification */
VPDIG, /* have digits in variable precision specification */
- DONE, /* done */
- MAX_STATE, /* place-holder */
+ DONE, /* done */
+ MAX_STATE, /* place-holder */
} STATE;
typedef enum {
@@ -1681,7 +1559,7 @@ _CONST static CH_CLASS chclass[256] = {
/* 30-37 */ ZERO, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT, DIGIT,
/* 38-3f */ DIGIT, DIGIT, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 40-47 */ OTHER, SPEC, OTHER, SPEC, SPEC, SPEC, SPEC, SPEC,
- /* 48-4f */ OTHER, OTHER, OTHER, OTHER, MODFR, OTHER, OTHER, SPEC,
+ /* 48-4f */ OTHER, OTHER, OTHER, OTHER, MODFR, OTHER, OTHER, SPEC,
/* 50-57 */ OTHER, OTHER, OTHER, SPEC, OTHER, SPEC, OTHER, OTHER,
/* 58-5f */ SPEC, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER,
/* 60-67 */ OTHER, SPEC, OTHER, SPEC, SPEC, SPEC, SPEC, SPEC,
@@ -1707,7 +1585,7 @@ _CONST static CH_CLASS chclass[256] = {
};
_CONST static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
- /* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
+ /* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
/* START */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE },
/* SFLAG */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE },
/* WDIG */ { DONE, DONE, WIDTH, SMOD, DONE, SDOT, DONE, DONE, DONE },
@@ -1722,7 +1600,7 @@ _CONST static STATE state_table[MAX_STATE][MAX_CH_CLASS] = {
};
_CONST static ACTION action_table[MAX_STATE][MAX_CH_CLASS] = {
- /* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
+ /* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */
/* START */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP },
/* SFLAG */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP },
/* WDIG */ { NOOP, NOOP, GETPOS, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP },
@@ -1778,10 +1656,10 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt),
while (*fmt && n >= numargs)
{
# ifdef _MB_CAPABLE
- while ((nbytes = _mbtowc_r (data, &wc, fmt, MB_CUR_MAX, &wc_state)) > 0)
+ while ((nbytes = _mbtowc_r (data, &wc, fmt, MB_CUR_MAX, &wc_state)) > 0)
{
fmt += nbytes;
- if (wc == '%')
+ if (wc == '%')
break;
}
diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c
index f56681eaa..68b55f426 100644
--- a/newlib/libc/stdio/vfscanf.c
+++ b/newlib/libc/stdio/vfscanf.c
@@ -121,35 +121,17 @@ Supporting OS subroutines required:
#define VFSCANF vfiscanf
#define _VFSCANF_R _vfiscanf_r
#define __SVFSCANF __svfiscanf
-#ifdef STRING_ONLY
-# define __SVFSCANF_R __ssvfiscanf_r
-#else
-# define __SVFSCANF_R __svfiscanf_r
-#endif
+#define __SVFSCANF_R __svfiscanf_r
#else
#define VFSCANF vfscanf
#define _VFSCANF_R _vfscanf_r
#define __SVFSCANF __svfscanf
-#ifdef STRING_ONLY
-# define __SVFSCANF_R __ssvfscanf_r
-#else
-# define __SVFSCANF_R __svfscanf_r
-#endif
+#define __SVFSCANF_R __svfscanf_r
#ifndef NO_FLOATING_POINT
#define FLOATING_POINT
#endif
#endif
-#ifdef STRING_ONLY
-#undef _flockfile
-#undef _funlockfile
-#define _flockfile(x) {}
-#define _funlockfile(x) {}
-#define _ungetc_r _sungetc_r
-#define __srefill_r __ssrefill_r
-#define _fread_r _sfread_r
-#endif
-
#ifdef FLOATING_POINT
#include <math.h>
#include <float.h>
@@ -252,8 +234,6 @@ typedef unsigned long long u_long_long;
#define BufferEmpty (fp->_r <= 0 && __srefill_r(rptr, fp))
-#ifndef STRING_ONLY
-
#ifndef _REENT_ONLY
int
@@ -287,135 +267,7 @@ _DEFUN(_VFSCANF_R, (data, fp, fmt, ap),
CHECK_INIT(data, fp);
return __SVFSCANF_R (data, fp, fmt, ap);
}
-#endif /* !STRING_ONLY */
-
-#ifdef STRING_ONLY
-/* When dealing with the sscanf family, we don't want to use the
- * regular ungetc which will drag in file I/O items we don't need.
- * So, we create our own trimmed-down version. */
-static int
-_DEFUN(_sungetc_r, (data, fp, ch),
- struct _reent *data _AND
- int c _AND
- register FILE *fp)
-{
- if (c == EOF)
- return (EOF);
- /* After ungetc, we won't be at eof anymore */
- fp->_flags &= ~__SEOF;
- c = (unsigned char) c;
-
- /*
- * If we are in the middle of ungetc'ing, just continue.
- * This may require expanding the current ungetc buffer.
- */
-
- if (HASUB (fp))
- {
- if (fp->_r >= fp->_ub._size && __submore (data, fp))
- {
- return EOF;
- }
- *--fp->_p = c;
- fp->_r++;
- return c;
- }
-
- /*
- * If we can handle this by simply backing up, do so,
- * but never replace the original character.
- * (This makes sscanf() work when scanning `const' data.)
- */
-
- if (fp->_bf._base != NULL && fp->_p > fp->_bf._base && fp->_p[-1] == c)
- {
- fp->_p--;
- fp->_r++;
- return c;
- }
-
- /*
- * Create an ungetc buffer.
- * Initially, we will use the `reserve' buffer.
- */
-
- fp->_ur = fp->_r;
- fp->_up = fp->_p;
- fp->_ub._base = fp->_ubuf;
- fp->_ub._size = sizeof (fp->_ubuf);
- fp->_ubuf[sizeof (fp->_ubuf) - 1] = c;
- fp->_p = &fp->_ubuf[sizeof (fp->_ubuf) - 1];
- fp->_r = 1;
- return c;
-}
-
-/* String only version of __srefill_r for sscanf family. */
-static int
-_DEFUN(__ssrefill_r, (ptr, fp),
- struct _reent * ptr _AND
- register FILE * fp)
-{
- /*
- * Our only hope of further input is the ungetc buffer.
- * If there is anything in that buffer to read, return.
- */
- if (HASUB (fp))
- {
- FREEUB (ptr, fp);
- if ((fp->_r = fp->_ur) != 0)
- {
- fp->_p = fp->_up;
- return 0;
- }
- }
-
- /* Otherwise we are out of character input. */
- fp->_p = fp->_bf._base;
- fp->_r = 0;
- fp->_flags &= ~__SMOD; /* buffer contents are again pristine */
- fp->_flags |= __SEOF;
- return EOF;
-}
-
-static size_t
-_DEFUN(_sfread_r, (ptr, buf, size, count, fp),
- struct _reent * ptr _AND
- _PTR buf _AND
- size_t size _AND
- size_t count _AND
- FILE * fp)
-{
- register size_t resid;
- register char *p;
- register int r;
- size_t total;
-
- if ((resid = count * size) == 0)
- return 0;
-
- total = resid;
- p = buf;
-
- while (resid > (r = fp->_r))
- {
- _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) r);
- fp->_p += r;
- fp->_r = 0;
- p += r;
- resid -= r;
- if (__ssrefill_r (ptr, fp))
- {
- /* no more input: return partial result */
- return (total - resid) / size;
- }
- }
- _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, resid);
- fp->_r -= resid;
- fp->_p += resid;
- return count;
-}
-#endif /* STRING_ONLY */
int
_DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
@@ -889,7 +741,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap),
}
else
{
- size_t r = _fread_r (rptr, (_PTR) GET_ARG (N, ap, char *), 1, width, fp);
+ size_t r = fread ((_PTR) GET_ARG (N, ap, char *), 1, width, fp);
if (r == 0)
goto input_failure;
diff --git a/newlib/libc/stdio/vsiprintf.c b/newlib/libc/stdio/vsiprintf.c
index 05d009d72..967c178e4 100644
--- a/newlib/libc/stdio/vsiprintf.c
+++ b/newlib/libc/stdio/vsiprintf.c
@@ -53,7 +53,7 @@ _DEFUN(_vsiprintf_r, (ptr, str, fmt, ap),
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = INT_MAX;
f._file = -1; /* No file. */
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
*f._p = 0;
return ret;
}
diff --git a/newlib/libc/stdio/vsiscanf.c b/newlib/libc/stdio/vsiscanf.c
index c26171acf..ffbf22e97 100644
--- a/newlib/libc/stdio/vsiscanf.c
+++ b/newlib/libc/stdio/vsiscanf.c
@@ -71,5 +71,5 @@ _DEFUN(_vsiscanf_r, (ptr, str, fmt, ap),
f._ub._base = NULL;
f._lb._base = NULL;
f._file = -1; /* No file. */
- return __ssvfiscanf_r (ptr, &f, fmt, ap);
+ return __svfiscanf_r (ptr, &f, fmt, ap);
}
diff --git a/newlib/libc/stdio/vsniprintf.c b/newlib/libc/stdio/vsniprintf.c
index f7c60e280..d1c318576 100644
--- a/newlib/libc/stdio/vsniprintf.c
+++ b/newlib/libc/stdio/vsniprintf.c
@@ -61,7 +61,7 @@ _DEFUN(_vsniprintf_r, (ptr, str, size, fmt, ap),
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
f._file = -1; /* No file. */
- ret = _svfiprintf_r (ptr, &f, fmt, ap);
+ ret = _vfiprintf_r (ptr, &f, fmt, ap);
if (ret < EOF)
ptr->_errno = EOVERFLOW;
if (size > 0)
diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c
index 641047dd3..6a26f8bea 100644
--- a/newlib/libc/stdio/vsnprintf.c
+++ b/newlib/libc/stdio/vsnprintf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1990 The Regents of the University of California.
+ * Copyright (c) 1990, 2007 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
@@ -61,7 +61,7 @@ _DEFUN(_vsnprintf_r, (ptr, str, size, fmt, ap),
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = (size > 0 ? size - 1 : 0);
f._file = -1; /* No file. */
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
if (ret < EOF)
ptr->_errno = EOVERFLOW;
if (size > 0)
diff --git a/newlib/libc/stdio/vsprintf.c b/newlib/libc/stdio/vsprintf.c
index fd052cd95..5c2600411 100644
--- a/newlib/libc/stdio/vsprintf.c
+++ b/newlib/libc/stdio/vsprintf.c
@@ -53,7 +53,7 @@ _DEFUN(_vsprintf_r, (ptr, str, fmt, ap),
f._bf._base = f._p = (unsigned char *) str;
f._bf._size = f._w = INT_MAX;
f._file = -1; /* No file. */
- ret = _svfprintf_r (ptr, &f, fmt, ap);
+ ret = _vfprintf_r (ptr, &f, fmt, ap);
*f._p = 0;
return ret;
}
diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c
index 566823add..9bb7c0c3e 100644
--- a/newlib/libc/stdio/vsscanf.c
+++ b/newlib/libc/stdio/vsscanf.c
@@ -71,5 +71,5 @@ _DEFUN(_vsscanf_r, (ptr, str, fmt, ap),
f._ub._base = NULL;
f._lb._base = NULL;
f._file = -1; /* No file. */
- return __ssvfscanf_r (ptr, &f, fmt, ap);
+ return __svfscanf_r (ptr, &f, fmt, ap);
}
diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c
index 51dcd2796..2fdfb784e 100644
--- a/newlib/libc/stdio64/ftello64.c
+++ b/newlib/libc/stdio64/ftello64.c
@@ -108,12 +108,9 @@ _DEFUN (_ftello64_r, (ptr, fp),
return -1L;
}
- /* Find offset of underlying I/O object, then adjust for buffered
- bytes. Flush a write stream, since the offset may be altered if
- the stream is appending. Do not flush a read stream, since we
- must not lose the ungetc buffer. */
- if (fp->_flags & __SWR)
- _fflush_r (ptr, fp);
+ /* Find offset of underlying I/O object, then
+ adjust for buffered bytes. */
+ _fflush_r (ptr, fp); /* may adjust seek offset on append stream */
if (fp->_flags & __SOFF)
pos = fp->_offset;
else
diff --git a/newlib/libc/stdlib/envlock.h b/newlib/libc/stdlib/envlock.h
new file mode 100644
index 000000000..9bb6a813e
--- /dev/null
+++ b/newlib/libc/stdlib/envlock.h
@@ -0,0 +1,15 @@
+/* envlock.h -- header file for env routines. */
+
+#ifndef _INCLUDE_ENVLOCK_H_
+#define _INCLUDE_ENVLOCK_H_
+
+#include <_ansi.h>
+#include <sys/reent.h>
+
+#define ENV_LOCK __env_lock(reent_ptr)
+#define ENV_UNLOCK __env_unlock(reent_ptr)
+
+void _EXFUN(__env_lock,(struct _reent *reent));
+void _EXFUN(__env_unlock,(struct _reent *reent));
+
+#endif /* _INCLUDE_ENVLOCK_H_ */
diff --git a/newlib/libc/stdlib/gdtoa-hexnan.c b/newlib/libc/stdlib/gdtoa-hexnan.c
index 189fb238d..058bbd17d 100644
--- a/newlib/libc/stdlib/gdtoa-hexnan.c
+++ b/newlib/libc/stdlib/gdtoa-hexnan.c
@@ -98,7 +98,7 @@ _DEFUN (hexnan, (sp, fpi, x0),
}
continue;
}
- if (/*(*/ c == ')') {
+ if (/*(*/ c == ')' && havedig) {
*sp = s + 1;
break;
}
diff --git a/newlib/libc/stdlib/getopt.c b/newlib/libc/stdlib/getopt.c
index 944214d5f..06e378170 100644
--- a/newlib/libc/stdlib/getopt.c
+++ b/newlib/libc/stdlib/getopt.c
@@ -83,13 +83,10 @@ Gregory Pietsch's current e-mail address:
gpietsch@comcast.net
****************************************************************************/
-#ifndef HAVE_GETOPT
-
/* include files */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define __need_getopt_newlib
#include <getopt.h>
/* macros */
@@ -103,19 +100,16 @@ typedef enum GETOPT_ORDERING_T
} GETOPT_ORDERING_T;
/* globally-defined variables */
-char *optarg = 0;
+char *optarg = NULL;
int optind = 0;
int opterr = 1;
int optopt = '?';
-/* static variables */
-static int optwhere = 0;
-
/* functions */
/* reverse_argv_elements: reverses num elements starting at argv */
static void
-reverse_argv_elements (char **argv, int num)
+reverse_argv_elements (char ** argv, int num)
{
int i;
char *tmp;
@@ -132,348 +126,281 @@ reverse_argv_elements (char **argv, int num)
static void
permute (char *const argv[], int len1, int len2)
{
- reverse_argv_elements ((char **) argv, len1);
- reverse_argv_elements ((char **) argv, len1 + len2);
- reverse_argv_elements ((char **) argv, len2);
+ reverse_argv_elements ((char **)argv, len1);
+ reverse_argv_elements ((char **)argv, len1 + len2);
+ reverse_argv_elements ((char **)argv, len2);
}
/* is_option: is this argv-element an option or the end of the option list? */
static int
is_option (char *argv_element, int only)
{
- return ((argv_element == 0)
- || (argv_element[0] == '-') || (only && argv_element[0] == '+'));
-}
-
-/* read_globals: read the values from the globals into a getopt_data
- structure */
-static void
-read_globals (struct getopt_data *data)
-{
- data->optarg = optarg;
- data->optind = optind;
- data->opterr = opterr;
- data->optopt = optopt;
- data->optwhere = optwhere;
-}
-
-/* write_globals: write the values into the globals from a getopt_data
- structure */
-static void
-write_globals (struct getopt_data *data)
-{
- optarg = data->optarg;
- optind = data->optind;
- opterr = data->opterr;
- optopt = data->optopt;
- optwhere = data->optwhere;
+ return ((argv_element == NULL)
+ || (argv_element[0] == '-') || (only && argv_element[0] == '+'));
}
/* getopt_internal: the function that does all the dirty work */
static int
getopt_internal (int argc, char *const argv[], const char *shortopts,
- const struct option *longopts, int *longind, int only,
- struct getopt_data *data)
+ const struct option *longopts, int *longind, int only)
{
GETOPT_ORDERING_T ordering = PERMUTE;
+ static size_t optwhere = 0;
size_t permute_from = 0;
int num_nonopts = 0;
int optindex = 0;
size_t match_chars = 0;
- char *possible_arg = 0;
+ char *possible_arg = NULL;
int longopt_match = -1;
int has_arg = -1;
- char *cp = 0;
+ char *cp = NULL;
int arg_next = 0;
/* first, deal with silly parameters and easy stuff */
- if (argc == 0 || argv == 0 || (shortopts == 0 && longopts == 0)
- || data->optind >= argc || argv[data->optind] == 0)
+ if (argc == 0 || argv == NULL || (shortopts == NULL && longopts == NULL))
return EOF;
- if (strcmp (argv[data->optind], "--") == 0)
+ if (optind >= argc || argv[optind] == NULL)
+ return EOF;
+ if (strcmp (argv[optind], "--") == 0)
{
- data->optind++;
+ optind++;
return EOF;
}
-
/* if this is our first time through */
- if (data->optind == 0)
- data->optind = data->optwhere = 1;
+ if (optind == 0)
+ optind = optwhere = 1;
/* define ordering */
- if (shortopts != 0 && (*shortopts == '-' || *shortopts == '+'))
+ if (shortopts != NULL && (*shortopts == '-' || *shortopts == '+'))
{
ordering = (*shortopts == '-') ? RETURN_IN_ORDER : REQUIRE_ORDER;
shortopts++;
}
else
- ordering = (getenv ("POSIXLY_CORRECT") != 0) ? REQUIRE_ORDER : PERMUTE;
+ ordering = (getenv ("POSIXLY_CORRECT") != NULL) ? REQUIRE_ORDER : PERMUTE;
/*
* based on ordering, find our next option, if we're at the beginning of
* one
*/
- if (data->optwhere == 1)
+ if (optwhere == 1)
{
switch (ordering)
- {
- default: /* shouldn't happen */
- case PERMUTE:
- permute_from = data->optind;
- num_nonopts = 0;
- while (!is_option (argv[data->optind], only))
- {
- data->optind++;
- num_nonopts++;
- }
- if (argv[data->optind] == 0)
- {
- /* no more options */
- data->optind = permute_from;
- return EOF;
- }
- else if (strcmp (argv[data->optind], "--") == 0)
- {
- /* no more options, but have to get `--' out of the way */
- permute (argv + permute_from, num_nonopts, 1);
- data->optind = permute_from + 1;
- return EOF;
- }
- break;
- case RETURN_IN_ORDER:
- if (!is_option (argv[data->optind], only))
- {
- data->optarg = argv[data->optind++];
- return (data->optopt = 1);
- }
- break;
- case REQUIRE_ORDER:
- if (!is_option (argv[data->optind], only))
- return EOF;
- break;
- }
+ {
+ case PERMUTE:
+ permute_from = optind;
+ num_nonopts = 0;
+ while (!is_option (argv[optind], only))
+ {
+ optind++;
+ num_nonopts++;
+ }
+ if (argv[optind] == NULL)
+ {
+ /* no more options */
+ optind = permute_from;
+ return EOF;
+ }
+ else if (strcmp (argv[optind], "--") == 0)
+ {
+ /* no more options, but have to get `--' out of the way */
+ permute (argv + permute_from, num_nonopts, 1);
+ optind = permute_from + 1;
+ return EOF;
+ }
+ break;
+ case RETURN_IN_ORDER:
+ if (!is_option (argv[optind], only))
+ {
+ optarg = argv[optind++];
+ return (optopt = 1);
+ }
+ break;
+ case REQUIRE_ORDER:
+ if (!is_option (argv[optind], only))
+ return EOF;
+ break;
+ }
}
/* we've got an option, so parse it */
/* first, is it a long option? */
- if (longopts != 0
- && (memcmp (argv[data->optind], "--", 2) == 0
- || (only && argv[data->optind][0] == '+')) && data->optwhere == 1)
+ if (longopts != NULL
+ && (memcmp (argv[optind], "--", 2) == 0
+ || (only && argv[optind][0] == '+')) && optwhere == 1)
{
/* handle long options */
- if (memcmp (argv[data->optind], "--", 2) == 0)
- data->optwhere = 2;
+ if (memcmp (argv[optind], "--", 2) == 0)
+ optwhere = 2;
longopt_match = -1;
- possible_arg = strchr (argv[data->optind] + data->optwhere, '=');
- if (possible_arg == 0)
- {
- /* no =, so next argv might be arg */
- match_chars = strlen (argv[data->optind]);
- possible_arg = argv[data->optind] + match_chars;
- match_chars = match_chars - data->optwhere;
- }
+ possible_arg = strchr (argv[optind] + optwhere, '=');
+ if (possible_arg == NULL)
+ {
+ /* no =, so next argv might be arg */
+ match_chars = strlen (argv[optind]);
+ possible_arg = argv[optind] + match_chars;
+ match_chars = match_chars - optwhere;
+ }
else
- match_chars = (possible_arg - argv[data->optind]) - data->optwhere;
- for (optindex = 0; longopts[optindex].name != 0; ++optindex)
- {
- if (memcmp
- (argv[data->optind] + data->optwhere, longopts[optindex].name,
- match_chars) == 0)
- {
- /* do we have an exact match? */
- if (match_chars == (int) (strlen (longopts[optindex].name)))
- {
- longopt_match = optindex;
- break;
- }
- /* do any characters match? */
- else
- {
- if (longopt_match < 0)
- longopt_match = optindex;
- else
- {
- /* we have ambiguous options */
- if (data->opterr)
- fprintf (stderr, "%s: option `%s' is ambiguous "
- "(could be `--%s' or `--%s')\n",
- argv[0],
- argv[data->optind],
- longopts[longopt_match].name,
- longopts[optindex].name);
- return (data->optopt = '?');
- }
- }
- }
- }
+ match_chars = (possible_arg - argv[optind]) - optwhere;
+ for (optindex = 0; longopts[optindex].name != NULL; optindex++)
+ {
+ if (memcmp (argv[optind] + optwhere,
+ longopts[optindex].name, match_chars) == 0)
+ {
+ /* do we have an exact match? */
+ if (match_chars == (int) (strlen (longopts[optindex].name)))
+ {
+ longopt_match = optindex;
+ break;
+ }
+ /* do any characters match? */
+ else
+ {
+ if (longopt_match < 0)
+ longopt_match = optindex;
+ else
+ {
+ /* we have ambiguous options */
+ if (opterr)
+ fprintf (stderr, "%s: option `%s' is ambiguous "
+ "(could be `--%s' or `--%s')\n",
+ argv[0],
+ argv[optind],
+ longopts[longopt_match].name,
+ longopts[optindex].name);
+ return (optopt = '?');
+ }
+ }
+ }
+ }
if (longopt_match >= 0)
- has_arg = longopts[longopt_match].has_arg;
+ has_arg = longopts[longopt_match].has_arg;
}
-
/* if we didn't find a long option, is it a short option? */
- if (longopt_match < 0 && shortopts != 0)
+ if (longopt_match < 0 && shortopts != NULL)
{
- cp = strchr (shortopts, argv[data->optind][data->optwhere]);
- if (cp == 0)
- {
- /* couldn't find option in shortopts */
- if (data->opterr)
- fprintf (stderr,
- "%s: invalid option -- `-%c'\n",
- argv[0], argv[data->optind][data->optwhere]);
- data->optwhere++;
- if (argv[data->optind][data->optwhere] == '\0')
- {
- data->optind++;
- data->optwhere = 1;
- }
- return (data->optopt = '?');
- }
+ cp = strchr (shortopts, argv[optind][optwhere]);
+ if (cp == NULL)
+ {
+ /* couldn't find option in shortopts */
+ if (opterr)
+ fprintf (stderr,
+ "%s: invalid option -- `-%c'\n",
+ argv[0], argv[optind][optwhere]);
+ optwhere++;
+ if (argv[optind][optwhere] == '\0')
+ {
+ optind++;
+ optwhere = 1;
+ }
+ return (optopt = '?');
+ }
has_arg = ((cp[1] == ':')
- ? ((cp[2] == ':') ? OPTIONAL_ARG : REQUIRED_ARG) : NO_ARG);
- possible_arg = argv[data->optind] + data->optwhere + 1;
- data->optopt = *cp;
+ ? ((cp[2] == ':') ? OPTIONAL_ARG : REQUIRED_ARG) : NO_ARG);
+ possible_arg = argv[optind] + optwhere + 1;
+ optopt = *cp;
}
-
- /* get argument and reset data->optwhere */
+ /* get argument and reset optwhere */
arg_next = 0;
switch (has_arg)
{
case OPTIONAL_ARG:
if (*possible_arg == '=')
- possible_arg++;
- data->optarg = (*possible_arg != '\0') ? possible_arg : 0;
- data->optwhere = 1;
+ possible_arg++;
+ if (*possible_arg != '\0')
+ {
+ optarg = possible_arg;
+ optwhere = 1;
+ }
+ else
+ optarg = NULL;
break;
case REQUIRED_ARG:
if (*possible_arg == '=')
- possible_arg++;
+ possible_arg++;
if (*possible_arg != '\0')
- {
- data->optarg = possible_arg;
- data->optwhere = 1;
- }
- else if (data->optind + 1 >= argc)
- {
- if (data->opterr)
- {
- fprintf (stderr, "%s: argument required for option `", argv[0]);
- if (longopt_match >= 0)
- fprintf (stderr, "--%s'\n", longopts[longopt_match].name);
- else
- fprintf (stderr, "-%c'\n", *cp);
- }
- data->optind++;
- return (data->optopt = ':');
- }
+ {
+ optarg = possible_arg;
+ optwhere = 1;
+ }
+ else if (optind + 1 >= argc)
+ {
+ if (opterr)
+ {
+ fprintf (stderr, "%s: argument required for option `", argv[0]);
+ if (longopt_match >= 0)
+ fprintf (stderr, "--%s'\n", longopts[longopt_match].name);
+ else
+ fprintf (stderr, "-%c'\n", *cp);
+ }
+ optind++;
+ return (optopt = ':');
+ }
else
- {
- data->optarg = argv[data->optind + 1];
- arg_next = 1;
- data->optwhere = 1;
- }
+ {
+ optarg = argv[optind + 1];
+ arg_next = 1;
+ optwhere = 1;
+ }
break;
- default: /* shouldn't happen */
case NO_ARG:
if (longopt_match < 0)
- {
- data->optwhere++;
- if (argv[data->optind][data->optwhere] == '\0')
- data->optwhere = 1;
- }
+ {
+ optwhere++;
+ if (argv[optind][optwhere] == '\0')
+ optwhere = 1;
+ }
else
- data->optwhere = 1;
- data->optarg = 0;
+ optwhere = 1;
+ optarg = NULL;
break;
}
- /* do we have to permute or otherwise modify data->optind? */
- if (ordering == PERMUTE && data->optwhere == 1 && num_nonopts != 0)
+ /* do we have to permute or otherwise modify optind? */
+ if (ordering == PERMUTE && optwhere == 1 && num_nonopts != 0)
{
permute (argv + permute_from, num_nonopts, 1 + arg_next);
- data->optind = permute_from + 1 + arg_next;
+ optind = permute_from + 1 + arg_next;
}
- else if (data->optwhere == 1)
- data->optind = data->optind + 1 + arg_next;
+ else if (optwhere == 1)
+ optind = optind + 1 + arg_next;
/* finally return */
if (longopt_match >= 0)
{
- if (longind != 0)
- *longind = longopt_match;
- if (longopts[longopt_match].flag != 0)
- {
- *(longopts[longopt_match].flag) = longopts[longopt_match].val;
- return 0;
- }
+ if (longind != NULL)
+ *longind = longopt_match;
+ if (longopts[longopt_match].flag != NULL)
+ {
+ *(longopts[longopt_match].flag) = longopts[longopt_match].val;
+ return 0;
+ }
else
- return longopts[longopt_match].val;
+ return longopts[longopt_match].val;
}
else
- return data->optopt;
+ return optopt;
}
int
getopt (int argc, char *const argv[], const char *optstring)
{
- struct getopt_data data;
- int r;
-
- read_globals (&data);
- r = getopt_internal (argc, argv, optstring, 0, 0, 0, &data);
- write_globals (&data);
- return r;
+ return getopt_internal (argc, argv, optstring, NULL, NULL, 0);
}
int
getopt_long (int argc, char *const argv[], const char *shortopts,
- const struct option *longopts, int *longind)
+ const struct option *longopts, int *longind)
{
- struct getopt_data data;
- int r;
-
- read_globals (&data);
- r = getopt_internal (argc, argv, shortopts, longopts, longind, 0, &data);
- write_globals (&data);
- return r;
+ return getopt_internal (argc, argv, shortopts, longopts, longind, 0);
}
int
getopt_long_only (int argc, char *const argv[], const char *shortopts,
- const struct option *longopts, int *longind)
-{
- struct getopt_data data;
- int r;
-
- read_globals (&data);
- r = getopt_internal (argc, argv, shortopts, longopts, longind, 1, &data);
- write_globals (&data);
- return r;
-}
-
-int
-__getopt_r (int argc, char *const argv[], const char *optstring,
- struct getopt_data *data)
-{
- return getopt_internal (argc, argv, optstring, 0, 0, 0, data);
-}
-
-int
-__getopt_long_r (int argc, char *const argv[], const char *shortopts,
- const struct option *longopts, int *longind,
- struct getopt_data *data)
-{
- return getopt_internal (argc, argv, shortopts, longopts, longind, 0, data);
-}
-
-int
-__getopt_long_only_r (int argc, char *const argv[], const char *shortopts,
- const struct option *longopts, int *longind,
- struct getopt_data *data)
+ const struct option *longopts, int *longind)
{
- return getopt_internal (argc, argv, shortopts, longopts, longind, 1, data);
+ return getopt_internal (argc, argv, shortopts, longopts, longind, 1);
}
-#endif /* !HAVE_GETOPT */
-
/* end of file GETOPT.C */
diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h
index dea89bf11..498de5b74 100644
--- a/newlib/libc/stdlib/mprec.h
+++ b/newlib/libc/stdlib/mprec.h
@@ -78,18 +78,31 @@ union double_union
#define word1(x) (x.i[1])
#endif
-/* The following is taken from gdtoaimp.h for use with new strtod, but
- adjusted to avoid invalid type-punning. */
+
+/* The following is taken from gdtoaimp.h for use with new strtod. */
typedef __int32_t Long;
+typedef union { double d; __ULong L[2]; } U;
-/* Unfortunately, because __ULong might be a different type than
- __uint32_t, we can't re-use union double_union as-is without
- further edits in strtod.c. */
-typedef union { double d; __ULong i[2]; } U;
+#ifdef YES_ALIAS
+#define dval(x) x
+#ifdef IEEE_8087
+#define dword0(x) ((__ULong *)&x)[1]
+#define dword1(x) ((__ULong *)&x)[0]
+#else
+#define dword0(x) ((__ULong *)&x)[0]
+#define dword1(x) ((__ULong *)&x)[1]
+#endif
+#else /* !YES_ALIAS */
+#ifdef IEEE_8087
+#define dword0(x) ((U*)&x)->L[1]
+#define dword1(x) ((U*)&x)->L[0]
+#else
+#define dword0(x) ((U*)&x)->L[0]
+#define dword1(x) ((U*)&x)->L[1]
+#endif
+#define dval(x) ((U*)&x)->d
+#endif /* YES_ALIAS */
-#define dword0(x) word0(x)
-#define dword1(x) word1(x)
-#define dval(x) (x.d)
#undef SI
#ifdef Sudden_Underflow
@@ -98,7 +111,17 @@ typedef union { double d; __ULong i[2]; } U;
#define SI 0
#endif
-#define Storeinc(a,b,c) (*(a)++ = (b) << 16 | (c) & 0xffff)
+/* The following definition of Storeinc is appropriate for MIPS processors.
+ * An alternative that might be better on some machines is
+ * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
+ */
+#if defined (__IEEE_BYTES_LITTLE_ENDIAN) + defined (IEEE_8087) + defined (VAX)
+#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \
+((unsigned short *)a)[0] = (unsigned short)c, a++)
+#else
+#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \
+((unsigned short *)a)[1] = (unsigned short)c, a++)
+#endif
/* #define P DBL_MANT_DIG */
/* Ten_pmax = floor(P*log(2)/log(5)) */
@@ -144,7 +167,11 @@ typedef union { double d; __ULong i[2]; } U;
#define word0(x) (x.i[0])
#define word1(x) 0
-#define dword0(x) word0(x)
+#ifdef YES_ALIAS
+#define dword0(x) ((__ULong *)&x)[0]
+#else
+#define dword0(x) ((U*)&x)->L[0]
+#endif
#define dword1(x) 0
#else
diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c
index 703fbce1d..e206d0587 100644
--- a/newlib/libc/stdlib/strtod.c
+++ b/newlib/libc/stdlib/strtod.c
@@ -14,7 +14,7 @@ ANSI_SYNOPSIS
double strtod(const char *<[str]>, char **<[tail]>);
float strtof(const char *<[str]>, char **<[tail]>);
- double _strtod_r(void *<[reent]>,
+ double _strtod_r(void *<[reent]>,
const char *<[str]>, char **<[tail]>);
TRAD_SYNOPSIS
@@ -37,19 +37,12 @@ DESCRIPTION
producing a substring which can be converted to a double
value. The substring converted is the longest initial
subsequence of <[str]>, beginning with the first
- non-whitespace character, that has one of these formats:
- .[+|-]<[digits]>[.[<[digits]>]][(e|E)[+|-]<[digits]>]
- .[+|-].<[digits]>[(e|E)[+|-]<[digits]>]
- .[+|-](i|I)(n|N)(f|F)[(i|I)(n|N)(i|I)(t|T)(y|Y)]
- .[+|-](n|N)(a|A)(n|N)[<(>[<[hexdigits]>]<)>]
- .[+|-]0(x|X)<[hexdigits]>[.[<[hexdigits]>]][(p|P)[+|-]<[digits]>]
- .[+|-]0(x|X).<[hexdigits]>[(p|P)[+|-]<[digits]>]
+ non-whitespace character, that has the format:
+ .[+|-]<[digits]>[.][<[digits]>][(e|E)[+|-]<[digits]>]
The substring contains no characters if <[str]> is empty, consists
entirely of whitespace, or if the first non-whitespace
character is something other than <<+>>, <<->>, <<.>>, or a
- digit, and cannot be parsed as infinity or NaN. If the platform
- does not support NaN, then NaN is treated as an empty substring.
- If the substring is empty, no conversion is done, and
+ digit. If the substring is empty, no conversion is done, and
the value of <[str]> is stored in <<*<[tail]>>>. Otherwise,
the substring is converted, and a pointer to the final string
(which will contain at least the terminating null character of
@@ -59,8 +52,7 @@ DESCRIPTION
This implementation returns the nearest machine number to the
input decimal string. Ties are broken by using the IEEE
- round-even rule. However, <<strtof>> is currently subject to
- double rounding errors.
+ round-even rule.
The alternate function <<_strtod_r>> is a reentrant version.
The extra argument <[reent]> is a pointer to a reentrancy structure.
@@ -184,7 +176,7 @@ _DEFUN (ULtod, (L, bits, exp, k),
L[_0] |= 0x80000000L;
}
#endif /* !NO_HEX_FP */
-
+
#ifdef INFNAN_CHECK
static int
_DEFUN (match, (sp, t),
@@ -218,8 +210,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign,
e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign;
_CONST char *s, *s0, *s1;
- double aadj, adj;
- U aadj1, rv, rv0;
+ double aadj, aadj1, adj, rv, rv0;
Long L;
__ULong y, z;
_Bigint *bb, *bb1, *bd, *bd0, *bs, *delta;
@@ -263,9 +254,6 @@ _DEFUN (_strtod_r, (ptr, s00, se),
switch(s[1]) {
case 'x':
case 'X':
- /* If the number is not hex, then the parse of
- 0 is still valid. */
- s00 = s + 1;
{
#if defined(FE_DOWNWARD) && defined(FE_TONEAREST) && defined(FE_TOWARDZERO) && defined(FE_UPWARD)
FPI fpi1 = fpi;
@@ -280,6 +268,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
switch((i = gethex(ptr, &s, &fpi1, &exp, &bb, sign)) & STRTOG_Retmask) {
case STRTOG_NoNumber:
s = s00;
+ sign = 0;
case STRTOG_Zero:
break;
default:
@@ -287,7 +276,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
copybits(bits, fpi.nbits, bb);
Bfree(ptr,bb);
}
- ULtod(rv.i, bits, exp, i);
+ ULtod(((U*)&rv)->L, bits, exp, i);
}}
goto ret;
}
@@ -470,7 +459,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
#ifdef Honor_FLT_ROUNDS
/* round correctly FLT_ROUNDS = 2 or 3 */
if (sign) {
- dval(rv) = -dval(rv);
+ rv = -rv;
sign = 0;
}
#endif
@@ -486,7 +475,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
#ifdef Honor_FLT_ROUNDS
/* round correctly FLT_ROUNDS = 2 or 3 */
if (sign) {
- dval(rv) = -dval(rv);
+ rv = -rv;
sign = 0;
}
#endif
@@ -514,7 +503,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
#ifdef Honor_FLT_ROUNDS
/* round correctly FLT_ROUNDS = 2 or 3 */
if (sign) {
- dval(rv) = -dval(rv);
+ rv = -rv;
sign = 0;
}
#endif
@@ -977,14 +966,14 @@ _DEFUN (_strtod_r, (ptr, s00, se),
}
if ((aadj = ratio(delta, bs)) <= 2.) {
if (dsign)
- aadj = dval(aadj1) = 1.;
+ aadj = aadj1 = 1.;
else if (dword1(rv) || dword0(rv) & Bndry_mask) {
#ifndef Sudden_Underflow
if (dword1(rv) == Tiny1 && !dword0(rv))
goto undfl;
#endif
aadj = 1.;
- dval(aadj1) = -1.;
+ aadj1 = -1.;
}
else {
/* special case -- power of FLT_RADIX to be */
@@ -994,24 +983,24 @@ _DEFUN (_strtod_r, (ptr, s00, se),
aadj = 1./FLT_RADIX;
else
aadj *= 0.5;
- dval(aadj1) = -aadj;
+ aadj1 = -aadj;
}
}
else {
aadj *= 0.5;
- dval(aadj1) = dsign ? aadj : -aadj;
+ aadj1 = dsign ? aadj : -aadj;
#ifdef Check_FLT_ROUNDS
switch(Rounding) {
case 2: /* towards +infinity */
- dval(aadj1) -= 0.5;
+ aadj1 -= 0.5;
break;
case 0: /* towards 0 */
case 3: /* towards -infinity */
- dval(aadj1) += 0.5;
+ aadj1 += 0.5;
}
#else
if (Flt_Rounds == 0)
- dval(aadj1) += 0.5;
+ aadj1 += 0.5;
#endif /*Check_FLT_ROUNDS*/
}
y = dword0(rv) & Exp_mask;
@@ -1021,7 +1010,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) {
dval(rv0) = dval(rv);
dword0(rv) -= P*Exp_msk1;
- adj = dval(aadj1) * ulp(dval(rv));
+ adj = aadj1 * ulp(dval(rv));
dval(rv) += adj;
if ((dword0(rv) & Exp_mask) >=
Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
@@ -1043,18 +1032,18 @@ _DEFUN (_strtod_r, (ptr, s00, se),
if ((z = aadj) <= 0)
z = 1;
aadj = z;
- dval(aadj1) = dsign ? aadj : -aadj;
+ aadj1 = dsign ? aadj : -aadj;
}
dword0(aadj1) += (2*P+1)*Exp_msk1 - y;
}
- adj = dval(aadj1) * ulp(dval(rv));
+ adj = aadj1 * ulp(dval(rv));
dval(rv) += adj;
#else
#ifdef Sudden_Underflow
if ((dword0(rv) & Exp_mask) <= P*Exp_msk1) {
dval(rv0) = dval(rv);
dword0(rv) += P*Exp_msk1;
- adj = dval(aadj1) * ulp(dval(rv));
+ adj = aadj1 * ulp(dval(rv));
dval(rv) += adj;
#ifdef IBM
if ((dword0(rv) & Exp_mask) < P*Exp_msk1)
@@ -1077,7 +1066,7 @@ _DEFUN (_strtod_r, (ptr, s00, se),
dword0(rv) -= P*Exp_msk1;
}
else {
- adj = dval(aadj1) * ulp(dval(rv));
+ adj = aadj1 * ulp(dval(rv));
dval(rv) += adj;
}
#else /*Sudden_Underflow*/
@@ -1089,11 +1078,11 @@ _DEFUN (_strtod_r, (ptr, s00, se),
* example: 1.2e-307 .
*/
if (y <= (P-1)*Exp_msk1 && aadj > 1.) {
- dval(aadj1) = (double)(int)(aadj + 0.5);
+ aadj1 = (double)(int)(aadj + 0.5);
if (!dsign)
- dval(aadj1) = -dval(aadj1);
+ aadj1 = -aadj1;
}
- adj = dval(aadj1) * ulp(dval(rv));
+ adj = aadj1 * ulp(dval(rv));
dval(rv) += adj;
#endif /*Sudden_Underflow*/
#endif /*Avoid_Underflow*/
diff --git a/newlib/libc/stdlib/wcsrtombs.c b/newlib/libc/stdlib/wcsrtombs.c
index a16d36cf6..6871d0c00 100644
--- a/newlib/libc/stdlib/wcsrtombs.c
+++ b/newlib/libc/stdlib/wcsrtombs.c
@@ -45,7 +45,7 @@ _DEFUN (_wcsrtombs_r, (r, dst, src, len, ps),
ps->__count = 0;
return (size_t)-1;
}
- if (n + bytes <= len)
+ if (n <= len - bytes && bytes < len)
{
n += bytes;
if (dst)
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index 2e7f1fca4..65200cf22 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -72,9 +72,9 @@ GENERAL_SOURCES = \
wmemset.c
if ELIX_LEVEL_1
-ELIX_2_SOURCES =
+ELIX_SOURCES =
else
-ELIX_2_SOURCES = \
+ELIX_SOURCES = \
bcmp.c \
memccpy.c \
mempcpy.c \
@@ -84,33 +84,18 @@ ELIX_2_SOURCES = \
strcasestr.c \
strndup_r.c \
wcpcpy.c \
- wcpncpy.c
-endif !ELIX_LEVEL_1
-
-if ELIX_LEVEL_1
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_3
-ELIX_4_SOURCES =
-else
-ELIX_4_SOURCES = \
- memmem.c
-endif !ELIX_LEVEL_3
-endif !ELIX_LEVEL_2
-endif !ELIX_LEVEL_1
+ wcpncpy.c \
+endif
libstring_la_LDFLAGS = -Xcompiler -nostdlib
if USE_LIBTOOL
noinst_LTLIBRARIES = libstring.la
-libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
noinst_DATA = objectlist.awk.in
else
noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
lib_a_CFLAGS = $(AM_CFLAGS)
noinst_DATA =
endif # USE_LIBTOOL
@@ -132,8 +117,7 @@ wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
wcsrchr.def wcsspn.def wcsstr.def \
wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \
-wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \
-memmem.def
+wmemcmp.def wmemcpy.def wmemmove.def wmemset.def
SUFFIXES = .def
diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in
index 1c7dfe0cd..16434a87b 100644
--- a/newlib/libc/string/Makefile.in
+++ b/newlib/libc/string/Makefile.in
@@ -46,7 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.m4 $(top_srcdir)/../acinclude.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/../confsubdir.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
@@ -98,32 +98,30 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-strndup_r.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-wcpcpy.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-wcpncpy.$(OBJEXT)
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_3 = lib_a-memmem.$(OBJEXT)
@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
-@USE_LIBTOOL_FALSE@ $(am__objects_2) $(am__objects_3)
+@USE_LIBTOOL_FALSE@ $(am__objects_2)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libstring_la_LIBADD =
-am__objects_4 = bcopy.lo bzero.lo index.lo memchr.lo memcmp.lo \
+am__objects_3 = bcopy.lo bzero.lo index.lo memchr.lo memcmp.lo \
memcpy.lo memmove.lo memset.lo rindex.lo strcasecmp.lo \
- strcat.lo strchr.lo strcmp.lo strcoll.lo strcpy.lo strcspn.lo \
- strdup.lo strdup_r.lo strerror.lo strerror_r.lo strlcat.lo \
- strlcpy.lo strlen.lo strlwr.lo strncasecmp.lo strncat.lo \
- strncmp.lo strncpy.lo strnlen.lo strpbrk.lo strrchr.lo \
- strsep.lo strspn.lo strtok.lo strtok_r.lo strupr.lo strxfrm.lo \
- strstr.lo swab.lo u_strerr.lo wcscat.lo wcschr.lo wcscmp.lo \
- wcscoll.lo wcscpy.lo wcscspn.lo wcslcat.lo wcslcpy.lo \
- wcslen.lo wcsncat.lo wcsncmp.lo wcsncpy.lo wcsnlen.lo \
- wcspbrk.lo wcsrchr.lo wcsspn.lo wcsstr.lo wcswidth.lo \
- wcsxfrm.lo wcwidth.lo wmemchr.lo wmemcmp.lo wmemcpy.lo \
- wmemmove.lo wmemset.lo
-@ELIX_LEVEL_1_FALSE@am__objects_5 = bcmp.lo memccpy.lo mempcpy.lo \
+ strcat.lo strchr.lo strcmp.lo strcoll.lo strcpy.lo \
+ strcspn.lo strdup.lo strdup_r.lo strerror.lo strerror_r.lo \
+ strlcat.lo strlcpy.lo strlen.lo strlwr.lo strncasecmp.lo \
+ strncat.lo strncmp.lo strncpy.lo strnlen.lo strpbrk.lo \
+ strrchr.lo strsep.lo strspn.lo strtok.lo strtok_r.lo \
+ strupr.lo strxfrm.lo strstr.lo swab.lo u_strerr.lo wcscat.lo \
+ wcschr.lo wcscmp.lo wcscoll.lo wcscpy.lo wcscspn.lo \
+ wcslcat.lo wcslcpy.lo wcslen.lo wcsncat.lo wcsncmp.lo \
+ wcsncpy.lo wcsnlen.lo wcspbrk.lo wcsrchr.lo wcsspn.lo wcsstr.lo \
+ wcswidth.lo wcsxfrm.lo wcwidth.lo wmemchr.lo wmemcmp.lo \
+ wmemcpy.lo wmemmove.lo wmemset.lo
+@ELIX_LEVEL_1_FALSE@am__objects_4 = bcmp.lo memccpy.lo mempcpy.lo \
@ELIX_LEVEL_1_FALSE@ stpcpy.lo stpncpy.lo strndup.lo \
@ELIX_LEVEL_1_FALSE@ strcasestr.lo strndup_r.lo wcpcpy.lo \
@ELIX_LEVEL_1_FALSE@ wcpncpy.lo
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_6 = memmem.lo
-@USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_4) \
-@USE_LIBTOOL_TRUE@ $(am__objects_5) $(am__objects_6)
+@USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_3) \
+@USE_LIBTOOL_TRUE@ $(am__objects_4)
libstring_la_OBJECTS = $(am_libstring_la_OBJECTS)
@USE_LIBTOOL_TRUE@am_libstring_la_rpath =
DEFAULT_INCLUDES = -I. -I$(srcdir)
@@ -368,32 +366,26 @@ GENERAL_SOURCES = \
wmemmove.c \
wmemset.c
-@ELIX_LEVEL_1_FALSE@ELIX_2_SOURCES = \
+@ELIX_LEVEL_1_FALSE@ELIX_SOURCES = \
@ELIX_LEVEL_1_FALSE@ bcmp.c \
-@ELIX_LEVEL_1_FALSE@ memccpy.c \
-@ELIX_LEVEL_1_FALSE@ mempcpy.c \
@ELIX_LEVEL_1_FALSE@ stpcpy.c \
@ELIX_LEVEL_1_FALSE@ stpncpy.c \
+@ELIX_LEVEL_1_FALSE@ memccpy.c \
+@ELIX_LEVEL_1_FALSE@ mempcpy.c \
@ELIX_LEVEL_1_FALSE@ strndup.c \
@ELIX_LEVEL_1_FALSE@ strcasestr.c \
@ELIX_LEVEL_1_FALSE@ strndup_r.c \
@ELIX_LEVEL_1_FALSE@ wcpcpy.c \
@ELIX_LEVEL_1_FALSE@ wcpncpy.c
-@ELIX_LEVEL_1_TRUE@ELIX_2_SOURCES =
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ELIX_4_SOURCES = \
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ memmem.c
-
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_4_SOURCES =
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_4_SOURCES =
-@ELIX_LEVEL_1_TRUE@ELIX_4_SOURCES =
+@ELIX_LEVEL_1_TRUE@ELIX_SOURCES =
libstring_la_LDFLAGS = -Xcompiler -nostdlib
@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libstring.la
-@USE_LIBTOOL_TRUE@libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+@USE_LIBTOOL_TRUE@libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
@USE_LIBTOOL_FALSE@noinst_DATA =
@USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in
@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
-@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
@USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
CHEWOUT_FILES = \
bcmp.def memcpy.def strcmp.def strncat.def strstr.def \
@@ -410,8 +402,7 @@ wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
wcsrchr.def wcsspn.def wcsstr.def \
wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \
-wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \
-memmem.def
+wmemcmp.def wmemcpy.def wmemmove.def wmemset.def
SUFFIXES = .def
CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str
@@ -934,12 +925,6 @@ lib_a-wcpncpy.o: wcpncpy.c
lib_a-wcpncpy.obj: wcpncpy.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcpncpy.obj `if test -f 'wcpncpy.c'; then $(CYGPATH_W) 'wcpncpy.c'; else $(CYGPATH_W) '$(srcdir)/wcpncpy.c'; fi`
-lib_a-memmem.o: memmem.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmem.o `test -f 'memmem.c' || echo '$(srcdir)/'`memmem.c
-
-lib_a-memmem.obj: memmem.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmem.obj `if test -f 'memmem.c'; then $(CYGPATH_W) 'memmem.c'; else $(CYGPATH_W) '$(srcdir)/memmem.c'; fi`
-
mostlyclean-libtool:
-rm -f *.lo
diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c
index 13ed88186..7c1a584b7 100644
--- a/newlib/libc/string/memchr.c
+++ b/newlib/libc/string/memchr.c
@@ -20,7 +20,7 @@ DESCRIPTION
This function searches memory starting at <<*<[src]>>> for the
character <[c]>. The search only ends with the first
occurrence of <[c]>, or after <[length]> characters; in
- particular, <<NUL>> does not terminate the search.
+ particular, <<NULL>> does not terminate the search.
RETURNS
If the character <[c]> is found within <[length]> characters
@@ -64,9 +64,6 @@ QUICKREF
#error long int is not a 32bit or 64bit byte
#endif
-/* DETECTCHAR returns nonzero if (long)X contains the byte used
- to fill (long)MASK. */
-#define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK))
_PTR
_DEFUN (memchr, (src_void, c, length),
@@ -74,61 +71,73 @@ _DEFUN (memchr, (src_void, c, length),
int c _AND
size_t length)
{
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
_CONST unsigned char *src = (_CONST unsigned char *) src_void;
- unsigned char d = c;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
- unsigned long *asrc;
- unsigned long mask;
- int i;
-
- while (UNALIGNED (src))
+ c &= 0xff;
+
+ while (length--)
{
- if (!length--)
- return NULL;
- if (*src == d)
- return (void *) src;
+ if (*src == c)
+ return (char *) src;
src++;
}
+ return NULL;
+#else
+ _CONST unsigned char *src = (_CONST unsigned char *) src_void;
+ unsigned long *asrc;
+ unsigned long buffer;
+ unsigned long mask;
+ int i, j;
- if (!TOO_SMALL (length))
+ c &= 0xff;
+
+ /* If the size is small, or src is unaligned, then
+ use the bytewise loop. We can hope this is rare. */
+ if (!TOO_SMALL (length) && !UNALIGNED (src))
{
- /* If we get this far, we know that length is large and src is
- word-aligned. */
- /* The fast code reads the source one word at a time and only
+ /* The fast code reads the ASCII one word at a time and only
performs the bytewise search on word-sized segments if they
- contain the search character, which is detected by XORing
+ contain the search character, which is detected by XORing
the word-sized segment with a word-sized block of the search
- character and then detecting for the presence of NUL in the
+ character and then detecting for the presence of NULL in the
result. */
- asrc = (unsigned long *) src;
- mask = d << 8 | d;
- mask = mask << 16 | mask;
- for (i = 32; i < LBLOCKSIZE * 8; i <<= 1)
- mask = (mask << i) | mask;
+ asrc = (unsigned long*) src;
+ mask = 0;
+ for (i = 0; i < LBLOCKSIZE; i++)
+ mask = (mask << 8) + c;
while (length >= LBLOCKSIZE)
{
- if (DETECTCHAR (*asrc, mask))
- break;
+ buffer = *asrc;
+ buffer ^= mask;
+ if (DETECTNULL (buffer))
+ {
+ src = (unsigned char*) asrc;
+ for ( j = 0; j < LBLOCKSIZE; j++ )
+ {
+ if (*src == c)
+ return (char*) src;
+ src++;
+ }
+ }
length -= LBLOCKSIZE;
asrc++;
}
-
+
/* If there are fewer than LBLOCKSIZE characters left,
then we resort to the bytewise loop. */
- src = (unsigned char *) asrc;
+ src = (unsigned char*) asrc;
}
-#endif /* not PREFER_SIZE_OVER_SPEED */
-
while (length--)
- {
- if (*src == d)
- return (void *) src;
+ {
+ if (*src == c)
+ return (char*) src;
src++;
- }
+ }
return NULL;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/memmem.c b/newlib/libc/string/memmem.c
deleted file mode 100644
index 25704e467..000000000
--- a/newlib/libc/string/memmem.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Byte-wise substring search, using the Two-Way algorithm.
- * Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-/*
-FUNCTION
- <<memmem>>---find memory segment
-
-INDEX
- memmem
-
-ANSI_SYNOPSIS
- #include <string.h>
- char *memmem(const void *<[s1]>, size_t <[l1]>, const void *<[s2]>,
- size_t <[l2]>);
-
-DESCRIPTION
-
- Locates the first occurrence in the memory region pointed to
- by <[s1]> with length <[l1]> of the sequence of bytes pointed
- to by <[s2]> of length <[l2]>. If you already know the
- lengths of your haystack and needle, <<memmem>> can be much
- faster than <<strstr>>.
-
-RETURNS
- Returns a pointer to the located segment, or a null pointer if
- <[s2]> is not found. If <[l2]> is 0, <[s1]> is returned.
-
-PORTABILITY
-<<memmem>> is a newlib extension.
-
-<<memmem>> requires no supporting OS subroutines.
-
-QUICKREF
- memmem pure
-*/
-
-#include <string.h>
-
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-# define RETURN_TYPE void *
-# define AVAILABLE(h, h_l, j, n_l) ((j) <= (h_l) - (n_l))
-# include "str-two-way.h"
-#endif
-
-void *
-_DEFUN (memmem, (haystack_start, haystack_len, needle_start, needle_len),
- const void *haystack_start _AND
- size_t haystack_len _AND
- const void *needle_start _AND
- size_t needle_len)
-{
- /* Abstract memory is considered to be an array of 'unsigned char' values,
- not an array of 'char' values. See ISO C 99 section 6.2.6.1. */
- const unsigned char *haystack = (const unsigned char *) haystack_start;
- const unsigned char *needle = (const unsigned char *) needle_start;
-
- if (needle_len == 0)
- /* The first occurrence of the empty string is deemed to occur at
- the beginning of the string. */
- return (void *) haystack;
-
-#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
-
- /* Less code size, but quadratic performance in the worst case. */
- while (needle_len <= haystack_len)
- {
- if (!memcmp (haystack, needle, needle_len))
- return (void *) haystack;
- haystack++;
- haystack_len--;
- }
- return NULL;
-
-#else /* compilation for speed */
-
- /* Larger code size, but guaranteed linear performance. */
-
- /* Sanity check, otherwise the loop might search through the whole
- memory. */
- if (haystack_len < needle_len)
- return NULL;
-
- /* Use optimizations in memchr when possible, to reduce the search
- size of haystack using a linear algorithm with a smaller
- coefficient. However, avoid memchr for long needles, since we
- can often achieve sublinear performance. */
- if (needle_len < LONG_NEEDLE_THRESHOLD)
- {
- haystack = memchr (haystack, *needle, haystack_len);
- if (!haystack || needle_len == 1)
- return (void *) haystack;
- haystack_len -= haystack - (const unsigned char *) haystack_start;
- if (haystack_len < needle_len)
- return NULL;
- return two_way_short_needle (haystack, haystack_len, needle, needle_len);
- }
- return two_way_long_needle (haystack, haystack_len, needle, needle_len);
-#endif /* compilation for speed */
-}
diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c
index 55d2ce180..ac3590ea4 100644
--- a/newlib/libc/string/memset.c
+++ b/newlib/libc/string/memset.c
@@ -7,7 +7,7 @@ INDEX
ANSI_SYNOPSIS
#include <string.h>
- void *memset(void *<[dst]>, int <[c]>, size_t <[length]>);
+ void *memset(const void *<[dst]>, int <[c]>, size_t <[length]>);
TRAD_SYNOPSIS
#include <string.h>
@@ -22,7 +22,7 @@ DESCRIPTION
pointed to by <[dst]> to the value.
RETURNS
- <<memset>> returns the value of <[dst]>.
+ <<memset>> returns the value of <[m]>.
PORTABILITY
<<memset>> is ANSI C.
@@ -39,42 +39,48 @@ QUICKREF
#define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1))
#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE)
-_PTR
+_PTR
_DEFUN (memset, (m, c, n),
_PTR m _AND
int c _AND
size_t n)
{
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
char *s = (char *) m;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
+ while (n-- != 0)
+ {
+ *s++ = (char) c;
+ }
+
+ return m;
+#else
+ char *s = (char *) m;
int i;
unsigned long buffer;
unsigned long *aligned_addr;
unsigned int d = c & 0xff; /* To avoid sign extension, copy C to an
unsigned variable. */
- while (UNALIGNED (s))
+ if (!TOO_SMALL (n) && !UNALIGNED (m))
{
- if (n--)
- *s++ = (char) c;
- else
- return m;
- }
-
- if (!TOO_SMALL (n))
- {
- /* If we get this far, we know that n is large and s is word-aligned. */
- aligned_addr = (unsigned long *) s;
+ /* If we get this far, we know that n is large and m is word-aligned. */
+ aligned_addr = (unsigned long*)m;
/* Store D into each char sized location in BUFFER so that
we can set large blocks quickly. */
- buffer = (d << 8) | d;
- buffer |= (buffer << 16);
- for (i = 32; i < LBLOCKSIZE * 8; i <<= 1)
- buffer = (buffer << i) | buffer;
+ if (LBLOCKSIZE == 4)
+ {
+ buffer = (d << 8) | d;
+ buffer |= (buffer << 16);
+ }
+ else
+ {
+ buffer = 0;
+ for (i = 0; i < LBLOCKSIZE; i++)
+ buffer = (buffer << 8) | d;
+ }
- /* Unroll the loop. */
while (n >= LBLOCKSIZE*4)
{
*aligned_addr++ = buffer;
@@ -93,10 +99,11 @@ _DEFUN (memset, (m, c, n),
s = (char*)aligned_addr;
}
-#endif /* not PREFER_SIZE_OVER_SPEED */
-
while (n--)
- *s++ = (char) c;
+ {
+ *s++ = (char)d;
+ }
return m;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/str-two-way.h b/newlib/libc/string/str-two-way.h
deleted file mode 100644
index ad71a2595..000000000
--- a/newlib/libc/string/str-two-way.h
+++ /dev/null
@@ -1,415 +0,0 @@
-/* Byte-wise substring search, using the Two-Way algorithm.
- * Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-
-/* Before including this file, you need to include <string.h>, and define:
- RESULT_TYPE A macro that expands to the return type.
- AVAILABLE(h, h_l, j, n_l) A macro that returns nonzero if there are
- at least N_L bytes left starting at
- H[J]. H is 'unsigned char *', H_L, J,
- and N_L are 'size_t'; H_L is an
- lvalue. For NUL-terminated searches,
- H_L can be modified each iteration to
- avoid having to compute the end of H
- up front.
-
- For case-insensitivity, you may optionally define:
- CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L
- characters of P1 and P2 are equal.
- CANON_ELEMENT(c) A macro that canonicalizes an element
- right after it has been fetched from
- one of the two strings. The argument
- is an 'unsigned char'; the result must
- be an 'unsigned char' as well.
-
- This file undefines the macros documented above, and defines
- LONG_NEEDLE_THRESHOLD.
-*/
-
-#include <limits.h>
-#include <stdint.h>
-
-/* We use the Two-Way string matching algorithm, which guarantees
- linear complexity with constant space. Additionally, for long
- needles, we also use a bad character shift table similar to the
- Boyer-Moore algorithm to achieve improved (potentially sub-linear)
- performance.
-
- See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260
- and http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm
-*/
-
-/* Point at which computing a bad-byte shift table is likely to be
- worthwhile. Small needles should not compute a table, since it
- adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a
- speedup no greater than a factor of NEEDLE_LEN. The larger the
- needle, the better the potential performance gain. On the other
- hand, on non-POSIX systems with CHAR_BIT larger than eight, the
- memory required for the table is prohibitive. */
-#if CHAR_BIT < 10
-# define LONG_NEEDLE_THRESHOLD 32U
-#else
-# define LONG_NEEDLE_THRESHOLD SIZE_MAX
-#endif
-
-#define MAX(a, b) ((a < b) ? (b) : (a))
-
-#ifndef CANON_ELEMENT
-# define CANON_ELEMENT(c) c
-#endif
-#ifndef CMP_FUNC
-# define CMP_FUNC memcmp
-#endif
-
-/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
- Return the index of the first byte in the right half, and set
- *PERIOD to the global period of the right half.
-
- The global period of a string is the smallest index (possibly its
- length) at which all remaining bytes in the string are repetitions
- of the prefix (the last repetition may be a subset of the prefix).
-
- When NEEDLE is factored into two halves, a local period is the
- length of the smallest word that shares a suffix with the left half
- and shares a prefix with the right half. All factorizations of a
- non-empty NEEDLE have a local period of at least 1 and no greater
- than NEEDLE_LEN.
-
- A critical factorization has the property that the local period
- equals the global period. All strings have at least one critical
- factorization with the left half smaller than the global period.
-
- Given an ordered alphabet, a critical factorization can be computed
- in linear time, with 2 * NEEDLE_LEN comparisons, by computing the
- larger of two ordered maximal suffixes. The ordered maximal
- suffixes are determined by lexicographic comparison of
- periodicity. */
-static size_t
-critical_factorization (const unsigned char *needle, size_t needle_len,
- size_t *period)
-{
- /* Index of last byte of left half, or SIZE_MAX. */
- size_t max_suffix, max_suffix_rev;
- size_t j; /* Index into NEEDLE for current candidate suffix. */
- size_t k; /* Offset into current period. */
- size_t p; /* Intermediate period. */
- unsigned char a, b; /* Current comparison bytes. */
-
- /* Invariants:
- 0 <= j < NEEDLE_LEN - 1
- -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
- min(max_suffix, max_suffix_rev) < global period of NEEDLE
- 1 <= p <= global period of NEEDLE
- p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
- 1 <= k <= p
- */
-
- /* Perform lexicographic search. */
- max_suffix = SIZE_MAX;
- j = 0;
- k = p = 1;
- while (j + k < needle_len)
- {
- a = CANON_ELEMENT (needle[j + k]);
- b = CANON_ELEMENT (needle[max_suffix + k]);
- if (a < b)
- {
- /* Suffix is smaller, period is entire prefix so far. */
- j += k;
- k = 1;
- p = j - max_suffix;
- }
- else if (a == b)
- {
- /* Advance through repetition of the current period. */
- if (k != p)
- ++k;
- else
- {
- j += p;
- k = 1;
- }
- }
- else /* b < a */
- {
- /* Suffix is larger, start over from current location. */
- max_suffix = j++;
- k = p = 1;
- }
- }
- *period = p;
-
- /* Perform reverse lexicographic search. */
- max_suffix_rev = SIZE_MAX;
- j = 0;
- k = p = 1;
- while (j + k < needle_len)
- {
- a = CANON_ELEMENT (needle[j + k]);
- b = CANON_ELEMENT (needle[max_suffix_rev + k]);
- if (b < a)
- {
- /* Suffix is smaller, period is entire prefix so far. */
- j += k;
- k = 1;
- p = j - max_suffix_rev;
- }
- else if (a == b)
- {
- /* Advance through repetition of the current period. */
- if (k != p)
- ++k;
- else
- {
- j += p;
- k = 1;
- }
- }
- else /* a < b */
- {
- /* Suffix is larger, start over from current location. */
- max_suffix_rev = j++;
- k = p = 1;
- }
- }
-
- /* Choose the longer suffix. Return the first byte of the right
- half, rather than the last byte of the left half. */
- if (max_suffix_rev + 1 < max_suffix + 1)
- return max_suffix + 1;
- *period = p;
- return max_suffix_rev + 1;
-}
-
-/* Return the first location of non-empty NEEDLE within HAYSTACK, or
- NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
- method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD.
- Performance is guaranteed to be linear, with an initialization cost
- of 2 * NEEDLE_LEN comparisons.
-
- If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
- most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
- If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
- HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */
-static RETURN_TYPE
-two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
- const unsigned char *needle, size_t needle_len)
-{
- size_t i; /* Index into current byte of NEEDLE. */
- size_t j; /* Index into current window of HAYSTACK. */
- size_t period; /* The period of the right half of needle. */
- size_t suffix; /* The index of the right half of needle. */
-
- /* Factor the needle into two halves, such that the left half is
- smaller than the global period, and the right half is
- periodic (with a period as large as NEEDLE_LEN - suffix). */
- suffix = critical_factorization (needle, needle_len, &period);
-
- /* Perform the search. Each iteration compares the right half
- first. */
- if (CMP_FUNC (needle, needle + period, suffix) == 0)
- {
- /* Entire needle is periodic; a mismatch can only advance by the
- period, so use memory to avoid rescanning known occurrences
- of the period. */
- size_t memory = 0;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Scan for matches in right half. */
- i = MAX (suffix, memory);
- while (i < needle_len && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (memory < i + 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i + 1 < memory + 1)
- return (RETURN_TYPE) (haystack + j);
- /* No match, so remember how many repetitions of period
- on the right half were scanned. */
- j += period;
- memory = needle_len - period;
- }
- else
- {
- j += i - suffix + 1;
- memory = 0;
- }
- }
- }
- else
- {
- /* The two halves of needle are distinct; no extra memory is
- required, and any mismatch results in a maximal shift. */
- period = MAX (suffix, needle_len - suffix) + 1;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Scan for matches in right half. */
- i = suffix;
- while (i < needle_len && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i == SIZE_MAX)
- return (RETURN_TYPE) (haystack + j);
- j += period;
- }
- else
- j += i - suffix + 1;
- }
- }
- return NULL;
-}
-
-/* Return the first location of non-empty NEEDLE within HAYSTACK, or
- NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
- method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN.
- Performance is guaranteed to be linear, with an initialization cost
- of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations.
-
- If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
- most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching,
- and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible.
- If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
- HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
- sublinear performance is not possible. */
-static RETURN_TYPE
-two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
- const unsigned char *needle, size_t needle_len)
-{
- size_t i; /* Index into current byte of NEEDLE. */
- size_t j; /* Index into current window of HAYSTACK. */
- size_t period; /* The period of the right half of needle. */
- size_t suffix; /* The index of the right half of needle. */
- size_t shift_table[1U << CHAR_BIT]; /* See below. */
-
- /* Factor the needle into two halves, such that the left half is
- smaller than the global period, and the right half is
- periodic (with a period as large as NEEDLE_LEN - suffix). */
- suffix = critical_factorization (needle, needle_len, &period);
-
- /* Populate shift_table. For each possible byte value c,
- shift_table[c] is the distance from the last occurrence of c to
- the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
- shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */
- for (i = 0; i < 1U << CHAR_BIT; i++)
- shift_table[i] = needle_len;
- for (i = 0; i < needle_len; i++)
- shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
-
- /* Perform the search. Each iteration compares the right half
- first. */
- if (CMP_FUNC (needle, needle + period, suffix) == 0)
- {
- /* Entire needle is periodic; a mismatch can only advance by the
- period, so use memory to avoid rescanning known occurrences
- of the period. */
- size_t memory = 0;
- size_t shift;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Check the last byte first; if it does not match, then
- shift to the next possible match location. */
- shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
- if (0 < shift)
- {
- if (memory && shift < period)
- {
- /* Since needle is periodic, but the last period has
- a byte out of place, there can be no match until
- after the mismatch. */
- shift = needle_len - period;
- memory = 0;
- }
- j += shift;
- continue;
- }
- /* Scan for matches in right half. The last byte has
- already been matched, by virtue of the shift table. */
- i = MAX (suffix, memory);
- while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len - 1 <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (memory < i + 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i + 1 < memory + 1)
- return (RETURN_TYPE) (haystack + j);
- /* No match, so remember how many repetitions of period
- on the right half were scanned. */
- j += period;
- memory = needle_len - period;
- }
- else
- {
- j += i - suffix + 1;
- memory = 0;
- }
- }
- }
- else
- {
- /* The two halves of needle are distinct; no extra memory is
- required, and any mismatch results in a maximal shift. */
- size_t shift;
- period = MAX (suffix, needle_len - suffix) + 1;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Check the last byte first; if it does not match, then
- shift to the next possible match location. */
- shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
- if (0 < shift)
- {
- j += shift;
- continue;
- }
- /* Scan for matches in right half. The last byte has
- already been matched, by virtue of the shift table. */
- i = suffix;
- while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len - 1 <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i == SIZE_MAX)
- return (RETURN_TYPE) (haystack + j);
- j += period;
- }
- else
- j += i - suffix + 1;
- }
- }
- return NULL;
-}
-
-#undef AVAILABLE
-#undef CANON_ELEMENT
-#undef CMP_FUNC
-#undef MAX
-#undef RETURN_TYPE
diff --git a/newlib/libc/string/strcasestr.c b/newlib/libc/string/strcasestr.c
index a8276e2b5..4f6f87e97 100644
--- a/newlib/libc/string/strcasestr.c
+++ b/newlib/libc/string/strcasestr.c
@@ -1,7 +1,7 @@
/*
FUNCTION
<<strcasestr>>---case-insensitive character string search
-
+
INDEX
strcasestr
@@ -21,9 +21,9 @@ DESCRIPTION
is identical to <<strstr>> except the search is
case-insensitive.
-RETURNS
+RETURNS
- A pointer to the first case-insensitive occurrence of the sequence
+ A pointer to the first case-insensitive occurrence of the sequence
<[find]> or <<NULL>> if no match was found.
PORTABILITY
@@ -40,7 +40,7 @@ QUICKREF
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
- * The quadratic code is derived from software contributed to Berkeley by
+ * This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,26 +67,12 @@ QUICKREF
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* Linear algorithm Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute the linear portion of
- * software is freely granted, provided that this notice is preserved.
- */
#include <sys/cdefs.h>
#include <ctype.h>
#include <string.h>
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-# define RETURN_TYPE char *
-# define AVAILABLE(h, h_l, j, n_l) \
- (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
- && ((h_l) = (j) + (n_l)))
-# define CANON_ELEMENT(c) tolower (c)
-# define CMP_FUNC strncasecmp
-# include "str-two-way.h"
-#endif
-
/*
* Find the first occurrence of find in s, ignore case.
*/
@@ -94,9 +80,6 @@ char *
strcasestr(s, find)
const char *s, *find;
{
-#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
-
- /* Less code size, but quadratic performance in the worst case. */
char c, sc;
size_t len;
@@ -112,36 +95,4 @@ strcasestr(s, find)
s--;
}
return ((char *)s);
-
-#else /* compilation for speed */
-
- /* Larger code size, but guaranteed linear performance. */
- const char *haystack = s;
- const char *needle = find;
- size_t needle_len; /* Length of NEEDLE. */
- size_t haystack_len; /* Known minimum length of HAYSTACK. */
- int ok = 1; /* True if NEEDLE is prefix of HAYSTACK. */
-
- /* Determine length of NEEDLE, and in the process, make sure
- HAYSTACK is at least as long (no point processing all of a long
- NEEDLE if HAYSTACK is too short). */
- while (*haystack && *needle)
- ok &= (tolower ((unsigned char) *haystack++)
- == tolower ((unsigned char) *needle++));
- if (*needle)
- return NULL;
- if (ok)
- return (char *) s;
- needle_len = needle - find;
- haystack = s + 1;
- haystack_len = needle_len - 1;
-
- /* Perform the search. */
- if (needle_len < LONG_NEEDLE_THRESHOLD)
- return two_way_short_needle ((const unsigned char *) haystack,
- haystack_len,
- (const unsigned char *) find, needle_len);
- return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
- (const unsigned char *) find, needle_len);
-#endif /* compilation for speed */
}
diff --git a/newlib/libc/string/strchr.c b/newlib/libc/string/strchr.c
index e921b5db7..60b0fde8e 100644
--- a/newlib/libc/string/strchr.c
+++ b/newlib/libc/string/strchr.c
@@ -53,7 +53,7 @@ QUICKREF
#endif
#endif
-/* DETECTCHAR returns nonzero if (long)X contains the byte used
+/* DETECTCHAR returns nonzero if (long)X contains the byte used
to fill (long)MASK. */
#define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK))
@@ -63,61 +63,46 @@ _DEFUN (strchr, (s1, i),
int i)
{
_CONST unsigned char *s = (_CONST unsigned char *)s1;
- unsigned char c = i;
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
+ unsigned char c = (unsigned int)i;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
- unsigned long mask,j;
- unsigned long *aligned_addr;
-
- /* Special case for finding 0. */
- if (!c)
+ while (*s && *s != c)
{
- while (UNALIGNED (s))
- {
- if (!*s)
- return (char *) s;
- s++;
- }
- /* Operate a word at a time. */
- aligned_addr = (unsigned long *) s;
- while (!DETECTNULL (*aligned_addr))
- aligned_addr++;
- /* Found the end of string. */
- s = (const unsigned char *) aligned_addr;
- while (*s)
- s++;
- return (char *) s;
+ s++;
}
- /* All other bytes. Align the pointer, then search a long at a time. */
- while (UNALIGNED (s))
+ if (*s != c)
{
- if (!*s)
- return NULL;
- if (*s == c)
- return (char *) s;
- s++;
+ s = NULL;
}
- mask = c;
- for (j = 8; j < LBLOCKSIZE * 8; j <<= 1)
- mask = (mask << j) | mask;
+ return (char *) s;
+#else
+ unsigned char c = (unsigned char)i;
+ unsigned long mask,j;
+ unsigned long *aligned_addr;
- aligned_addr = (unsigned long *) s;
- while (!DETECTNULL (*aligned_addr) && !DETECTCHAR (*aligned_addr, mask))
- aligned_addr++;
+ if (!UNALIGNED (s))
+ {
+ mask = 0;
+ for (j = 0; j < LBLOCKSIZE; j++)
+ mask = (mask << 8) | c;
- /* The block of bytes currently pointed to by aligned_addr
- contains either a null or the target char, or both. We
- catch it using the bytewise search. */
+ aligned_addr = (unsigned long*)s;
+ while (!DETECTNULL (*aligned_addr) && !DETECTCHAR (*aligned_addr, mask))
+ aligned_addr++;
- s = (unsigned char *) aligned_addr;
+ /* The block of bytes currently pointed to by aligned_addr
+ contains either a null or the target char, or both. We
+ catch it using the bytewise search. */
-#endif /* not PREFER_SIZE_OVER_SPEED */
+ s = (unsigned char*)aligned_addr;
+ }
while (*s && *s != c)
- s++;
+ s++;
if (*s == c)
return (char *)s;
return NULL;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex
index 6750f3eb0..5ba6e0fe5 100644
--- a/newlib/libc/string/strings.tex
+++ b/newlib/libc/string/strings.tex
@@ -14,7 +14,6 @@ managing areas of memory. The corresponding declarations are in
* memchr:: Find character in memory
* memcmp:: Compare two memory areas
* memcpy:: Copy memory regions
-* memmem:: Find memory segment
* memmove:: Move possibly overlapping memory
* mempcpy:: Copy memory regions and locate end
* memset:: Set an area of memory
@@ -73,9 +72,6 @@ managing areas of memory. The corresponding declarations are in
@include string/memcpy.def
@page
-@include string/memmem.def
-
-@page
@include string/memmove.def
@page
diff --git a/newlib/libc/string/strlen.c b/newlib/libc/string/strlen.c
index a796d2738..4249e14c7 100644
--- a/newlib/libc/string/strlen.c
+++ b/newlib/libc/string/strlen.c
@@ -1,7 +1,7 @@
-/*
+/*
FUNCTION
<<strlen>>---character string length
-
+
INDEX
strlen
@@ -57,32 +57,32 @@ size_t
_DEFUN (strlen, (str),
_CONST char *str)
{
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
_CONST char *start = str;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
+ while (*str)
+ str++;
+
+ return str - start;
+#else
+ _CONST char *start = str;
unsigned long *aligned_addr;
- /* Align the pointer, so we can search a word at a time. */
- while (UNALIGNED (str))
+ if (!UNALIGNED (str))
{
- if (!*str)
- return str - start;
- str++;
+ /* If the string is word-aligned, we can check for the presence of
+ a null in each word-sized block. */
+ aligned_addr = (unsigned long*)str;
+ while (!DETECTNULL (*aligned_addr))
+ aligned_addr++;
+
+ /* Once a null is detected, we check each byte in that block for a
+ precise position of the null. */
+ str = (char*)aligned_addr;
}
-
- /* If the string is word-aligned, we can check for the presence of
- a null in each word-sized block. */
- aligned_addr = (unsigned long *)str;
- while (!DETECTNULL (*aligned_addr))
- aligned_addr++;
-
- /* Once a null is detected, we check each byte in that block for a
- precise position of the null. */
- str = (char *) aligned_addr;
-
-#endif /* not PREFER_SIZE_OVER_SPEED */
-
+
while (*str)
str++;
return str - start;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c
index 0480bce0a..dddced3b2 100644
--- a/newlib/libc/string/strstr.c
+++ b/newlib/libc/string/strstr.c
@@ -16,14 +16,14 @@ TRAD_SYNOPSIS
char *<[s2]>;
DESCRIPTION
- Locates the first occurrence in the string pointed to by <[s1]> of
+ Locates the first occurence in the string pointed to by <[s1]> of
the sequence of characters in the string pointed to by <[s2]>
- (excluding the terminating null character).
+ (excluding the terminating null character).
RETURNS
Returns a pointer to the located string segment, or a null
pointer if the string <[s2]> is not found. If <[s2]> points to
- a string with zero length, <[s1]> is returned.
+ a string with zero length, the <[s1]> is returned.
PORTABILITY
<<strstr>> is ANSI C.
@@ -36,22 +36,11 @@ QUICKREF
#include <string.h>
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-# define RETURN_TYPE char *
-# define AVAILABLE(h, h_l, j, n_l) \
- (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
- && ((h_l) = (j) + (n_l)))
-# include "str-two-way.h"
-#endif
-
char *
_DEFUN (strstr, (searchee, lookfor),
_CONST char *searchee _AND
_CONST char *lookfor)
{
-#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
-
- /* Less code size, but quadratic performance in the worst case. */
if (*searchee == 0)
{
if (*lookfor)
@@ -81,41 +70,4 @@ _DEFUN (strstr, (searchee, lookfor),
}
return (char *) NULL;
-
-#else /* compilation for speed */
-
- /* Larger code size, but guaranteed linear performance. */
- const char *haystack = searchee;
- const char *needle = lookfor;
- size_t needle_len; /* Length of NEEDLE. */
- size_t haystack_len; /* Known minimum length of HAYSTACK. */
- int ok = 1; /* True if NEEDLE is prefix of HAYSTACK. */
-
- /* Determine length of NEEDLE, and in the process, make sure
- HAYSTACK is at least as long (no point processing all of a long
- NEEDLE if HAYSTACK is too short). */
- while (*haystack && *needle)
- ok &= *haystack++ == *needle++;
- if (*needle)
- return NULL;
- if (ok)
- return (char *) searchee;
-
- /* Reduce the size of haystack using strchr, since it has a smaller
- linear coefficient than the Two-Way algorithm. */
- needle_len = needle - lookfor;
- haystack = strchr (searchee + 1, *lookfor);
- if (!haystack || needle_len == 1)
- return (char *) haystack;
- haystack_len = (haystack > searchee + needle_len ? 1
- : needle_len + searchee - haystack);
-
- /* Perform the search. */
- if (needle_len < LONG_NEEDLE_THRESHOLD)
- return two_way_short_needle ((const unsigned char *) haystack,
- haystack_len,
- (const unsigned char *) lookfor, needle_len);
- return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
- (const unsigned char *) lookfor, needle_len);
-#endif /* compilation for speed */
}
diff --git a/newlib/libc/sys/a29khif/_isatty.S b/newlib/libc/sys/a29khif/_isatty.S
index b18d3a35e..55110e2fc 100644
--- a/newlib/libc/sys/a29khif/_isatty.S
+++ b/newlib/libc/sys/a29khif/_isatty.S
@@ -4,8 +4,10 @@ gcc2_compiled.:
.text
.align 4
.global __isatty
+ .global _isatty
.word 0x30000
__isatty:
+_isatty:
sub gr1,gr1,16
asgeu V_SPILL,gr1,gr126
add lr1,gr1,28
diff --git a/newlib/libc/sys/arc/isatty.c b/newlib/libc/sys/arc/isatty.c
index fe64209b9..3c64647a9 100644
--- a/newlib/libc/sys/arc/isatty.c
+++ b/newlib/libc/sys/arc/isatty.c
@@ -3,14 +3,13 @@
/* Dumb implementation so programs will at least run. */
#include <sys/stat.h>
-#include <reent.h>
int
-_isatty_r (struct _reent *ptr, int fd)
+isatty (int fd)
{
struct stat buf;
- if (_fstat_r (ptr, fd, &buf) < 0)
+ if (fstat (fd, &buf) < 0)
return 0;
if (S_ISCHR (buf.st_mode))
return 1;
diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c
index f9ac14c06..65c96b1e2 100644
--- a/newlib/libc/sys/arm/syscalls.c
+++ b/newlib/libc/sys/arm/syscalls.c
@@ -20,7 +20,7 @@
/* Forward prototypes. */
int _system _PARAMS ((const char *));
int _rename _PARAMS ((const char *, const char *));
-int _isatty _PARAMS ((int));
+int isatty _PARAMS ((int));
clock_t _times _PARAMS ((struct tms *));
int _gettimeofday _PARAMS ((struct timeval *, void *));
void _raise _PARAMS ((void));
@@ -612,7 +612,7 @@ _times (struct tms * tp)
int
-_isatty (int fd)
+isatty (int fd)
{
#ifdef ARM_RDI_MONITOR
int fh = remap_handle (fd);
diff --git a/newlib/libc/sys/configure b/newlib/libc/sys/configure
index 11ee1d997..7b6926a36 100755
--- a/newlib/libc/sys/configure
+++ b/newlib/libc/sys/configure
@@ -1,54 +1,25 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for newlib 1.16.0.
+# Generated by GNU Autoconf 2.59 for newlib 1.15.0.
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
fi
+DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -58,43 +29,8 @@ else
fi
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
+$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
@@ -108,19 +44,18 @@ do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
@@ -128,388 +63,157 @@ fi
# Name of the executable.
-as_me=`$as_basename -- "$0" ||
+as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
-if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
-else
- as_have_required=no
-fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
fi
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-test \$exitcode = 0) || { (exit 1); exit 1; }
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
-else
- as_candidate_shells=
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- case $as_dir in
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
/*)
- for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
- done;;
- esac
-done
-IFS=$as_save_IFS
-
-
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
-fi
-
-fi
-
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell autoconf@gnu.org about your system,
- echo including any error possibly output before this
- echo message
-}
-
-
-
+ if ("$as_dir/$as_base" -c '
as_lineno_1=$LINENO
as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
- s/-\n.*//
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
+ chmod +x $as_me.lineno ||
{ echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
# Exit status is that of the last command.
exit
}
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir
-fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
@@ -518,28 +222,7 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -548,6 +231,15 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
# Check that we are running under the correct shell.
@@ -698,239 +390,100 @@ fi
-exec 7<&0 </dev/null 6>&1
-
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+exec 6>&1
+
#
# Initializations.
#
ac_default_prefix=/usr/local
-ac_clean_files=
ac_config_libobj_dir=.
-LIBOBJS=
cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
SHELL=${CONFIG_SHELL-/bin/sh}
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
# Identity of this package.
PACKAGE_NAME='newlib'
PACKAGE_TARNAME='newlib'
-PACKAGE_VERSION='1.16.0'
-PACKAGE_STRING='newlib 1.16.0'
+PACKAGE_VERSION='1.15.0'
+PACKAGE_STRING='newlib 1.15.0'
PACKAGE_BUGREPORT=''
ac_unique_file="a29khif"
# Factoring default headers for most tests.
ac_includes_default="\
#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
+#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#ifdef HAVE_SYS_STAT_H
+#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
-#ifdef STDC_HEADERS
+#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
-# ifdef HAVE_STDLIB_H
+# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
-#ifdef HAVE_STRINGS_H
+#if HAVE_STRINGS_H
# include <strings.h>
#endif
-#ifdef HAVE_INTTYPES_H
+#if HAVE_INTTYPES_H
# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-MAY_SUPPLY_SYSCALLS_TRUE
-MAY_SUPPLY_SYSCALLS_FALSE
-newlib_basedir
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-CYGPATH_W
-PACKAGE
-VERSION
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-CC
-DEPDIR
-am__include
-am__quote
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-CCDEPMODE
-am__fastdepCC_TRUE
-am__fastdepCC_FALSE
-AS
-AR
-RANLIB
-READELF
-MAINTAINER_MODE_TRUE
-MAINTAINER_MODE_FALSE
-MAINT
-CCAS
-CCASFLAGS
-NEWLIB_CFLAGS
-LDFLAGS
-ELIX_LEVEL_0_TRUE
-ELIX_LEVEL_0_FALSE
-ELIX_LEVEL_1_TRUE
-ELIX_LEVEL_1_FALSE
-ELIX_LEVEL_2_TRUE
-ELIX_LEVEL_2_FALSE
-ELIX_LEVEL_3_TRUE
-ELIX_LEVEL_3_FALSE
-ELIX_LEVEL_4_TRUE
-ELIX_LEVEL_4_FALSE
-USE_LIBTOOL_TRUE
-USE_LIBTOOL_FALSE
-OBJEXT
-oext
-aext
-lpfx
-libm_machine_dir
-machine_dir
-sys_dir
-SED
-DLLTOOL
-OBJDUMP
-LIBTOOL
-CFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-GREP
-EGREP
-FGREP
-LD
-DUMPBIN
-ac_ct_DUMPBIN
-NM
-LN_S
-lt_ECHO
-CPP
-subdirs
-CRT0
-HAVE_SYS_DIR_TRUE
-HAVE_SYS_DIR_FALSE
-LIBOBJS
-LTLIBOBJS'
+ac_subdirs_all="$ac_subdirs_all a29khif"
+ac_subdirs_all="$ac_subdirs_all arc"
+ac_subdirs_all="$ac_subdirs_all arm"
+ac_subdirs_all="$ac_subdirs_all d10v"
+ac_subdirs_all="$ac_subdirs_all decstation"
+ac_subdirs_all="$ac_subdirs_all h8300hms"
+ac_subdirs_all="$ac_subdirs_all h8500hms"
+ac_subdirs_all="$ac_subdirs_all linux"
+ac_subdirs_all="$ac_subdirs_all m88kbug"
+ac_subdirs_all="$ac_subdirs_all mmixware"
+ac_subdirs_all="$ac_subdirs_all netware"
+ac_subdirs_all="$ac_subdirs_all rdos"
+ac_subdirs_all="$ac_subdirs_all rtems"
+ac_subdirs_all="$ac_subdirs_all sh"
+ac_subdirs_all="$ac_subdirs_all sparc64"
+ac_subdirs_all="$ac_subdirs_all sun4"
+ac_subdirs_all="$ac_subdirs_all sysmec"
+ac_subdirs_all="$ac_subdirs_all sysnec810"
+ac_subdirs_all="$ac_subdirs_all sysnecv850"
+ac_subdirs_all="$ac_subdirs_all sysvi386"
+ac_subdirs_all="$ac_subdirs_all sysvnecv70"
+ac_subdirs_all="$ac_subdirs_all tic80"
+ac_subdirs_all="$ac_subdirs_all w65"
+ac_subdirs_all="$ac_subdirs_all z8ksim"
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAY_SUPPLY_SYSCALLS_TRUE MAY_SUPPLY_SYSCALLS_FALSE newlib_basedir build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE AS ac_ct_AS AR ac_ct_AR RANLIB ac_ct_RANLIB READELF ac_ct_READELF MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT CCAS CCASFLAGS NEWLIB_CFLAGS LDFLAGS ELIX_LEVEL_0_TRUE ELIX_LEVEL_0_FALSE ELIX_LEVEL_1_TRUE ELIX_LEVEL_1_FALSE ELIX_LEVEL_2_TRUE ELIX_LEVEL_2_FALSE ELIX_LEVEL_3_TRUE ELIX_LEVEL_3_FALSE ELIX_LEVEL_4_TRUE ELIX_LEVEL_4_FALSE USE_LIBTOOL_TRUE USE_LIBTOOL_FALSE OBJEXT oext aext lpfx libm_machine_dir machine_dir sys_dir SED DLLTOOL ac_ct_DLLTOOL OBJDUMP ac_ct_OBJDUMP LIBTOOL CFLAGS CPPFLAGS ac_ct_CC EXEEXT EGREP FGREP GREP LD DUMPBIN ac_ct_DUMPBIN NM LN_S lt_ECHO CPP subdirs CRT0 HAVE_SYS_DIR_TRUE HAVE_SYS_DIR_FALSE LIBOBJS LTLIBOBJS'
ac_subst_files=''
- ac_precious_vars='build_alias
-host_alias
-target_alias
-CCAS
-CCASFLAGS
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP'
-ac_subdirs_all='a29khif
-arc
-arm
-d10v
-decstation
-h8300hms
-h8500hms
-linux
-m88kbug
-mmixware
-netware
-rdos
-rtems
-sh
-sparc64
-sun4
-sysmec
-sysnec810
-sysnecv850
-sysvi386
-sysvnecv70
-tic80
-w65
-z8ksim'
# Initialize some variables set by options.
ac_init_help=
@@ -957,48 +510,34 @@ x_libraries=NONE
# and all the variables that are supposed to be based on exec_prefix
# by default will actually change.
# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
bindir='${exec_prefix}/bin'
sbindir='${exec_prefix}/sbin'
libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
+datadir='${prefix}/share'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
includedir='${prefix}/include'
oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
ac_prev=
-ac_dashdash=
for ac_option
do
# If the previous option needs an argument, assign it.
if test -n "$ac_prev"; then
- eval $ac_prev=\$ac_option
+ eval "$ac_prev=\$ac_option"
ac_prev=
continue
fi
- case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
- esac
+ ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
# Accept the important Cygnus configure options, so we can diagnose typos.
- case $ac_dashdash$ac_option in
- --)
- ac_dashdash=yes ;;
+ case $ac_option in
-bindir | --bindir | --bindi | --bind | --bin | --bi)
ac_prev=bindir ;;
@@ -1020,45 +559,33 @@ do
--config-cache | -C)
cache_file=config.cache ;;
- -datadir | --datadir | --datadi | --datad)
+ -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+ | --da=*)
datadir=$ac_optarg ;;
- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
- | --dataroo | --dataro | --datar)
- ac_prev=datarootdir ;;
- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
- datarootdir=$ac_optarg ;;
-
-disable-* | --disable-*)
ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
- eval enable_$ac_feature=no ;;
-
- -docdir | --docdir | --docdi | --doc | --do)
- ac_prev=docdir ;;
- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
- docdir=$ac_optarg ;;
-
- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
- ac_prev=dvidir ;;
- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
- dvidir=$ac_optarg ;;
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ eval "enable_$ac_feature=no" ;;
-enable-* | --enable-*)
ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid feature name: $ac_feature" >&2
{ (exit 1); exit 1; }; }
- ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
- eval enable_$ac_feature=\$ac_optarg ;;
+ ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "enable_$ac_feature='$ac_optarg'" ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1085,12 +612,6 @@ do
-host=* | --host=* | --hos=* | --ho=*)
host_alias=$ac_optarg ;;
- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
- ac_prev=htmldir ;;
- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
- | --ht=*)
- htmldir=$ac_optarg ;;
-
-includedir | --includedir | --includedi | --included | --include \
| --includ | --inclu | --incl | --inc)
ac_prev=includedir ;;
@@ -1115,16 +636,13 @@ do
| --libexe=* | --libex=* | --libe=*)
libexecdir=$ac_optarg ;;
- -localedir | --localedir | --localedi | --localed | --locale)
- ac_prev=localedir ;;
- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
- localedir=$ac_optarg ;;
-
-localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst | --locals)
+ | --localstate | --localstat | --localsta | --localst \
+ | --locals | --local | --loca | --loc | --lo)
ac_prev=localstatedir ;;
-localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
localstatedir=$ac_optarg ;;
-mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -1189,16 +707,6 @@ do
| --progr-tra=* | --program-tr=* | --program-t=*)
program_transform_name=$ac_optarg ;;
- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
- ac_prev=pdfdir ;;
- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
- pdfdir=$ac_optarg ;;
-
- -psdir | --psdir | --psdi | --psd | --ps)
- ac_prev=psdir ;;
- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
- psdir=$ac_optarg ;;
-
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
@@ -1251,20 +759,24 @@ do
-with-* | --with-*)
ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
- eval with_$ac_package=\$ac_optarg ;;
+ ac_package=`echo $ac_package| sed 's/-/_/g'`
+ case $ac_option in
+ *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) ac_optarg=yes ;;
+ esac
+ eval "with_$ac_package='$ac_optarg'" ;;
-without-* | --without-*)
ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid package name: $ac_package" >&2
{ (exit 1); exit 1; }; }
- ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
- eval with_$ac_package=no ;;
+ ac_package=`echo $ac_package | sed 's/-/_/g'`
+ eval "with_$ac_package=no" ;;
--x)
# Obsolete; use --with-x.
@@ -1295,7 +807,8 @@ Try \`$0 --help' for more information." >&2
expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
{ echo "$as_me: error: invalid variable name: $ac_envvar" >&2
{ (exit 1); exit 1; }; }
- eval $ac_envvar=\$ac_optarg
+ ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+ eval "$ac_envvar='$ac_optarg'"
export $ac_envvar ;;
*)
@@ -1315,19 +828,27 @@ if test -n "$ac_prev"; then
{ (exit 1); exit 1; }; }
fi
-# Be sure to have absolute directory names.
-for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
- datadir sysconfdir sharedstatedir localstatedir includedir \
- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
do
- eval ac_val=\$$ac_var
+ eval ac_val=$`echo $ac_var`
case $ac_val in
- [\\/$]* | ?:[\\/]* ) continue;;
- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+ localstatedir libdir includedir oldincludedir infodir mandir
+do
+ eval ac_val=$`echo $ac_var`
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) ;;
+ *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; };;
esac
- { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1354,76 +875,82 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
test "$silent" = yes && exec 6>/dev/null
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { echo "$as_me: error: Working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
-
-
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
- # Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$0" ||
+ # Try the directory containing this script, then its parent.
+ ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$0" : 'X\(//\)[^/]' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$0" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
srcdir=$ac_confdir
- if test ! -r "$srcdir/$ac_unique_file"; then
+ if test ! -r $srcdir/$ac_unique_file; then
srcdir=..
fi
else
ac_srcdir_defaulted=no
fi
-if test ! -r "$srcdir/$ac_unique_file"; then
- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+if test ! -r $srcdir/$ac_unique_file; then
+ if test "$ac_srcdir_defaulted" = yes; then
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+ { (exit 1); exit 1; }; }
+ else
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
{ (exit 1); exit 1; }; }
+ fi
fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
{ (exit 1); exit 1; }; }
- pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
- srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
- eval ac_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_env_${ac_var}_value=\$${ac_var}
- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CCAS_set=${CCAS+set}
+ac_env_CCAS_value=$CCAS
+ac_cv_env_CCAS_set=${CCAS+set}
+ac_cv_env_CCAS_value=$CCAS
+ac_env_CCASFLAGS_set=${CCASFLAGS+set}
+ac_env_CCASFLAGS_value=$CCASFLAGS
+ac_cv_env_CCASFLAGS_set=${CCASFLAGS+set}
+ac_cv_env_CCASFLAGS_value=$CCASFLAGS
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
#
# Report the --help message.
@@ -1432,7 +959,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures newlib 1.16.0 to adapt to many kinds of systems.
+\`configure' configures newlib 1.15.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1452,6 +979,9 @@ Configuration:
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or \`..']
+_ACEOF
+
+ cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[$ac_default_prefix]
@@ -1469,22 +999,15 @@ Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/newlib]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
_ACEOF
cat <<\_ACEOF
@@ -1502,7 +1025,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of newlib 1.16.0:";;
+ short | recursive ) echo "Configuration of newlib 1.15.0:";;
esac
cat <<\_ACEOF
@@ -1521,8 +1044,10 @@ Optional Features:
--enable-dependency-tracking do not reject slow dependency extractors
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
- --enable-shared[=PKGS] build shared libraries [default=yes]
- --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-shared[=PKGS]
+ build shared libraries [default=yes]
+ --enable-static[=PKGS]
+ build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
@@ -1541,95 +1066,128 @@ Some influential environment variables:
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
- LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
- you have headers in a nonstandard directory <include dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
CPP C preprocessor
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
_ACEOF
-ac_status=$?
fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" || continue
+ test -d $ac_dir || continue
ac_builddir=.
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
case $srcdir in
- .) # We are building in place.
+ .) # No --srcdir option. We are building in place.
ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
- cd "$ac_dir" || { ac_status=$?; continue; }
- # Check for guested configure.
- if test -f "$ac_srcdir/configure.gnu"; then
- echo &&
- $SHELL "$ac_srcdir/configure.gnu" --help=recursive
- elif test -f "$ac_srcdir/configure"; then
- echo &&
- $SHELL "$ac_srcdir/configure" --help=recursive
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
else
echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi || ac_status=$?
- cd "$ac_pwd" || { ac_status=$?; break; }
+ fi
+ cd $ac_popdir
done
fi
-test -n "$ac_init_help" && exit $ac_status
+test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-newlib configure 1.16.0
-generated by GNU Autoconf 2.61
+newlib configure 1.15.0
+generated by GNU Autoconf 2.59
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
- exit
+ exit 0
fi
-cat >config.log <<_ACEOF
+exec 5>config.log
+cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by newlib $as_me 1.16.0, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+It was created by newlib $as_me 1.15.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
_ACEOF
-exec 5>>config.log
{
cat <<_ASUNAME
## --------- ##
@@ -1648,7 +1206,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
@@ -1662,7 +1220,6 @@ do
test -z "$as_dir" && as_dir=.
echo "PATH: $as_dir"
done
-IFS=$as_save_IFS
} >&5
@@ -1684,6 +1241,7 @@ _ACEOF
ac_configure_args=
ac_configure_args0=
ac_configure_args1=
+ac_sep=
ac_must_keep_next=false
for ac_pass in 1 2
do
@@ -1694,7 +1252,7 @@ do
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil)
continue ;;
- *\'*)
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
@@ -1716,7 +1274,9 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args '$ac_arg'"
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
;;
esac
done
@@ -1727,8 +1287,8 @@ $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
@@ -1741,34 +1301,20 @@ trap 'exit_status=$?
_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
-(
- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
+{
(set) 2>&1 |
- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
sed -n \
- "s/'\''/'\''\\\\'\'''\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
- ;; #(
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
*)
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
- esac |
- sort
-)
+ esac;
+}
echo
cat <<\_ASBOX
@@ -1779,28 +1325,22 @@ _ASBOX
echo
for ac_var in $ac_subst_vars
do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- echo "$ac_var='\''$ac_val'\''"
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
if test -n "$ac_subst_files"; then
cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
+## ------------- ##
+## Output files. ##
+## ------------- ##
_ASBOX
echo
for ac_var in $ac_subst_files
do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- echo "$ac_var='\''$ac_val'\''"
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
done | sort
echo
fi
@@ -1812,24 +1352,26 @@ _ASBOX
## ----------- ##
_ASBOX
echo
- cat confdefs.h
+ sed "/^$/d" confdefs.h | sort
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
- rm -f core *.core core.conftest.* &&
- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ rm -f core *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
-' 0
+ ' 0
for ac_signal in 1 2 13 15; do
trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
# Predefined preprocessor variables.
@@ -1860,17 +1402,14 @@ _ACEOF
# Let the site file select an alternate cache file if it wants to.
# Prefer explicitly selected file to automatically selected ones.
-if test -n "$CONFIG_SITE"; then
- set x "$CONFIG_SITE"
-elif test "x$prefix" != xNONE; then
- set x "$prefix/share/config.site" "$prefix/etc/config.site"
-else
- set x "$ac_default_prefix/share/config.site" \
- "$ac_default_prefix/etc/config.site"
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+ else
+ CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+ fi
fi
-shift
-for ac_site_file
-do
+for ac_site_file in $CONFIG_SITE; do
if test -r "$ac_site_file"; then
{ echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
echo "$as_me: loading site script $ac_site_file" >&6;}
@@ -1886,8 +1425,8 @@ if test -r "$cache_file"; then
{ echo "$as_me:$LINENO: loading cache $cache_file" >&5
echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
- [\\/]* | ?:[\\/]* ) . "$cache_file";;
- *) . "./$cache_file";;
+ [\\/]* | ?:[\\/]* ) . $cache_file;;
+ *) . ./$cache_file;;
esac
fi
else
@@ -1899,11 +1438,12 @@ fi
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
+for ac_var in `(set) 2>&1 |
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val=\$ac_cv_env_${ac_var}_value
- eval ac_new_val=\$ac_env_${ac_var}_value
+ eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+ eval ac_new_val="\$ac_env_${ac_var}_value"
case $ac_old_set,$ac_new_set in
set,)
{ echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
@@ -1928,7 +1468,8 @@ echo "$as_me: current value: $ac_new_val" >&2;}
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
@@ -1945,6 +1486,12 @@ echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start ov
{ (exit 1); exit 1; }; }
fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
@@ -1969,92 +1516,67 @@ fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_aux_dir=
-for ac_dir in ../../.. "$srcdir"/../../..; do
- if test -f "$ac_dir/install-sh"; then
+for ac_dir in ../../.. $srcdir/../../..; do
+ if test -f $ac_dir/install-sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
- elif test -f "$ac_dir/install.sh"; then
+ elif test -f $ac_dir/install.sh; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
- elif test -f "$ac_dir/shtool"; then
+ elif test -f $ac_dir/shtool; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
- { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../.. \"$srcdir\"/../../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in ../../.. \"$srcdir\"/../../.." >&2;}
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../../.. $srcdir/../../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in ../../.. $srcdir/../../.." >&2;}
{ (exit 1); exit 1; }; }
fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+ { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
{ (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
if test "${ac_cv_build+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
- ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
+ ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+ ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
{ { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
{ (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
- { (exit 1); exit 1; }; };;
-esac
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
am__api_version="1.9"
@@ -2071,8 +1593,8 @@ am__api_version="1.9"
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2094,7 +1616,7 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -2113,22 +1635,21 @@ case $as_dir/ in
;;
esac
done
-IFS=$as_save_IFS
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
+ # removed, or if the path is relative.
INSTALL=$ac_install_sh
fi
fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -2138,8 +1659,8 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
# Just in case
sleep 1
echo timestamp > conftest.file
@@ -2181,20 +1702,20 @@ echo "$as_me: error: newly created file is older than distributed files!
Check your system clock" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
test "$program_prefix" != NONE &&
- program_transform_name="s&^&$program_prefix&;$program_transform_name"
+ program_transform_name="s,^,$program_prefix,;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
- program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+ program_transform_name="s,\$,$program_suffix,;$program_transform_name"
# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
cat <<\_ACEOF >conftest.sed
s/[\\$]/&&/g;s/;s,x,x,$//
_ACEOF
program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm -f conftest.sed
+rm conftest.sed
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
@@ -2246,8 +1767,8 @@ for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AWK+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2260,57 +1781,54 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AWK="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
- { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
+ echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$AWK" && break
done
-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
all:
- @echo '@@@%%%=$(MAKE)=@@@%%%'
+ @echo 'ac_maketemp="$(MAKE)"'
_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
- *@@@%%%=?*=@@@%%%*)
- eval ac_cv_prog_make_${ac_make}_set=yes;;
- *)
- eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+ eval ac_cv_prog_make_${ac_make}_set=yes
+else
+ eval ac_cv_prog_make_${ac_make}_set=no
+fi
rm -f conftest.make
fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
SET_MAKE=
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -2325,7 +1843,7 @@ rmdir .tst 2>/dev/null
DEPDIR="${am__leading_dot}deps"
-ac_config_commands="$ac_config_commands depfiles"
+ ac_config_commands="$ac_config_commands depfiles"
am_make=${MAKE-make}
@@ -2335,8 +1853,8 @@ am__doit:
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
-{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
-echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
am__include="#"
am__quote=
_am_result=none
@@ -2363,15 +1881,15 @@ if test "$am__include" = "#"; then
fi
-{ echo "$as_me:$LINENO: result: $_am_result" >&5
-echo "${ECHO_T}$_am_result" >&6; }
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
rm -f confinc confmf
-# Check whether --enable-dependency-tracking was given.
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
if test "${enable_dependency_tracking+set}" = set; then
- enableval=$enable_dependency_tracking;
-fi
+ enableval="$enable_dependency_tracking"
+fi;
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
@@ -2389,9 +1907,10 @@ fi
-# Check whether --enable-multilib was given.
+# Check whether --enable-multilib or --disable-multilib was given.
if test "${enable_multilib+set}" = set; then
- enableval=$enable_multilib; case "${enableval}" in
+ enableval="$enable_multilib"
+ case "${enableval}" in
yes) multilib=yes ;;
no) multilib=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for multilib option" >&5
@@ -2400,11 +1919,11 @@ echo "$as_me: error: bad value ${enableval} for multilib option" >&2;}
esac
else
multilib=yes
-fi
-
-# Check whether --enable-target-optspace was given.
+fi;
+# Check whether --enable-target-optspace or --disable-target-optspace was given.
if test "${enable_target_optspace+set}" = set; then
- enableval=$enable_target_optspace; case "${enableval}" in
+ enableval="$enable_target_optspace"
+ case "${enableval}" in
yes) target_optspace=yes ;;
no) target_optspace=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for target-optspace option" >&5
@@ -2413,11 +1932,11 @@ echo "$as_me: error: bad value ${enableval} for target-optspace option" >&2;}
esac
else
target_optspace=
-fi
-
-# Check whether --enable-malloc-debugging was given.
+fi;
+# Check whether --enable-malloc-debugging or --disable-malloc-debugging was given.
if test "${enable_malloc_debugging+set}" = set; then
- enableval=$enable_malloc_debugging; case "${enableval}" in
+ enableval="$enable_malloc_debugging"
+ case "${enableval}" in
yes) malloc_debugging=yes ;;
no) malloc_debugging=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for malloc-debugging option" >&5
@@ -2426,11 +1945,11 @@ echo "$as_me: error: bad value ${enableval} for malloc-debugging option" >&2;}
esac
else
malloc_debugging=
-fi
-
-# Check whether --enable-newlib-multithread was given.
+fi;
+# Check whether --enable-newlib-multithread or --disable-newlib-multithread was given.
if test "${enable_newlib_multithread+set}" = set; then
- enableval=$enable_newlib_multithread; case "${enableval}" in
+ enableval="$enable_newlib_multithread"
+ case "${enableval}" in
yes) newlib_multithread=yes ;;
no) newlib_multithread=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-multithread option" >&5
@@ -2439,11 +1958,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-multithread option" >&2;}
esac
else
newlib_multithread=yes
-fi
-
-# Check whether --enable-newlib-iconv was given.
+fi;
+# Check whether --enable-newlib-iconv or --disable-newlib-iconv was given.
if test "${enable_newlib_iconv+set}" = set; then
- enableval=$enable_newlib_iconv; if test "${newlib_iconv+set}" != set; then
+ enableval="$enable_newlib_iconv"
+ if test "${newlib_iconv+set}" != set; then
case "${enableval}" in
yes) newlib_iconv=yes ;;
no) newlib_iconv=no ;;
@@ -2454,11 +1973,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-iconv option" >&2;}
fi
else
newlib_iconv=${newlib_iconv}
-fi
-
-# Check whether --enable-newlib-elix-level was given.
+fi;
+# Check whether --enable-newlib-elix-level or --disable-newlib-elix-level was given.
if test "${enable_newlib_elix_level+set}" = set; then
- enableval=$enable_newlib_elix_level; case "${enableval}" in
+ enableval="$enable_newlib_elix_level"
+ case "${enableval}" in
0) newlib_elix_level=0 ;;
1) newlib_elix_level=1 ;;
2) newlib_elix_level=2 ;;
@@ -2470,11 +1989,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-elix-level option" >&2;}
esac
else
newlib_elix_level=0
-fi
-
-# Check whether --enable-newlib-io-float was given.
+fi;
+# Check whether --enable-newlib-io-float or --disable-newlib-io-float was given.
if test "${enable_newlib_io_float+set}" = set; then
- enableval=$enable_newlib_io_float; case "${enableval}" in
+ enableval="$enable_newlib_io_float"
+ case "${enableval}" in
yes) newlib_io_float=yes ;;
no) newlib_io_float=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-io-float option" >&5
@@ -2483,11 +2002,11 @@ echo "$as_me: error: bad value ${enableval} for newlib-io-float option" >&2;}
esac
else
newlib_io_float=yes
-fi
-
-# Check whether --enable-newlib-supplied-syscalls was given.
+fi;
+# Check whether --enable-newlib-supplied-syscalls or --disable-newlib-supplied-syscalls was given.
if test "${enable_newlib_supplied_syscalls+set}" = set; then
- enableval=$enable_newlib_supplied_syscalls; case "${enableval}" in
+ enableval="$enable_newlib_supplied_syscalls"
+ case "${enableval}" in
yes) newlib_may_supply_syscalls=yes ;;
no) newlib_may_supply_syscalls=no ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for newlib-supplied-syscalls option" >&5
@@ -2496,8 +2015,7 @@ echo "$as_me: error: bad value ${enableval} for newlib-supplied-syscalls option"
esac
else
newlib_may_supply_syscalls=yes
-fi
-
+fi;
if test x${newlib_may_supply_syscalls} = xyes; then
@@ -2523,41 +2041,26 @@ else
fi
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
if test "${ac_cv_host+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test "x$host_alias" = x; then
- ac_cv_host=$ac_cv_build
-else
- ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+ ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+ { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
{ (exit 1); exit 1; }; }
-fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
- { (exit 1); exit 1; }; };;
-esac
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
@@ -2581,7 +2084,7 @@ fi
# Define the identity of the package.
PACKAGE='newlib'
- VERSION='1.16.0'
+ VERSION='1.15.0'
# Some tools Automake needs.
@@ -2610,8 +2113,8 @@ if test "$cross_compiling" != no; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2624,34 +2127,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
- { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2664,41 +2165,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
- { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
+ STRIP=$ac_ct_STRIP
else
STRIP="$ac_cv_prog_STRIP"
fi
@@ -2733,8 +2220,8 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2747,32 +2234,30 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
depcc="$CC" am_compiler_list=
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2861,8 +2346,8 @@ else
fi
fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
@@ -2881,8 +2366,8 @@ fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2896,7 +2381,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -2907,7 +2392,6 @@ do
fi
done
done
-IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -2925,21 +2409,20 @@ fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable cc found in \$PATH" >&5
echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
{ (exit 1); exit 1; }; }
fi
-{ echo "$as_me:$LINENO: checking whether we are using GNU C" >&5
-echo $ECHO_N "checking whether we are using GNU C... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether we are using GNU C" >&5
+echo $ECHO_N "checking whether we are using GNU C... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -2959,8 +2442,8 @@ else
ac_cv_c_compiler_gnu=no
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
if test $ac_cv_c_compiler_gnu = yes; then
GCC=yes
@@ -2969,16 +2452,13 @@ if test $ac_cv_c_compiler_gnu = yes; then
CFLAGS=
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -2994,118 +2474,38 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_prog_cc_g=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
@@ -3137,8 +2537,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3151,34 +2551,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AS="${ac_tool_prefix}as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AS=$ac_cv_prog_AS
if test -n "$AS"; then
- { echo "$as_me:$LINENO: result: $AS" >&5
-echo "${ECHO_T}$AS" >&6; }
+ echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AS"; then
ac_ct_AS=$AS
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3191,41 +2589,26 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AS="as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_AS=$ac_cv_prog_ac_ct_AS
if test -n "$ac_ct_AS"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
-echo "${ECHO_T}$ac_ct_AS" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AS" = x; then
- AS=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AS=$ac_ct_AS
- fi
+ AS=$ac_ct_AS
else
AS="$ac_cv_prog_AS"
fi
@@ -3233,8 +2616,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3247,34 +2630,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3287,41 +2668,26 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AR" = x; then
- AR=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AR=$ac_ct_AR
- fi
+ AR=$ac_ct_AR
else
AR="$ac_cv_prog_AR"
fi
@@ -3329,8 +2695,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3343,34 +2709,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3383,41 +2747,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- RANLIB=$ac_ct_RANLIB
- fi
+ RANLIB=$ac_ct_RANLIB
else
RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -3425,8 +2775,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
set dummy ${ac_tool_prefix}readelf; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_READELF+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3439,34 +2789,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_READELF="${ac_tool_prefix}readelf"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
READELF=$ac_cv_prog_READELF
if test -n "$READELF"; then
- { echo "$as_me:$LINENO: result: $READELF" >&5
-echo "${ECHO_T}$READELF" >&6; }
+ echo "$as_me:$LINENO: result: $READELF" >&5
+echo "${ECHO_T}$READELF" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_READELF"; then
ac_ct_READELF=$READELF
# Extract the first word of "readelf", so it can be a program name with args.
set dummy readelf; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_READELF+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3479,41 +2827,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_READELF="readelf"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_READELF" && ac_cv_prog_ac_ct_READELF=":"
fi
fi
ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
if test -n "$ac_ct_READELF"; then
- { echo "$as_me:$LINENO: result: $ac_ct_READELF" >&5
-echo "${ECHO_T}$ac_ct_READELF" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_READELF" >&5
+echo "${ECHO_T}$ac_ct_READELF" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_READELF" = x; then
- READELF=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- READELF=$ac_ct_READELF
- fi
+ READELF=$ac_ct_READELF
else
READELF="$ac_cv_prog_READELF"
fi
@@ -3532,8 +2866,8 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
if test -z "$INSTALL"; then
if test "${ac_cv_path_install+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3555,7 +2889,7 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -3574,22 +2908,21 @@ case $as_dir/ in
;;
esac
done
-IFS=$as_save_IFS
fi
if test "${ac_cv_path_install+set}" = set; then
INSTALL=$ac_cv_path_install
else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
+ # As a last resort, use the slow shell script. We don't cache a
+ # path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
+ # removed, or if the path is relative.
INSTALL=$ac_install_sh
fi
fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -3603,17 +2936,17 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
# Hack to ensure that INSTALL won't be set to "../" with autoconf 2.13. */
ac_given_INSTALL=$INSTALL
-{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
- # Check whether --enable-maintainer-mode was given.
+echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6
+ # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
- enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
+ enableval="$enable_maintainer_mode"
+ USE_MAINTAINER_MODE=$enableval
else
USE_MAINTAINER_MODE=no
-fi
-
- { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
-echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
+fi;
+ echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6
if test $USE_MAINTAINER_MODE = yes; then
@@ -3733,89 +3066,64 @@ OBJEXT=${oext}
-{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
- for ac_i in 1 2 3 4 5 6 7; do
- ac_script="$ac_script$as_nl$ac_script"
- done
- echo "$ac_script" | sed 99q >conftest.sed
- $as_unset ac_script || ac_script=
- # Extract the first word of "sed gsed" to use in msg output
-if test -z "$SED"; then
-set dummy sed gsed; ac_prog_name=$2
-if test "${ac_cv_path_SED+set}" = set; then
+echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6
+if test "${lt_cv_path_SED+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_path_SED_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in sed gsed; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
- # Check for GNU ac_path_SED and select it if it is found.
- # Check for GNU $ac_path_SED
-case `"$ac_path_SED" --version 2>&1` in
-*GNU*)
- ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo '' >> "conftest.nl"
- "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_SED_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_SED="$ac_path_SED"
- ac_path_SED_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_SED_found && break 3
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
done
done
-
-done
IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
-
-fi
-
-SED="$ac_cv_path_SED"
-if test -z "$SED"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in \$PATH" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in \$PATH" >&2;}
- { (exit 1); exit 1; }; }
fi
-else
- ac_cv_path_SED=$SED
-fi
+SED=$lt_cv_path_SED
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
-echo "${ECHO_T}$ac_cv_path_SED" >&6; }
- SED="$ac_cv_path_SED"
- rm -f conftest.sed
+echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
test -z "$SED" && SED=sed
Xsed="$SED -e 1s/^X//"
@@ -3838,8 +3146,8 @@ case $host in
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
set dummy ${ac_tool_prefix}as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3852,34 +3160,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AS="${ac_tool_prefix}as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AS=$ac_cv_prog_AS
if test -n "$AS"; then
- { echo "$as_me:$LINENO: result: $AS" >&5
-echo "${ECHO_T}$AS" >&6; }
+ echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AS"; then
ac_ct_AS=$AS
# Extract the first word of "as", so it can be a program name with args.
set dummy as; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3892,41 +3198,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AS="as"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_AS" && ac_cv_prog_ac_ct_AS="false"
fi
fi
ac_ct_AS=$ac_cv_prog_ac_ct_AS
if test -n "$ac_ct_AS"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
-echo "${ECHO_T}$ac_ct_AS" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AS" = x; then
- AS="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AS=$ac_ct_AS
- fi
+ AS=$ac_ct_AS
else
AS="$ac_cv_prog_AS"
fi
@@ -3934,8 +3226,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3948,34 +3240,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
DLLTOOL=$ac_cv_prog_DLLTOOL
if test -n "$DLLTOOL"; then
- { echo "$as_me:$LINENO: result: $DLLTOOL" >&5
-echo "${ECHO_T}$DLLTOOL" >&6; }
+ echo "$as_me:$LINENO: result: $DLLTOOL" >&5
+echo "${ECHO_T}$DLLTOOL" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_DLLTOOL"; then
ac_ct_DLLTOOL=$DLLTOOL
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -3988,41 +3278,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_DLLTOOL" && ac_cv_prog_ac_ct_DLLTOOL="false"
fi
fi
ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
if test -n "$ac_ct_DLLTOOL"; then
- { echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
-echo "${ECHO_T}$ac_ct_DLLTOOL" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
+echo "${ECHO_T}$ac_ct_DLLTOOL" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_DLLTOOL" = x; then
- DLLTOOL="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- DLLTOOL=$ac_ct_DLLTOOL
- fi
+ DLLTOOL=$ac_ct_DLLTOOL
else
DLLTOOL="$ac_cv_prog_DLLTOOL"
fi
@@ -4030,8 +3306,8 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_OBJDUMP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4044,34 +3320,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
OBJDUMP=$ac_cv_prog_OBJDUMP
if test -n "$OBJDUMP"; then
- { echo "$as_me:$LINENO: result: $OBJDUMP" >&5
-echo "${ECHO_T}$OBJDUMP" >&6; }
+ echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+echo "${ECHO_T}$OBJDUMP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_OBJDUMP"; then
ac_ct_OBJDUMP=$OBJDUMP
# Extract the first word of "objdump", so it can be a program name with args.
set dummy objdump; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4084,41 +3358,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_OBJDUMP="objdump"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_OBJDUMP" && ac_cv_prog_ac_ct_OBJDUMP="false"
fi
fi
ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
if test -n "$ac_ct_OBJDUMP"; then
- { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
-echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+echo "${ECHO_T}$ac_ct_OBJDUMP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_OBJDUMP" = x; then
- OBJDUMP="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- OBJDUMP=$ac_ct_OBJDUMP
- fi
+ OBJDUMP=$ac_ct_OBJDUMP
else
OBJDUMP="$ac_cv_prog_OBJDUMP"
fi
@@ -4170,9 +3430,10 @@ enable_dlopen=no
-# Check whether --enable-shared was given.
+# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
- enableval=$enable_shared; p=${PACKAGE-default}
+ enableval="$enable_shared"
+ p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
@@ -4191,8 +3452,7 @@ if test "${enable_shared+set}" = set; then
esac
else
enable_shared=yes
-fi
-
+fi;
@@ -4201,9 +3461,10 @@ fi
-# Check whether --enable-static was given.
+# Check whether --enable-static or --disable-static was given.
if test "${enable_static+set}" = set; then
- enableval=$enable_static; p=${PACKAGE-default}
+ enableval="$enable_static"
+ p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
no) enable_static=no ;;
@@ -4222,8 +3483,7 @@ if test "${enable_static+set}" = set; then
esac
else
enable_static=yes
-fi
-
+fi;
@@ -4233,13 +3493,13 @@ fi
-# Check whether --with-pic was given.
+# Check whether --with-pic or --without-pic was given.
if test "${with_pic+set}" = set; then
- withval=$with_pic; pic_mode="$withval"
+ withval="$with_pic"
+ pic_mode="$withval"
else
pic_mode=default
-fi
-
+fi;
test -z "$pic_mode" && pic_mode=default
@@ -4249,9 +3509,10 @@ test -z "$pic_mode" && pic_mode=default
-# Check whether --enable-fast-install was given.
+# Check whether --enable-fast-install or --disable-fast-install was given.
if test "${enable_fast_install+set}" = set; then
- enableval=$enable_fast_install; p=${PACKAGE-default}
+ enableval="$enable_fast_install"
+ p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
@@ -4270,8 +3531,7 @@ if test "${enable_fast_install+set}" = set; then
esac
else
enable_fast_install=yes
-fi
-
+fi;
@@ -4288,8 +3548,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4302,34 +3562,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4342,51 +3600,36 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
+ CC=$ac_ct_CC
else
CC="$ac_cv_prog_CC"
fi
if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4399,34 +3642,74 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="cc"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ CC=$ac_ct_CC
+else
+ CC="$ac_cv_prog_CC"
+fi
+
fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4440,7 +3723,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -4451,7 +3734,6 @@ do
fi
done
done
-IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
# We found a bogon in the path, so make sure we never use it.
@@ -4469,23 +3751,22 @@ fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
- for ac_prog in cl.exe
+ for ac_prog in cl
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4498,38 +3779,36 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$CC" && break
done
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in cl.exe
+ for ac_prog in cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4542,45 +3821,29 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$ac_ct_CC" && break
done
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
+ CC=$ac_ct_CC
fi
fi
@@ -4593,35 +3856,21 @@ See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler --version >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -v >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -V >&5") 2>&5
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }
@@ -4646,77 +3895,47 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort. b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions. Remove them first so a
-# subsequent execution test works.
-ac_rmfiles=
-for ac_file in $ac_files
-do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
- esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link_default") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile. We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
- then :; else
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- fi
- # We set ac_cv_exeext here because the later test for it is not
- # safe: cross compilers may not add the suffix if given an `-o'
- # argument, so we may need to know it at that point already.
- # Even if this section looks crufty: it has the advantage of
- # actually working.
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
break;;
* )
break;;
esac
done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
else
- ac_file=''
-fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
@@ -4728,21 +3947,19 @@ See \`config.log' for more details." >&2;}
fi
ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
-# Check that the compiler produces executables we can run. If not, either
+# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
# If not cross compiling, check that we can run a simple program.
if test "$cross_compiling" != yes; then
if { ac_try='./$ac_file'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -4761,27 +3978,22 @@ See \`config.log' for more details." >&2;}
fi
fi
fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
+# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
@@ -4792,8 +4004,9 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
break;;
* ) break;;
esac
@@ -4807,14 +4020,14 @@ See \`config.log' for more details." >&2;}
fi
rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4834,20 +4047,14 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; then
- for ac_file in conftest.o conftest.obj conftest.*; do
- test -f "$ac_file" || continue;
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
@@ -4865,12 +4072,12 @@ fi
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -4893,49 +4100,50 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_compiler_gnu=no
+ac_compiler_gnu=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -4951,118 +4159,38 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); }; }; then
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
+ac_cv_prog_cc_g=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
@@ -5078,12 +4206,12 @@ else
CFLAGS=
fi
fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_prog_cc_c89=no
+ ac_cv_prog_cc_stdc=no
ac_save_CC=$CC
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -5117,17 +4245,12 @@ static char *f (char * (*g) (char **, int), char **p, ...)
/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
function prototypes and stuff, but not '\xHH' hex character constants.
These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std is added to get
+ as 'x'. The following induces an error, until -std1 is added to get
proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std. */
+ that's true only with -std1. */
int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
- inside strings and character constants. */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
@@ -5142,57 +4265,205 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
return 0;
}
_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_c89=$ac_arg
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c89" != "xno" && break
+rm -f conftest.err conftest.$ac_objext
done
-rm -f conftest.$ac_ext
+rm -f conftest.$ac_ext conftest.$ac_objext
CC=$ac_save_CC
fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
- x)
- { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
- xno)
- { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
*)
- CC="$CC $ac_cv_prog_cc_c89"
- { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
esac
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ '' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -5201,8 +4472,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
depcc="$CC" am_compiler_list=
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5291,8 +4562,8 @@ else
fi
fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
@@ -5308,249 +4579,34 @@ else
fi
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
- # Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_GREP_found && break 3
- done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-else
- ac_cv_path_GREP=$GREP
-fi
-
-
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
+echo "$as_me:$LINENO: checking for fgrep" >&5
+echo $ECHO_N "checking for fgrep... $ECHO_C" >&6
+if test "${ac_cv_prog_fgrep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
- # Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
+ if echo 'ab*c' | (grep -F 'ab*c') >/dev/null 2>&1
+ then ac_cv_prog_fgrep='grep -F'
+ else ac_cv_prog_fgrep='fgrep'
fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_EGREP_found && break 3
- done
-done
-
-done
-IFS=$as_save_IFS
-
-
fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
-
- fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ echo "$as_me:$LINENO: checking for fgrep" >&5
-echo $ECHO_N "checking for fgrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_FGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
- then ac_cv_path_FGREP="$GREP -F"
- else
- # Extract the first word of "fgrep" to use in msg output
-if test -z "$FGREP"; then
-set dummy fgrep; ac_prog_name=$2
-if test "${ac_cv_path_FGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_path_FGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in fgrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
- # Check for GNU ac_path_FGREP and select it if it is found.
- # Check for GNU $ac_path_FGREP
-case `"$ac_path_FGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
-*)
- ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- echo 'FGREP' >> "conftest.nl"
- "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
- if test $ac_count -gt ${ac_path_FGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_FGREP="$ac_path_FGREP"
- ac_path_FGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
- $ac_path_FGREP_found && break 3
- done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-FGREP="$ac_cv_path_FGREP"
-if test -z "$FGREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-else
- ac_cv_path_FGREP=$FGREP
-fi
-
-
- fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
-echo "${ECHO_T}$ac_cv_path_FGREP" >&6; }
- FGREP="$ac_cv_path_FGREP"
+echo "$as_me:$LINENO: result: $ac_cv_prog_fgrep" >&5
+echo "${ECHO_T}$ac_cv_prog_fgrep" >&6
+ FGREP=$ac_cv_prog_fgrep
test -z "$GREP" && GREP=grep
@@ -5573,18 +4629,18 @@ test -z "$GREP" && GREP=grep
-# Check whether --with-gnu-ld was given.
+# Check whether --with-gnu-ld or --without-gnu-ld was given.
if test "${with_gnu_ld+set}" = set; then
- withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+ withval="$with_gnu_ld"
+ test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
-fi
-
+fi;
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
- { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -5613,11 +4669,11 @@ echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
;;
esac
elif test "$with_gnu_ld" = yes; then
- { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6
else
- { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6
fi
if test "${lt_cv_path_LD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -5650,17 +4706,17 @@ fi
LD="$lt_cv_path_LD"
if test -n "$LD"; then
- { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+ echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
{ (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6
if test "${lt_cv_prog_gnu_ld+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5674,8 +4730,8 @@ case `$LD -v 2>&1 </dev/null` in
;;
esac
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6
with_gnu_ld=$lt_cv_prog_gnu_ld
@@ -5687,8 +4743,8 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
-{ echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
-echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+echo $ECHO_N "checking for BSD- or MS-compatible name lister (nm)... $ECHO_C" >&6
if test "${lt_cv_path_NM+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5736,8 +4792,8 @@ else
: ${lt_cv_path_NM=no}
fi
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6
if test "$lt_cv_path_NM" != "no"; then
NM="$lt_cv_path_NM"
else
@@ -5747,8 +4803,8 @@ else
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_DUMPBIN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5761,27 +4817,25 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
DUMPBIN=$ac_cv_prog_DUMPBIN
if test -n "$DUMPBIN"; then
- { echo "$as_me:$LINENO: result: $DUMPBIN" >&5
-echo "${ECHO_T}$DUMPBIN" >&6; }
+ echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+echo "${ECHO_T}$DUMPBIN" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$DUMPBIN" && break
done
fi
@@ -5791,8 +4845,8 @@ if test -z "$DUMPBIN"; then
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5805,45 +4859,30 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
if test -n "$ac_ct_DUMPBIN"; then
- { echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
-echo "${ECHO_T}$ac_ct_DUMPBIN" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+echo "${ECHO_T}$ac_ct_DUMPBIN" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
test -n "$ac_ct_DUMPBIN" && break
done
+test -n "$ac_ct_DUMPBIN" || ac_ct_DUMPBIN=":"
- if test "x$ac_ct_DUMPBIN" = x; then
- DUMPBIN=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- DUMPBIN=$ac_ct_DUMPBIN
- fi
+ DUMPBIN=$ac_ct_DUMPBIN
fi
@@ -5858,43 +4897,43 @@ test -z "$NM" && NM=nm
-{ echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
-echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+echo $ECHO_N "checking the name lister ($NM) interface... $ECHO_C" >&6
if test "${lt_cv_nm_interface+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:5868: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:4907: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:5871: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:4910: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:5874: output\"" >&5)
+ (eval echo "\"\$as_me:4913: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
fi
rm -f conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
-echo "${ECHO_T}$lt_cv_nm_interface" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+echo "${ECHO_T}$lt_cv_nm_interface" >&6
-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
LN_S=$as_ln_s
if test "$LN_S" = "ln -s"; then
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6; }
+ echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
fi
# find the maximum length of command line arguments
-{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6
if test "${lt_cv_sys_max_cmd_len+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -5978,46 +5017,40 @@ else
fi
;;
*)
- lt_cv_sys_max_cmd_len=`getconf ARG_MAX 2> /dev/null`
- if test -n $lt_cv_sys_max_cmd_len; then
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
- else
- # Make teststring a little bigger before we do anything with it.
- # a 1K string should be a reasonable start.
- for i in 1 2 3 4 5 6 7 8 ; do
- teststring=$teststring$teststring
- done
- SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
- # If test is not a shell built-in, we'll probably end up computing a
- # maximum length that is only half of the actual maximum length, but
- # we can't tell.
- while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
- = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
- test $i != 17 # 1/2 MB should be enough
- do
- i=`expr $i + 1`
- teststring=$teststring$teststring
- done
- # Only check the string length outside the loop.
- lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
- teststring=
- # Add a significant safety factor because C++ compilers can tack on
- # massive amounts of additional arguments before passing them to the
- # linker. It appears as though 1/2 is a usable value.
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
- fi
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
;;
esac
fi
if test -n $lt_cv_sys_max_cmd_len ; then
- { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+ echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6
else
- { echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6; }
+ echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6
fi
max_cmd_len=$lt_cv_sys_max_cmd_len
@@ -6030,26 +5063,26 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
: ${MV="mv -f"}
: ${RM="rm -f"}
-{ echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
-echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+echo $ECHO_N "checking whether the shell understands some XSI constructs... $ECHO_C" >&6
# Try some XSI features
xsi_shell=no
( _lt_dummy="a/b/c"
test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
= c,a/b,, ) >/dev/null 2>&1 \
&& xsi_shell=yes
-{ echo "$as_me:$LINENO: result: $xsi_shell" >&5
-echo "${ECHO_T}$xsi_shell" >&6; }
+echo "$as_me:$LINENO: result: $xsi_shell" >&5
+echo "${ECHO_T}$xsi_shell" >&6
-{ echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
-echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
+echo $ECHO_N "checking whether the shell understands \"+=\"... $ECHO_C" >&6
lt_shell_append=no
( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
>/dev/null 2>&1 \
&& lt_shell_append=yes
-{ echo "$as_me:$LINENO: result: $lt_shell_append" >&5
-echo "${ECHO_T}$lt_shell_append" >&6; }
+echo "$as_me:$LINENO: result: $lt_shell_append" >&5
+echo "${ECHO_T}$lt_shell_append" >&6
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -6083,15 +5116,15 @@ esac
-{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6
if test "${lt_cv_ld_reload_flag+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_ld_reload_flag='-r'
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6
reload_flag=$lt_cv_ld_reload_flag
case $reload_flag in
"" | " "*) ;;
@@ -6117,8 +5150,8 @@ esac
-{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
-echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6
if test "${lt_cv_deplibs_check_method+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6137,7 +5170,7 @@ lt_cv_deplibs_check_method='unknown'
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
-aix[4-9]*)
+aix4* | aix5*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -6307,8 +5340,8 @@ tpf*)
esac
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -6327,8 +5360,8 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6341,34 +5374,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+ echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6381,41 +5412,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="ar"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_AR" && ac_cv_prog_ac_ct_AR="false"
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_AR" = x; then
- AR="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- AR=$ac_ct_AR
- fi
+ AR=$ac_ct_AR
else
AR="$ac_cv_prog_AR"
fi
@@ -6436,8 +5453,8 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6450,34 +5467,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_STRIP="${ac_tool_prefix}strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
STRIP=$ac_cv_prog_STRIP
if test -n "$STRIP"; then
- { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_STRIP"; then
ac_ct_STRIP=$STRIP
# Extract the first word of "strip", so it can be a program name with args.
set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6490,41 +5505,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_STRIP="strip"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
fi
fi
ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
if test -n "$ac_ct_STRIP"; then
- { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
+ STRIP=$ac_ct_STRIP
else
STRIP="$ac_cv_prog_STRIP"
fi
@@ -6539,8 +5540,8 @@ test -z "$STRIP" && STRIP=:
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6553,34 +5554,32 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
-
fi
if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6593,41 +5592,27 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
-IFS=$as_save_IFS
+ test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
+ echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- RANLIB=$ac_ct_RANLIB
- fi
+ RANLIB=$ac_ct_RANLIB
else
RANLIB="$ac_cv_prog_RANLIB"
fi
@@ -6700,8 +5685,8 @@ compiler=$CC
# Check for command to grab the raw symbol name followed by C symbol from nm.
-{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6
if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -6919,11 +5904,11 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
- { echo "$as_me:$LINENO: result: failed" >&5
-echo "${ECHO_T}failed" >&6; }
+ echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6
else
- { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; }
+ echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6
fi
@@ -6943,11 +5928,11 @@ fi
-# Check whether --enable-libtool-lock was given.
+# Check whether --enable-libtool-lock or --disable-libtool-lock was given.
if test "${enable_libtool_lock+set}" = set; then
- enableval=$enable_libtool_lock;
-fi
+ enableval="$enable_libtool_lock"
+fi;
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
@@ -6974,7 +5959,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6977 "configure"' > conftest.$ac_ext
+ echo '#line 5962 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7066,8 +6051,8 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
- { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6
if test "${lt_cv_cc_needs_belf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7093,32 +6078,35 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
lt_cv_cc_needs_belf=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- lt_cv_cc_needs_belf=no
+lt_cv_cc_needs_belf=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -7127,8 +6115,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
@@ -7162,8 +6150,8 @@ ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -7197,22 +6185,24 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
@@ -7221,10 +6211,9 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
-
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether nonexistent headers
+ # OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -7234,22 +6223,24 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
@@ -7260,7 +6251,6 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
-
rm -f conftest.err conftest.$ac_ext
done
@@ -7278,8 +6268,8 @@ fi
else
ac_cv_prog_CPP=$CPP
fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
@@ -7302,22 +6292,24 @@ cat >>conftest.$ac_ext <<_ACEOF
#endif
Syntax error
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
@@ -7326,10 +6318,9 @@ sed 's/^/| /' conftest.$ac_ext >&5
# Broken: fails on valid input.
continue
fi
-
rm -f conftest.err conftest.$ac_ext
- # OK, works on sane cases. Now check whether nonexistent headers
+ # OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
@@ -7339,22 +6330,24 @@ cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
# Broken: success on invalid input.
continue
else
@@ -7365,7 +6358,6 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_preproc_ok=:
break
fi
-
rm -f conftest.err conftest.$ac_ext
done
@@ -7388,8 +6380,8 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7413,31 +6405,35 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_header_stdc=no
+ac_cv_header_stdc=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
@@ -7493,7 +6489,6 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ctype.h>
-#include <stdlib.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
@@ -7513,27 +6508,18 @@ main ()
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
|| toupper (i) != TOUPPER (i))
- return 2;
- return 0;
+ exit(2);
+ exit (0);
}
_ACEOF
rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
@@ -7546,14 +6532,12 @@ sed 's/^/| /' conftest.$ac_ext >&5
( exit $ac_status )
ac_cv_header_stdc=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-
-
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
if test $ac_cv_header_stdc = yes; then
cat >>confdefs.h <<\_ACEOF
@@ -7576,9 +6560,9 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -7592,35 +6576,38 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- eval "$as_ac_Header=no"
+eval "$as_ac_Header=no"
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -7635,9 +6622,9 @@ done
for ac_header in dlfcn.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
@@ -7651,35 +6638,38 @@ $ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compile") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- eval "$as_ac_Header=no"
+eval "$as_ac_Header=no"
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -7740,8 +6730,8 @@ if test -n "${ZSH_VERSION+set}" ; then
setopt NO_GLOB_SUBST
fi
-{ echo "$as_me:$LINENO: checking for objdir" >&5
-echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6
if test "${lt_cv_objdir+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7755,8 +6745,8 @@ else
fi
rmdir .libs 2>/dev/null
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-echo "${ECHO_T}$lt_cv_objdir" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6
objdir=$lt_cv_objdir
@@ -7848,8 +6838,8 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6
if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7901,11 +6891,11 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
@@ -7914,8 +6904,8 @@ fi
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
- { echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6
if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -7967,11 +6957,11 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
+ echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
@@ -8051,8 +7041,8 @@ lt_prog_compiler_no_builtin_flag=
if test "$GCC" = yes; then
lt_prog_compiler_no_builtin_flag=' -fno-builtin'
- { echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6
if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8069,11 +7059,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8072: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7062: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8076: \$? = $ac_status" >&5
+ echo "$as_me:7066: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8086,8 +7076,8 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6
if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
@@ -8106,8 +7096,8 @@ fi
lt_prog_compiler_pic=
lt_prog_compiler_static=
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6
if test "$GCC" = yes; then
lt_prog_compiler_wl='-Wl,'
@@ -8361,8 +7351,8 @@ case $host_os in
lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
;;
esac
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6
@@ -8373,8 +7363,8 @@ echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic"; then
- { echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6
if test "${lt_prog_compiler_pic_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8391,11 +7381,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8394: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7384: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8398: \$? = $ac_status" >&5
+ echo "$as_me:7388: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8408,8 +7398,8 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6
if test x"$lt_prog_compiler_pic_works" = xyes; then
case $lt_prog_compiler_pic in
@@ -8432,8 +7422,8 @@ fi
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6
if test "${lt_prog_compiler_static_works+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8460,8 +7450,8 @@ else
LDFLAGS="$save_LDFLAGS"
fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
+echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6
if test x"$lt_prog_compiler_static_works" = xyes; then
:
@@ -8475,8 +7465,8 @@ fi
- { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
if test "${lt_cv_prog_compiler_c_o+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8496,11 +7486,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8499: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7489: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8503: \$? = $ac_status" >&5
+ echo "$as_me:7493: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8522,16 +7512,16 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
- { echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6
if test "${lt_cv_prog_compiler_c_o+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -8551,11 +7541,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8554: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7544: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8558: \$? = $ac_status" >&5
+ echo "$as_me:7548: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8577,8 +7567,8 @@ else
$RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6
@@ -8586,16 +7576,16 @@ echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
- { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6
hard_links=yes
$RM conftest*
ln conftest.a conftest.b 2>/dev/null && hard_links=no
touch conftest.a
ln conftest.a conftest.b 2>&5 || hard_links=no
ln conftest.a conftest.b 2>/dev/null && hard_links=no
- { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
+ echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6
if test "$hard_links" = no; then
{ echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
@@ -8610,8 +7600,8 @@ fi
- { echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6
runpath_var=
allow_undefined_flag=
@@ -8699,7 +7689,7 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
# See if GNU ld supports shared libraries.
case $host_os in
- aix[3-9]*)
+ aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
@@ -8933,7 +7923,7 @@ _LT_EOF
fi
;;
- aix[4-9]*)
+ aix4* | aix5*)
if test "$host_cpu" = ia64; then
# On IA64, the linker does run time linking by default, so we don't
# have to do anything special.
@@ -8953,7 +7943,7 @@ _LT_EOF
# Test if we are trying to use run time linking or normal
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
# need to do runtime linking.
- case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
aix_use_runtimelinking=yes
@@ -9046,23 +8036,27 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
@@ -9080,10 +8074,8 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -9113,23 +8105,27 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
@@ -9147,10 +8143,8 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
@@ -9405,33 +8399,35 @@ fi
int foo(void) {}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS="$save_LDFLAGS"
else
@@ -9684,8 +8680,8 @@ rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
fi
fi
-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6; }
+echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6
test "$ld_shlibs" = no && can_build_shared=no
with_gnu_ld=$with_gnu_ld
@@ -9721,8 +8717,8 @@ x|xyes)
# Test whether the compiler implicitly links with -lc since on some
# systems, -lgcc has to come before -lc. If gcc already passes -lc
# to ld, don't add -lc before -lgcc.
- { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6
$RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
@@ -9759,8 +8755,8 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
cat conftest.err 1>&5
fi
$RM conftest*
- { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+ echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6
;;
esac
fi
@@ -9923,8 +8919,8 @@ esac
- { echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6
withGCC=$GCC
if test "$withGCC" = yes; then
case $host_os in
@@ -10007,7 +9003,7 @@ aix3*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
-aix[4-9]*)
+aix4* | aix5*)
version_type=linux
need_lib_prefix=no
need_version=no
@@ -10356,23 +9352,27 @@ main ()
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir"; then
shlibpath_overrides_runpath=yes
fi
@@ -10381,10 +9381,8 @@ else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LDFLAGS=$save_LDFLAGS
libdir=$save_libdir
@@ -10597,8 +9595,8 @@ uts4*)
dynamic_linker=no
;;
esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -10692,8 +9690,8 @@ fi
- { echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6
hardcode_action=
if test -n "$hardcode_libdir_flag_spec" ||
test -n "$runpath_var" ||
@@ -10717,8 +9715,8 @@ else
# directories.
hardcode_action=unsupported
fi
-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6; }
+echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6
if test "$hardcode_action" = relink ||
test "$inherit_rpath" = yes; then
@@ -10762,8 +9760,8 @@ else
darwin*)
# if libdl is installed we need to link against it
- { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -10776,53 +9774,56 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-return dlopen ();
+dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dl_dlopen=no
+ac_cv_lib_dl_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
@@ -10836,8 +9837,8 @@ fi
;;
*)
- { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6
if test "${ac_cv_func_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -10864,64 +9865,73 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef shl_load
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
+{
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char shl_load ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined __stub_shl_load || defined __stub___shl_load
+#if defined (__stub_shl_load) || defined (__stub___shl_load)
choke me
+#else
+char (*f) () = shl_load;
+#endif
+#ifdef __cplusplus
+}
#endif
int
main ()
{
-return shl_load ();
+return f != shl_load;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_func_shl_load=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_func_shl_load=no
+ac_cv_func_shl_load=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6
if test $ac_cv_func_shl_load = yes; then
lt_cv_dlopen="shl_load"
else
- { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
if test "${ac_cv_lib_dld_shl_load+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -10934,58 +9944,61 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char shl_load ();
int
main ()
{
-return shl_load ();
+shl_load ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dld_shl_load=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dld_shl_load=no
+ac_cv_lib_dld_shl_load=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
if test $ac_cv_lib_dld_shl_load = yes; then
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
else
- { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
if test "${ac_cv_func_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11012,64 +10025,73 @@ cat >>conftest.$ac_ext <<_ACEOF
#undef dlopen
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
+{
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined __stub_dlopen || defined __stub___dlopen
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
choke me
+#else
+char (*f) () = dlopen;
+#endif
+#ifdef __cplusplus
+}
#endif
int
main ()
{
-return dlopen ();
+return f != dlopen;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_func_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_func_dlopen=no
+ac_cv_func_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
if test $ac_cv_func_dlopen = yes; then
lt_cv_dlopen="dlopen"
else
- { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
if test "${ac_cv_lib_dl_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11082,58 +10104,61 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-return dlopen ();
+dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dl_dlopen=no
+ac_cv_lib_dl_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
- { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6
if test "${ac_cv_lib_svld_dlopen+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11146,58 +10171,61 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dlopen ();
int
main ()
{
-return dlopen ();
+dlopen ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_svld_dlopen=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_svld_dlopen=no
+ac_cv_lib_svld_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6
if test $ac_cv_lib_svld_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
else
- { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6
if test "${ac_cv_lib_dld_dld_link+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11210,53 +10238,56 @@ cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
+/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
char dld_link ();
int
main ()
{
-return dld_link ();
+dld_link ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_lib_dld_dld_link=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
- ac_cv_lib_dld_dld_link=no
+ac_cv_lib_dld_dld_link=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6
if test $ac_cv_lib_dld_dld_link = yes; then
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
fi
@@ -11296,8 +10327,8 @@ fi
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
- { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6
if test "${lt_cv_dlopen_self+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11307,7 +10338,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11310 "configure"
+#line 10341 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11391,13 +10422,13 @@ rm -fr conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
- { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6
if test "${lt_cv_dlopen_self_static+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
@@ -11407,7 +10438,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11410 "configure"
+#line 10441 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11491,8 +10522,8 @@ rm -fr conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6
fi
CPPFLAGS="$save_CPPFLAGS"
@@ -11530,13 +10561,13 @@ fi
striplib=
old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6
if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
@@ -11544,16 +10575,16 @@ else
if test -n "$STRIP" ; then
striplib="$STRIP -x"
old_striplib="$STRIP -S"
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
fi
;;
*)
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
;;
esac
fi
@@ -11570,13 +10601,13 @@ fi
# Report which library types will actually be built
- { echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
- { echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6; }
+ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6
+ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6
- { echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6
test "$can_build_shared" = "no" && enable_shared=no
# On AIX, shared libraries and static libraries use the same namespace, and
@@ -11590,21 +10621,21 @@ echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
fi
;;
- aix[4-9]*)
+ aix4* | aix5*)
if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
test "$enable_shared" = yes && enable_static=no
fi
;;
esac
- { echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6
- { echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6
# Make sure either enable_shared or enable_static is yes.
test "$enable_shared" = yes || enable_static=yes
- { echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
+ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6
@@ -11630,7 +10661,7 @@ CC="$lt_save_CC"
- ac_config_commands="$ac_config_commands libtool"
+ ac_config_commands="$ac_config_commands libtool"
@@ -11642,53 +10673,101 @@ fi
if test -n "${sys_dir}"; then
case ${sys_dir} in
- a29khif) subdirs="$subdirs a29khif"
+ a29khif)
+
+subdirs="$subdirs a29khif"
;;
- arc) subdirs="$subdirs arc"
+ arc)
+
+subdirs="$subdirs arc"
;;
- arm) subdirs="$subdirs arm"
+ arm)
+
+subdirs="$subdirs arm"
;;
- d10v) subdirs="$subdirs d10v"
+ d10v)
+
+subdirs="$subdirs d10v"
;;
- decstation) subdirs="$subdirs decstation"
+ decstation)
+
+subdirs="$subdirs decstation"
;;
- h8300hms) subdirs="$subdirs h8300hms"
+ h8300hms)
+
+subdirs="$subdirs h8300hms"
;;
- h8500hms) subdirs="$subdirs h8500hms"
+ h8500hms)
+
+subdirs="$subdirs h8500hms"
;;
- linux) subdirs="$subdirs linux"
+ linux)
+
+subdirs="$subdirs linux"
;;
- m88kbug) subdirs="$subdirs m88kbug"
+ m88kbug)
+
+subdirs="$subdirs m88kbug"
;;
- mmixware) subdirs="$subdirs mmixware"
+ mmixware)
+
+subdirs="$subdirs mmixware"
;;
- netware) subdirs="$subdirs netware"
+ netware)
+
+subdirs="$subdirs netware"
;;
- rdos) subdirs="$subdirs rdos"
+ rdos)
+
+subdirs="$subdirs rdos"
;;
- rtems) subdirs="$subdirs rtems"
+ rtems)
+
+subdirs="$subdirs rtems"
;;
- sh) subdirs="$subdirs sh"
+ sh)
+
+subdirs="$subdirs sh"
;;
- sparc64) subdirs="$subdirs sparc64"
+ sparc64)
+
+subdirs="$subdirs sparc64"
;;
- sun4) subdirs="$subdirs sun4"
+ sun4)
+
+subdirs="$subdirs sun4"
;;
- sysmec) subdirs="$subdirs sysmec"
+ sysmec)
+
+subdirs="$subdirs sysmec"
;;
- sysnec810) subdirs="$subdirs sysnec810"
+ sysnec810)
+
+subdirs="$subdirs sysnec810"
;;
- sysnecv850) subdirs="$subdirs sysnecv850"
+ sysnecv850)
+
+subdirs="$subdirs sysnecv850"
;;
- sysvi386) subdirs="$subdirs sysvi386"
+ sysvi386)
+
+subdirs="$subdirs sysvi386"
;;
- sysvnecv70) subdirs="$subdirs sysvnecv70"
+ sysvnecv70)
+
+subdirs="$subdirs sysvnecv70"
;;
- tic80) subdirs="$subdirs tic80"
+ tic80)
+
+subdirs="$subdirs tic80"
;;
- w65) subdirs="$subdirs w65"
+ w65)
+
+subdirs="$subdirs w65"
;;
- z8ksim) subdirs="$subdirs z8ksim"
+ z8ksim)
+
+subdirs="$subdirs z8ksim"
;;
esac;
fi
@@ -11710,7 +10789,7 @@ else
fi
-ac_config_files="$ac_config_files Makefile"
+ ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -11730,58 +10809,39 @@ _ACEOF
# The following way of writing the cache mishandles newlines in values,
# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
+# So, don't put newlines in cache variables' values.
# Ultrix sh set writes to stderr and can't be redirected directly,
# and sets the high bit in the cache file unless we assign to the vars.
-(
- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
-
+{
(set) 2>&1 |
- case $as_nl`(ac_space=' '; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;; #(
+ ;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
- esac |
- sort
-) |
+ esac;
+} |
sed '
- /^ac_cv_env_/b end
t clear
- :clear
+ : clear
s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
t end
- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
- if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
- { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+ if test -w $cache_file; then
+ test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
cat confcache >$cache_file
else
- { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ echo "not updating unwritable cache $cache_file"
fi
fi
rm -f confcache
@@ -11790,48 +10850,63 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
# Let make expand exec_prefix.
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ ]*$//;
+}'
+fi
+
# Transform confdefs.h into DEFS.
# Protect against shell expansion while executing Makefile rules.
# Protect against Makefile macro expansion.
#
# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section. Otherwise,
+# take arguments), then we branch to the quote section. Otherwise,
# look for a macro that doesn't take arguments.
-ac_script='
+cat >confdef2opt.sed <<\_ACEOF
t clear
-:clear
-s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+: clear
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
t quote
-s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
t quote
-b any
-:quote
-s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
- g
- s/^\n//
- s/\n/ /g
- p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
+d
+: quote
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output. A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
ac_libobjs=
ac_ltlibobjs=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
- ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`echo "$ac_i" | sed "$ac_script"`
- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
- # will be set to the directory where LIBOBJS objects are built.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
@@ -11946,45 +11021,17 @@ cat >>$CONFIG_STATUS <<\_ACEOF
## M4sh Initialization. ##
## --------------------- ##
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
+# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
fi
+DUALCASE=1; export DUALCASE # for MKS sh
# Support unset when possible.
if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -11994,43 +11041,8 @@ else
fi
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
+$as_unset ENV MAIL MAILPATH
PS1='$ '
PS2='> '
PS4='+ '
@@ -12044,19 +11056,18 @@ do
if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
eval $as_var=C; export $as_var
else
- ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ $as_unset $as_var
fi
done
# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
as_basename=basename
else
as_basename=false
@@ -12064,120 +11075,159 @@ fi
# Name of the executable.
-as_me=`$as_basename -- "$0" ||
+as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
-# CDPATH.
-$as_unset CDPATH
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
as_lineno_1=$LINENO
as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
# Create $as_me.lineno as a copy of $as_myself, but with $LINENO
# uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
# (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
t loop
- s/-\n.*//
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ chmod +x $as_me.lineno ||
+ { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
{ (exit 1); exit 1; }; }
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
# Exit status is that of the last command.
exit
}
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
+if expr a : '\(a\)' >/dev/null 2>&1; then
as_expr=expr
else
as_expr=false
fi
rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir
-fi
echo >conf$$.file
if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
as_ln_s='cp -p'
fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+rm -f conf$$ conf$$.exe conf$$.file
if mkdir -p . 2>/dev/null; then
as_mkdir_p=:
@@ -12186,28 +11236,7 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -12216,14 +11245,31 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
exec 6>&1
-# Save the log message, to keep $[0] and so on meaningful, and to
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by newlib $as_me 1.16.0, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by newlib $as_me 1.15.0, which was
+generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -12231,19 +11277,30 @@ generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_COMMANDS = $CONFIG_COMMANDS
$ $0 $@
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
-config_files="$ac_config_files"
-config_commands="$ac_config_commands"
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
-_ACEOF
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
cat >>$CONFIG_STATUS <<\_ACEOF
+
ac_cs_usage="\
\`$as_me' instantiates files from templates according to the
current configuration.
@@ -12251,7 +11308,7 @@ current configuration.
Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
- -V, --version print version number and configuration settings, then exit
+ -V, --version print version number, then exit
-q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
@@ -12265,21 +11322,19 @@ Configuration commands:
$config_commands
Report bugs to <bug-autoconf@gnu.org>."
-
_ACEOF
+
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-newlib config.status 1.16.0
-configured by $0, generated by GNU Autoconf 2.61,
- with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+newlib config.status 1.15.0
+configured by $0, generated by GNU Autoconf 2.59,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
+srcdir=$srcdir
+INSTALL="$INSTALL"
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
@@ -12290,42 +11345,60 @@ while test $# != 0
do
case $1 in
--*=*)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_option=`expr "x$1" : 'x\([^=]*\)='`
+ ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
ac_shift=:
;;
- *)
+ -*)
ac_option=$1
ac_optarg=$2
ac_shift=shift
;;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_option=$1
+ ac_need_defaults=false;;
esac
case $ac_option in
# Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- echo "$ac_cs_version"; exit ;;
- --debug | --debu | --deb | --de | --d | -d )
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
- --he | --h | --help | --hel | -h )
- echo "$ac_cs_usage"; exit ;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ ac_need_defaults=false;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
{ (exit 1); exit 1; }; } ;;
- *) ac_config_targets="$ac_config_targets $1"
- ac_need_defaults=false ;;
+ *) ac_config_targets="$ac_config_targets $1" ;;
esac
shift
@@ -12341,28 +11414,17 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
- echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- CONFIG_SHELL=$SHELL
- export CONFIG_SHELL
- exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
- echo "$ac_log"
-} >&5
-_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
#
-# INIT-COMMANDS
+# INIT-COMMANDS section.
#
+
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
@@ -12611,23 +11673,22 @@ fi
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# Handling of arguments.
+
+cat >>$CONFIG_STATUS <<\_ACEOF
for ac_config_target in $ac_config_targets
do
- case $ac_config_target in
- "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
- "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
- "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool" ) CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
*) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
{ (exit 1); exit 1; }; };;
esac
done
-
# If the user did not use the arguments to specify the items to instantiate,
# then the envvar interface is used. Set only those that are not.
# We use the long form for the default assignment because of an extremely
@@ -12638,488 +11699,387 @@ if $ac_need_defaults; then
fi
# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
+# simply because there is no reason to put it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
+# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
- tmp=
- trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
trap '{ (exit 1); exit 1; }' 1 2 13 15
}
+
# Create a (secure) tmp directory for tmp files.
{
- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
+ tmp=./confstat$$-$RANDOM
+ (umask 077 && mkdir $tmp)
} ||
{
echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
#
-# Set up the sed scripts for CONFIG_FILES section.
+# CONFIG_FILES section.
#
# No need to generate the scripts if there are no CONFIG_FILES.
# This happens for instance when ./config.status config.h
-if test -n "$CONFIG_FILES"; then
-
-_ACEOF
-
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-MAY_SUPPLY_SYSCALLS_TRUE!$MAY_SUPPLY_SYSCALLS_TRUE$ac_delim
-MAY_SUPPLY_SYSCALLS_FALSE!$MAY_SUPPLY_SYSCALLS_FALSE$ac_delim
-newlib_basedir!$newlib_basedir$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-CYGPATH_W!$CYGPATH_W$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-VERSION!$VERSION$ac_delim
-ACLOCAL!$ACLOCAL$ac_delim
-AUTOCONF!$AUTOCONF$ac_delim
-AUTOMAKE!$AUTOMAKE$ac_delim
-AUTOHEADER!$AUTOHEADER$ac_delim
-MAKEINFO!$MAKEINFO$ac_delim
-install_sh!$install_sh$ac_delim
-STRIP!$STRIP$ac_delim
-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-AWK!$AWK$ac_delim
-SET_MAKE!$SET_MAKE$ac_delim
-am__leading_dot!$am__leading_dot$ac_delim
-AMTAR!$AMTAR$ac_delim
-am__tar!$am__tar$ac_delim
-am__untar!$am__untar$ac_delim
-CC!$CC$ac_delim
-DEPDIR!$DEPDIR$ac_delim
-am__include!$am__include$ac_delim
-am__quote!$am__quote$ac_delim
-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
-CCDEPMODE!$CCDEPMODE$ac_delim
-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
-AS!$AS$ac_delim
-AR!$AR$ac_delim
-RANLIB!$RANLIB$ac_delim
-READELF!$READELF$ac_delim
-MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
-MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
-MAINT!$MAINT$ac_delim
-CCAS!$CCAS$ac_delim
-CCASFLAGS!$CCASFLAGS$ac_delim
-NEWLIB_CFLAGS!$NEWLIB_CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-ELIX_LEVEL_0_TRUE!$ELIX_LEVEL_0_TRUE$ac_delim
-ELIX_LEVEL_0_FALSE!$ELIX_LEVEL_0_FALSE$ac_delim
-ELIX_LEVEL_1_TRUE!$ELIX_LEVEL_1_TRUE$ac_delim
-ELIX_LEVEL_1_FALSE!$ELIX_LEVEL_1_FALSE$ac_delim
-ELIX_LEVEL_2_TRUE!$ELIX_LEVEL_2_TRUE$ac_delim
-ELIX_LEVEL_2_FALSE!$ELIX_LEVEL_2_FALSE$ac_delim
-ELIX_LEVEL_3_TRUE!$ELIX_LEVEL_3_TRUE$ac_delim
-_ACEOF
-
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
- break
- elif $ac_last_try; then
- { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
- ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
- ac_eof=`expr $ac_eof + 1`
-fi
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@MAY_SUPPLY_SYSCALLS_TRUE@,$MAY_SUPPLY_SYSCALLS_TRUE,;t t
+s,@MAY_SUPPLY_SYSCALLS_FALSE@,$MAY_SUPPLY_SYSCALLS_FALSE,;t t
+s,@newlib_basedir@,$newlib_basedir,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@CC@,$CC,;t t
+s,@DEPDIR@,$DEPDIR,;t t
+s,@am__include@,$am__include,;t t
+s,@am__quote@,$am__quote,;t t
+s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s,@CCDEPMODE@,$CCDEPMODE,;t t
+s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s,@AS@,$AS,;t t
+s,@ac_ct_AS@,$ac_ct_AS,;t t
+s,@AR@,$AR,;t t
+s,@ac_ct_AR@,$ac_ct_AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@READELF@,$READELF,;t t
+s,@ac_ct_READELF@,$ac_ct_READELF,;t t
+s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t
+s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t
+s,@MAINT@,$MAINT,;t t
+s,@CCAS@,$CCAS,;t t
+s,@CCASFLAGS@,$CCASFLAGS,;t t
+s,@NEWLIB_CFLAGS@,$NEWLIB_CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@ELIX_LEVEL_0_TRUE@,$ELIX_LEVEL_0_TRUE,;t t
+s,@ELIX_LEVEL_0_FALSE@,$ELIX_LEVEL_0_FALSE,;t t
+s,@ELIX_LEVEL_1_TRUE@,$ELIX_LEVEL_1_TRUE,;t t
+s,@ELIX_LEVEL_1_FALSE@,$ELIX_LEVEL_1_FALSE,;t t
+s,@ELIX_LEVEL_2_TRUE@,$ELIX_LEVEL_2_TRUE,;t t
+s,@ELIX_LEVEL_2_FALSE@,$ELIX_LEVEL_2_FALSE,;t t
+s,@ELIX_LEVEL_3_TRUE@,$ELIX_LEVEL_3_TRUE,;t t
+s,@ELIX_LEVEL_3_FALSE@,$ELIX_LEVEL_3_FALSE,;t t
+s,@ELIX_LEVEL_4_TRUE@,$ELIX_LEVEL_4_TRUE,;t t
+s,@ELIX_LEVEL_4_FALSE@,$ELIX_LEVEL_4_FALSE,;t t
+s,@USE_LIBTOOL_TRUE@,$USE_LIBTOOL_TRUE,;t t
+s,@USE_LIBTOOL_FALSE@,$USE_LIBTOOL_FALSE,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@oext@,$oext,;t t
+s,@aext@,$aext,;t t
+s,@lpfx@,$lpfx,;t t
+s,@libm_machine_dir@,$libm_machine_dir,;t t
+s,@machine_dir@,$machine_dir,;t t
+s,@sys_dir@,$sys_dir,;t t
+s,@SED@,$SED,;t t
+s,@DLLTOOL@,$DLLTOOL,;t t
+s,@ac_ct_DLLTOOL@,$ac_ct_DLLTOOL,;t t
+s,@OBJDUMP@,$OBJDUMP,;t t
+s,@ac_ct_OBJDUMP@,$ac_ct_OBJDUMP,;t t
+s,@LIBTOOL@,$LIBTOOL,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@EGREP@,$EGREP,;t t
+s,@FGREP@,$FGREP,;t t
+s,@GREP@,$GREP,;t t
+s,@LD@,$LD,;t t
+s,@DUMPBIN@,$DUMPBIN,;t t
+s,@ac_ct_DUMPBIN@,$ac_ct_DUMPBIN,;t t
+s,@NM@,$NM,;t t
+s,@LN_S@,$LN_S,;t t
+s,@lt_ECHO@,$lt_ECHO,;t t
+s,@CPP@,$CPP,;t t
+s,@subdirs@,$subdirs,;t t
+s,@CRT0@,$CRT0,;t t
+s,@HAVE_SYS_DIR_TRUE@,$HAVE_SYS_DIR_TRUE,;t t
+s,@HAVE_SYS_DIR_FALSE@,$HAVE_SYS_DIR_FALSE,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-CEOF$ac_eof
-_ACEOF
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- cat >conf$$subs.sed <<_ACEOF
-ELIX_LEVEL_3_FALSE!$ELIX_LEVEL_3_FALSE$ac_delim
-ELIX_LEVEL_4_TRUE!$ELIX_LEVEL_4_TRUE$ac_delim
-ELIX_LEVEL_4_FALSE!$ELIX_LEVEL_4_FALSE$ac_delim
-USE_LIBTOOL_TRUE!$USE_LIBTOOL_TRUE$ac_delim
-USE_LIBTOOL_FALSE!$USE_LIBTOOL_FALSE$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-oext!$oext$ac_delim
-aext!$aext$ac_delim
-lpfx!$lpfx$ac_delim
-libm_machine_dir!$libm_machine_dir$ac_delim
-machine_dir!$machine_dir$ac_delim
-sys_dir!$sys_dir$ac_delim
-SED!$SED$ac_delim
-DLLTOOL!$DLLTOOL$ac_delim
-OBJDUMP!$OBJDUMP$ac_delim
-LIBTOOL!$LIBTOOL$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-FGREP!$FGREP$ac_delim
-LD!$LD$ac_delim
-DUMPBIN!$DUMPBIN$ac_delim
-ac_ct_DUMPBIN!$ac_ct_DUMPBIN$ac_delim
-NM!$NM$ac_delim
-LN_S!$LN_S$ac_delim
-lt_ECHO!$lt_ECHO$ac_delim
-CPP!$CPP$ac_delim
-subdirs!$subdirs$ac_delim
-CRT0!$CRT0$ac_delim
-HAVE_SYS_DIR_TRUE!$HAVE_SYS_DIR_TRUE$ac_delim
-HAVE_SYS_DIR_FALSE!$HAVE_SYS_DIR_FALSE$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
-
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 36; then
- break
- elif $ac_last_try; then
- { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ cat >>$CONFIG_STATUS <<\_ACEOF
+ # Split the substitutions into bite-sized pieces for seds with
+ # small command number limits, like on Digital OSF/1 and HP-UX.
+ ac_max_sed_lines=48
+ ac_sed_frag=1 # Number of current file.
+ ac_beg=1 # First line for current file.
+ ac_end=$ac_max_sed_lines # Line after last line for current file.
+ ac_more_lines=:
+ ac_sed_cmds=
+ while $ac_more_lines; do
+ if test $ac_beg -gt 1; then
+ sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ else
+ sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+ fi
+ if test ! -s $tmp/subs.frag; then
+ ac_more_lines=false
+ else
+ # The purpose of the label and of the branching condition is to
+ # speed up the sed processing (if there are no `@' at all, there
+ # is no need to browse any of the substitutions).
+ # These are the two extra sed commands mentioned above.
+ (echo ':t
+ /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ else
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ fi
+ ac_sed_frag=`expr $ac_sed_frag + 1`
+ ac_beg=$ac_end
+ ac_end=`expr $ac_end + $ac_max_sed_lines`
+ fi
+ done
+ if test -z "$ac_sed_cmds"; then
+ ac_sed_cmds=cat
fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
- ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
- ac_eof=`expr $ac_eof + 1`
-fi
+fi # test -n "$CONFIG_FILES"
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
-_ACEOF
-
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[ ]*$//
-}'
-fi
-
cat >>$CONFIG_STATUS <<\_ACEOF
-fi # test -n "$CONFIG_FILES"
-
-
-for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS
-do
- case $ac_tag in
- :[FHLC]) ac_mode=$ac_tag; continue;;
- esac
- case $ac_mode$ac_tag in
- :[FHL]*:*);;
- :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
- { (exit 1); exit 1; }; };;
- :[FH]-) ac_tag=-:-;;
- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
- esac
- ac_save_IFS=$IFS
- IFS=:
- set x $ac_tag
- IFS=$ac_save_IFS
- shift
- ac_file=$1
- shift
-
- case $ac_mode in
- :L) ac_source=$1;;
- :[FH])
- ac_file_inputs=
- for ac_f
- do
- case $ac_f in
- -) ac_f="$tmp/stdin";;
- *) # Look for the file first in the build tree, then in the source tree
- # (if the path is not absolute). The absolute path cannot be DOS-style,
- # because $ac_f cannot contain `:'.
- test -f "$ac_f" ||
- case $ac_f in
- [\\/$]*) false;;
- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
- esac ||
- { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
- esac
- ac_file_inputs="$ac_file_inputs $ac_f"
- done
-
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- configure_input="Generated from "`IFS=:
- echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
- if test x"$ac_file" != x-; then
- configure_input="$ac_file. $configure_input"
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- fi
-
- case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin";;
- esac
- ;;
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+ case $ac_file in
+ - | *:- | *:-:* ) # input from stdin
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ * ) ac_file_in=$ac_file.in ;;
esac
- ac_dir=`$as_dirname -- "$ac_file" ||
+ # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+ ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
+
ac_builddir=.
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
case $srcdir in
- .) # We are building in place.
+ .) # No --srcdir option. We are building in place.
ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
- case $ac_mode in
- :F)
- #
- # CONFIG_FILE
- #
case $INSTALL in
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
esac
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
- p
- q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- ac_datarootdir_hack='
- s&@datadir@&$datadir&g
- s&@docdir@&$docdir&g
- s&@infodir@&$infodir&g
- s&@localedir@&$localedir&g
- s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
+ if test x"$ac_file" != x-; then
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+ rm -f "$ac_file"
+ fi
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ if test x"$ac_file" = x-; then
+ configure_input=
+ else
+ configure_input="$ac_file. "
+ fi
+ configure_input=$configure_input"Generated from `echo $ac_file_in |
+ sed 's,.*/,,'` by configure."
+
+ # First look for the input files in the build tree, otherwise in the
+ # src tree.
+ ac_file_inputs=`IFS=:
+ for f in $ac_file_in; do
+ case $f in
+ -) echo $tmp/stdin ;;
+ [\\/$]*)
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ echo "$f";;
+ *) # Relative
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+ { (exit 1); exit 1; }; }
+ fi;;
+ esac
+ done` || { (exit 1); exit 1; }
_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
cat >>$CONFIG_STATUS <<_ACEOF
sed "$ac_vpsub
$extrasub
@@ -13127,43 +12087,142 @@ _ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
-
- rm -f "$tmp/stdin"
- case $ac_file in
- -) cat "$tmp/out"; rm -f "$tmp/out";;
- *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
- esac
- ;;
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+ rm -f $tmp/stdin
+ if test x"$ac_file" != x-; then
+ mv $tmp/out $ac_file
+ else
+ cat $tmp/out
+ rm -f $tmp/out
+ fi
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
- :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
- ;;
- esac
+#
+# CONFIG_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+ ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_dest" : 'X\(//\)[^/]' \| \
+ X"$ac_dest" : 'X\(//\)$' \| \
+ X"$ac_dest" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
+
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
- case $ac_file$ac_mode in
- "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+ case $ac_dest in
+ depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
@@ -13173,29 +12232,18 @@ echo "$as_me: executing $ac_file commands" >&6;}
# each Makefile.in and add a new line on top of each file to say so.
# So let's grep whole file.
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
- dirpart=`$as_dirname -- "$mf" ||
+ dirpart=`(dirname "$mf") 2>/dev/null ||
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(//\)$' \| \
- X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$mf" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$mf" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
else
continue
fi
@@ -13217,76 +12265,49 @@ echo X"$mf" |
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
- fdir=`$as_dirname -- "$file" ||
+ fdir=`(dirname "$file") 2>/dev/null ||
$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
- X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- { as_dir=$dirpart/$fdir
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ { if $as_mkdir_p; then
+ mkdir -p $dirpart/$fdir
+ else
+ as_dir=$dirpart/$fdir
as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
{ (exit 1); exit 1; }; }; }
+
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
;;
- "libtool":C)
+ libtool )
# See if we are running on zsh, and set the options which allow our
# commands through without removal of \ escapes.
@@ -13844,10 +12865,11 @@ _LT_EOF
chmod +x "$ofile"
;;
-
esac
-done # for ac_tag
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
{ (exit 0); exit 0; }
_ACEOF
@@ -13877,7 +12899,7 @@ if test "$no_create" != yes; then
fi
#
-# CONFIG_SUBDIRS section.
+# CONFIG_SUBDIRS section, as fixed in confsubdir.m4.
#
if test "$no_recursion" != yes; then
@@ -13924,12 +12946,7 @@ if test "$no_recursion" != yes; then
case $ac_arg in
*\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
- ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
-
- # Pass --silent
- if test "$silent" = yes; then
- ac_sub_configure_args="--silent $ac_sub_configure_args"
- fi
+ ac_sub_configure_args="$ac_arg $ac_sub_configure_args"
ac_popdir=`pwd`
for ac_dir in : $subdirs; do test "x$ac_dir" = x: && continue
@@ -13938,83 +12955,97 @@ if test "$no_recursion" != yes; then
# parts of a large source tree are present.
test -d "$srcdir/$ac_dir" || continue
- ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
- echo "$as_me:$LINENO: $ac_msg" >&5
- echo "$ac_msg" >&6
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ { echo "$as_me:$LINENO: configuring in $ac_dir" >&5
+echo "$as_me: configuring in $ac_dir" >&6;}
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$as_dir" : 'X\(//\)[^/]' \| \
X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
{ (exit 1); exit 1; }; }; }
+
ac_builddir=.
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
+if test "$ac_dir" != .; then
ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
case $srcdir in
- .) # We are building in place.
+ .) # No --srcdir option. We are building in place.
ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
cd "$ac_dir"
@@ -14038,8 +13069,8 @@ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
# Make the cache file name correct relative to the subdirectory.
case $cache_file in
[\\/]* | ?:[\\/]* ) ac_sub_cache_file=$cache_file ;;
- *) # Relative name.
- ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
+ *) # Relative path.
+ ac_sub_cache_file=$ac_top_builddir$cache_file ;;
esac
{ echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
diff --git a/newlib/libc/sys/d10v/syscalls.c b/newlib/libc/sys/d10v/syscalls.c
index 4c71db390..11192074a 100644
--- a/newlib/libc/sys/d10v/syscalls.c
+++ b/newlib/libc/sys/d10v/syscalls.c
@@ -64,7 +64,7 @@ _unlink ()
}
int
-_isatty (int fd)
+isatty (int fd)
{
return 1;
}
diff --git a/newlib/libc/sys/h8300hms/syscalls.c b/newlib/libc/sys/h8300hms/syscalls.c
index b9ec17a52..b716e62fc 100644
--- a/newlib/libc/sys/h8300hms/syscalls.c
+++ b/newlib/libc/sys/h8300hms/syscalls.c
@@ -3,7 +3,7 @@
#include <_ansi.h>
#include <errno.h>
-int _isatty(file)
+int isatty(file)
int file;
{
return 1;
diff --git a/newlib/libc/sys/h8500hms/syscalls.c b/newlib/libc/sys/h8500hms/syscalls.c
index 0f3471ab0..bb0c3c0c7 100644
--- a/newlib/libc/sys/h8500hms/syscalls.c
+++ b/newlib/libc/sys/h8500hms/syscalls.c
@@ -93,7 +93,7 @@ _sbrk (incr)
int
-_isatty (file)
+isatty (file)
int file;
{
return 1;
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am
index 2a1306cfe..b27c46f99 100644
--- a/newlib/libc/sys/linux/Makefile.am
+++ b/newlib/libc/sys/linux/Makefile.am
@@ -47,7 +47,6 @@ GENERAL_SOURCES = \
inode.c \
io.c \
ipc.c \
- isatty.c \
linux.c \
mallinfor.c \
malloc.c \
diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in
index 91b2f5f38..46ca25390 100644
--- a/newlib/libc/sys/linux/Makefile.in
+++ b/newlib/libc/sys/linux/Makefile.in
@@ -138,8 +138,7 @@ DIST_COMMON = $(srcdir)/../../../../config.guess \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
$(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../compile $(srcdir)/../../../../compile \
- $(srcdir)/../../../../ltmain.sh \
+ $(srcdir)/../../../../compile $(srcdir)/../../../../ltmain.sh \
$(srcdir)/../../../../config.guess \
$(srcdir)/../../../../config.sub
subdir = .
@@ -171,36 +170,35 @@ am__objects_1 = lib_a-aio.$(OBJEXT) lib_a-brk.$(OBJEXT) \
lib_a-gethostid.$(OBJEXT) lib_a-gethostname.$(OBJEXT) \
lib_a-getreent.$(OBJEXT) lib_a-ids.$(OBJEXT) \
lib_a-inode.$(OBJEXT) lib_a-io.$(OBJEXT) lib_a-ipc.$(OBJEXT) \
- lib_a-isatty.$(OBJEXT) lib_a-linux.$(OBJEXT) \
- lib_a-mallinfor.$(OBJEXT) lib_a-malloc.$(OBJEXT) \
- lib_a-mallocr.$(OBJEXT) lib_a-mallstatsr.$(OBJEXT) \
- lib_a-mmap.$(OBJEXT) lib_a-mq_close.$(OBJEXT) \
- lib_a-mq_getattr.$(OBJEXT) lib_a-mq_notify.$(OBJEXT) \
- lib_a-mq_open.$(OBJEXT) lib_a-mq_receive.$(OBJEXT) \
- lib_a-mq_send.$(OBJEXT) lib_a-mq_setattr.$(OBJEXT) \
- lib_a-mq_unlink.$(OBJEXT) lib_a-msize.$(OBJEXT) \
- lib_a-msizer.$(OBJEXT) lib_a-mstats.$(OBJEXT) \
- lib_a-mtrim.$(OBJEXT) lib_a-mtrimr.$(OBJEXT) \
- lib_a-ntp_gettime.$(OBJEXT) lib_a-pread.$(OBJEXT) \
- lib_a-process.$(OBJEXT) lib_a-prof-freq.$(OBJEXT) \
- lib_a-profile.$(OBJEXT) lib_a-psignal.$(OBJEXT) \
- lib_a-pwrite.$(OBJEXT) lib_a-raise.$(OBJEXT) \
- lib_a-realloc.$(OBJEXT) lib_a-reallocr.$(OBJEXT) \
- lib_a-rename.$(OBJEXT) lib_a-resource.$(OBJEXT) \
- lib_a-sched.$(OBJEXT) lib_a-select.$(OBJEXT) \
- lib_a-seteuid.$(OBJEXT) lib_a-sethostid.$(OBJEXT) \
- lib_a-sethostname.$(OBJEXT) lib_a-shm_open.$(OBJEXT) \
- lib_a-shm_unlink.$(OBJEXT) lib_a-sig.$(OBJEXT) \
- lib_a-sigaction.$(OBJEXT) lib_a-sigqueue.$(OBJEXT) \
- lib_a-signal.$(OBJEXT) lib_a-siglongjmp.$(OBJEXT) \
- lib_a-sigset.$(OBJEXT) lib_a-sigwait.$(OBJEXT) \
- lib_a-socket.$(OBJEXT) lib_a-sleep.$(OBJEXT) \
- lib_a-strsignal.$(OBJEXT) lib_a-strverscmp.$(OBJEXT) \
- lib_a-sysconf.$(OBJEXT) lib_a-sysctl.$(OBJEXT) \
- lib_a-systat.$(OBJEXT) lib_a-tcdrain.$(OBJEXT) \
- lib_a-tcsendbrk.$(OBJEXT) lib_a-termios.$(OBJEXT) \
- lib_a-time.$(OBJEXT) lib_a-usleep.$(OBJEXT) \
- lib_a-versionsort.$(OBJEXT)
+ lib_a-linux.$(OBJEXT) lib_a-mallinfor.$(OBJEXT) \
+ lib_a-malloc.$(OBJEXT) lib_a-mallocr.$(OBJEXT) \
+ lib_a-mallstatsr.$(OBJEXT) lib_a-mmap.$(OBJEXT) \
+ lib_a-mq_close.$(OBJEXT) lib_a-mq_getattr.$(OBJEXT) \
+ lib_a-mq_notify.$(OBJEXT) lib_a-mq_open.$(OBJEXT) \
+ lib_a-mq_receive.$(OBJEXT) lib_a-mq_send.$(OBJEXT) \
+ lib_a-mq_setattr.$(OBJEXT) lib_a-mq_unlink.$(OBJEXT) \
+ lib_a-msize.$(OBJEXT) lib_a-msizer.$(OBJEXT) \
+ lib_a-mstats.$(OBJEXT) lib_a-mtrim.$(OBJEXT) \
+ lib_a-mtrimr.$(OBJEXT) lib_a-ntp_gettime.$(OBJEXT) \
+ lib_a-pread.$(OBJEXT) lib_a-process.$(OBJEXT) \
+ lib_a-prof-freq.$(OBJEXT) lib_a-profile.$(OBJEXT) \
+ lib_a-psignal.$(OBJEXT) lib_a-pwrite.$(OBJEXT) \
+ lib_a-raise.$(OBJEXT) lib_a-realloc.$(OBJEXT) \
+ lib_a-reallocr.$(OBJEXT) lib_a-rename.$(OBJEXT) \
+ lib_a-resource.$(OBJEXT) lib_a-sched.$(OBJEXT) \
+ lib_a-select.$(OBJEXT) lib_a-seteuid.$(OBJEXT) \
+ lib_a-sethostid.$(OBJEXT) lib_a-sethostname.$(OBJEXT) \
+ lib_a-shm_open.$(OBJEXT) lib_a-shm_unlink.$(OBJEXT) \
+ lib_a-sig.$(OBJEXT) lib_a-sigaction.$(OBJEXT) \
+ lib_a-sigqueue.$(OBJEXT) lib_a-signal.$(OBJEXT) \
+ lib_a-siglongjmp.$(OBJEXT) lib_a-sigset.$(OBJEXT) \
+ lib_a-sigwait.$(OBJEXT) lib_a-socket.$(OBJEXT) \
+ lib_a-sleep.$(OBJEXT) lib_a-strsignal.$(OBJEXT) \
+ lib_a-strverscmp.$(OBJEXT) lib_a-sysconf.$(OBJEXT) \
+ lib_a-sysctl.$(OBJEXT) lib_a-systat.$(OBJEXT) \
+ lib_a-tcdrain.$(OBJEXT) lib_a-tcsendbrk.$(OBJEXT) \
+ lib_a-termios.$(OBJEXT) lib_a-time.$(OBJEXT) \
+ lib_a-usleep.$(OBJEXT) lib_a-versionsort.$(OBJEXT)
am__objects_2 = lib_a-aio64.$(OBJEXT) lib_a-confstr.$(OBJEXT) \
lib_a-ctermid.$(OBJEXT) lib_a-fclean.$(OBJEXT) \
lib_a-fpathconf.$(OBJEXT) lib_a-fstab.$(OBJEXT) \
@@ -237,13 +235,13 @@ am__objects_6 = aio.lo brk.lo calloc.lo callocr.lo cfreer.lo \
cfspeed.lo clock_getres.lo clock_gettime.lo clock_settime.lo \
flockfile.lo free.lo freer.lo ftok.lo funlockfile.lo \
getdate.lo getdate_err.lo gethostid.lo gethostname.lo \
- getreent.lo ids.lo inode.lo io.lo ipc.lo isatty.lo linux.lo \
- mallinfor.lo malloc.lo mallocr.lo mallstatsr.lo mmap.lo \
- mq_close.lo mq_getattr.lo mq_notify.lo mq_open.lo \
- mq_receive.lo mq_send.lo mq_setattr.lo mq_unlink.lo msize.lo \
- msizer.lo mstats.lo mtrim.lo mtrimr.lo ntp_gettime.lo pread.lo \
- process.lo prof-freq.lo profile.lo psignal.lo pwrite.lo \
- raise.lo realloc.lo reallocr.lo rename.lo resource.lo sched.lo \
+ getreent.lo ids.lo inode.lo io.lo ipc.lo linux.lo mallinfor.lo \
+ malloc.lo mallocr.lo mallstatsr.lo mmap.lo mq_close.lo \
+ mq_getattr.lo mq_notify.lo mq_open.lo mq_receive.lo mq_send.lo \
+ mq_setattr.lo mq_unlink.lo msize.lo msizer.lo mstats.lo \
+ mtrim.lo mtrimr.lo ntp_gettime.lo pread.lo process.lo \
+ prof-freq.lo profile.lo psignal.lo pwrite.lo raise.lo \
+ realloc.lo reallocr.lo rename.lo resource.lo sched.lo \
select.lo seteuid.lo sethostid.lo sethostname.lo shm_open.lo \
shm_unlink.lo sig.lo sigaction.lo sigqueue.lo signal.lo \
siglongjmp.lo sigset.lo sigwait.lo socket.lo sleep.lo \
@@ -467,7 +465,6 @@ GENERAL_SOURCES = \
inode.c \
io.c \
ipc.c \
- isatty.c \
linux.c \
mallinfor.c \
malloc.c \
@@ -810,12 +807,6 @@ lib_a-ipc.o: ipc.c
lib_a-ipc.obj: ipc.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ipc.obj `if test -f 'ipc.c'; then $(CYGPATH_W) 'ipc.c'; else $(CYGPATH_W) '$(srcdir)/ipc.c'; fi`
-lib_a-isatty.o: isatty.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-isatty.o `test -f 'isatty.c' || echo '$(srcdir)/'`isatty.c
-
-lib_a-isatty.obj: isatty.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-isatty.obj `if test -f 'isatty.c'; then $(CYGPATH_W) 'isatty.c'; else $(CYGPATH_W) '$(srcdir)/isatty.c'; fi`
-
lib_a-linux.o: linux.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linux.o `test -f 'linux.c' || echo '$(srcdir)/'`linux.c
diff --git a/newlib/libc/sys/linux/bits/libc-lock.h b/newlib/libc/sys/linux/bits/libc-lock.h
index 5779a6c93..2b170444b 100644
--- a/newlib/libc/sys/linux/bits/libc-lock.h
+++ b/newlib/libc/sys/linux/bits/libc-lock.h
@@ -27,8 +27,6 @@
#include <linuxthreads/internals.h>
#endif
-#define _IO_MTSAFE_IO /* add this as we always want this in newlib */
-
/* Mutex type. */
#if defined(_LIBC) || defined(_IO_MTSAFE_IO)
typedef pthread_mutex_t __libc_lock_t;
diff --git a/newlib/libc/sys/linux/iconv/iconvconfig.c b/newlib/libc/sys/linux/iconv/iconvconfig.c
new file mode 100644
index 000000000..8ad6c93e2
--- /dev/null
+++ b/newlib/libc/sys/linux/iconv/iconvconfig.c
@@ -0,0 +1,1176 @@
+/* Generate fastloading iconv module configuration files.
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <argp.h>
+#include <assert.h>
+#include <error.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <libintl.h>
+#include <locale.h>
+#include <mcheck.h>
+#include <search.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdio_ext.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/cdefs.h>
+#include <sys/uio.h>
+
+#include "iconvconfig.h"
+
+/* Get libc version number. */
+#include "../version.h"
+
+#define PACKAGE _libc_intl_domainname
+
+
+/* The hashing function we use. */
+#include "../intl/hash-string.h"
+
+
+/* Types used. */
+struct module
+{
+ char *fromname;
+ struct Strent *fromname_strent;
+ char *filename;
+ struct Strent *filename_strent;
+ const char *directory;
+ struct Strent *directory_strent;
+ struct module *next;
+ int cost;
+ struct Strent *toname_strent;
+ char toname[0];
+};
+
+struct alias
+{
+ char *fromname;
+ struct Strent *froment;
+ struct module *module;
+ struct Strent *toent;
+ char toname[0];
+};
+
+struct name
+{
+ const char *name;
+ struct Strent *strent;
+ int module_idx;
+ uint32_t hashval;
+};
+
+struct name_info
+{
+ const char *canonical_name;
+ struct Strent *canonical_strent;
+
+ struct module *from_internal;
+ struct module *to_internal;
+
+ struct other_conv_list
+ {
+ int dest_idx;
+ struct other_conv
+ {
+ gidx_t module_idx;
+ struct module *module;
+ struct other_conv *next;
+ } other_conv;
+ struct other_conv_list *next;
+ } *other_conv_list;
+};
+
+
+/* Name and version of program. */
+static void print_version (FILE *stream, struct argp_state *state);
+void (*argp_program_version_hook) (FILE *, struct argp_state *) = print_version;
+
+/* Short description of program. */
+static const char doc[] = N_("\
+Create fastloading iconv module configuration file.");
+
+/* Strings for arguments in help texts. */
+static const char args_doc[] = N_("[DIR...]");
+
+/* Function to print some extra text in the help message. */
+static char *more_help (int key, const char *text, void *input);
+
+/* Data structure to communicate with argp functions. */
+static struct argp argp =
+{
+ NULL, NULL, args_doc, doc, NULL, more_help
+};
+
+
+/* The function doing the actual work. */
+static int handle_dir (const char *dir);
+
+/* Add all known builtin conversions and aliases. */
+static void add_builtins (void);
+
+/* Create list of all aliases without circular aliases. */
+static void get_aliases (void);
+
+/* Create list of all modules. */
+static void get_modules (void);
+
+/* Get list of all the names and thereby indexing them. */
+static void generate_name_list (void);
+
+/* Collect information about all the names. */
+static void generate_name_info (void);
+
+/* Write the output file. */
+static int write_output (void);
+
+
+/* Search tree of the modules we know. */
+static void *modules;
+
+/* Search tree of the aliases we know. */
+static void *aliases;
+
+/* Search tree for name to index mapping. */
+static void *names;
+
+/* Number of names we know about. */
+static int nnames;
+
+/* List of all aliases. */
+static struct alias **alias_list;
+static size_t nalias_list;
+static size_t nalias_list_max;
+
+/* List of all modules. */
+static struct module **module_list;
+static size_t nmodule_list;
+static size_t nmodule_list_max;
+
+/* Names and information about them. */
+static struct name_info *name_info;
+static size_t nname_info;
+
+/* Number of translations not from or to INTERNAL. */
+static size_t nextra_modules;
+
+
+/* Names and aliases for the builtin transformations. */
+static struct
+{
+ const char *from;
+ const char *to;
+} builtin_alias[] =
+ {
+#define BUILTIN_ALIAS(alias, real) \
+ { .from = alias, .to = real },
+#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \
+ MinT, MaxT)
+#include <gconv_builtin.h>
+ };
+#undef BUILTIN_ALIAS
+#undef BUILTIN_TRANSFORMATION
+#define nbuiltin_alias (sizeof (builtin_alias) / sizeof (builtin_alias[0]))
+
+static struct
+{
+ const char *from;
+ const char *to;
+ const char *module;
+ int cost;
+} builtin_trans[] =
+ {
+#define BUILTIN_ALIAS(alias, real)
+#define BUILTIN_TRANSFORMATION(From, To, Cost, Name, Fct, MinF, MaxF, \
+ MinT, MaxT) \
+ { .from = From, .to = To, .module = Name, .cost = Cost },
+#include <gconv_builtin.h>
+ };
+#define nbuiltin_trans (sizeof (builtin_trans) / sizeof (builtin_trans[0]))
+
+
+/* Filename extension for the modules. */
+#ifndef MODULE_EXT
+# define MODULE_EXT ".so"
+#endif
+static const char gconv_module_ext[] = MODULE_EXT;
+
+
+extern void *xmalloc (size_t n) __attribute_malloc__;
+extern void *xcalloc (size_t n, size_t m) __attribute_malloc__;
+extern void *xrealloc (void *p, size_t n);
+
+
+/* C string table handling. */
+struct Strtab;
+struct Strent;
+
+/* Create new C string table object in memory. */
+extern struct Strtab *strtabinit (void);
+
+/* Free resources allocated for C string table ST. */
+extern void strtabfree (struct Strtab *st);
+
+/* Add string STR (length LEN is != 0) to C string table ST. */
+extern struct Strent *strtabadd (struct Strtab *st, const char *str,
+ size_t len);
+
+/* Finalize string table ST and store size in *SIZE and return a pointer. */
+extern void *strtabfinalize (struct Strtab *st, size_t *size);
+
+/* Get offset in string table for string associated with SE. */
+extern size_t strtaboffset (struct Strent *se);
+
+/* String table we construct. */
+static struct Strtab *strtab;
+
+
+
+int
+main (int argc, char *argv[])
+{
+ int remaining;
+ int status = 0;
+ char *path;
+ char *tp;
+ const char *old = GCONV_PATH;
+ size_t len = strlen (old) + 1;
+ char *new = alloca(len);
+
+ /* Enable memory use testing. */
+ /* mcheck_pedantic (NULL); */
+ mtrace ();
+
+ /* Set locale via LC_ALL. */
+ setlocale (LC_ALL, "");
+
+ /* Set the text message domain. */
+ textdomain (_libc_intl_domainname);
+
+ /* Parse and process arguments. */
+ argp_parse (&argp, argc, argv, 0, &remaining, NULL);
+
+ /* Initialize the string table. */
+ strtab = strtabinit ();
+
+ /* Handle all directories mentioned. */
+ while (remaining < argc)
+ status |= handle_dir (argv[remaining++]);
+
+ /* In any case also handle the standard directory. */
+ path = memcpy (new, old, len);
+ tp = strtok (path, ":");
+ while (tp != NULL)
+ {
+ status |= handle_dir (tp);
+
+ tp = strtok (NULL, ":");
+ }
+
+ /* Add the builtin transformations and aliases without overwriting
+ anything. */
+ add_builtins ();
+
+ /* Store aliases in an array. */
+ get_aliases ();
+
+ /* Get list of all modules. */
+ get_modules ();
+
+ /* Generate list of all the names we know to handle in some way. */
+ generate_name_list ();
+
+ /* Now we know all the names we will handle, collect information
+ about them. */
+ generate_name_info ();
+
+ /* Write the output file, but only if we haven't seen any error. */
+ if (status == 0)
+ status = write_output ();
+ else
+ error (1, 0, _("no output file produced because warning were issued"));
+
+ return status;
+}
+
+
+static char *
+more_help (int key, const char *text, void *input)
+{
+ switch (key)
+ {
+ case ARGP_KEY_HELP_EXTRA:
+ /* We print some extra information. */
+ return strdup (gettext ("\
+Report bugs using the `glibcbug' script to <bugs@gnu.org>.\n"));
+ default:
+ break;
+ }
+ return (char *) text;
+}
+
+
+/* Print the version information. */
+static void
+print_version (FILE *stream, struct argp_state *state)
+{
+ fprintf (stream, "iconvconfig (GNU %s) %s\n", PACKAGE, VERSION);
+ fprintf (stream, gettext ("\
+Copyright (C) %s Free Software Foundation, Inc.\n\
+This is free software; see the source for copying conditions. There is NO\n\
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
+"), "2002");
+ fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper");
+}
+
+
+static int
+alias_compare (const void *p1, const void *p2)
+{
+ const struct alias *a1 = (const struct alias *) p1;
+ const struct alias *a2 = (const struct alias *) p2;
+
+ return strcmp (a1->fromname, a2->fromname);
+}
+
+
+static void
+new_alias (const char *fromname, size_t fromlen, const char *toname,
+ size_t tolen)
+{
+ struct alias *newp;
+ void **inserted;
+
+ newp = (struct alias *) xmalloc (sizeof (struct alias) + fromlen + tolen);
+
+ newp->fromname = memcpy (newp->toname, toname, tolen);
+ newp->fromname += tolen;
+ memcpy (newp->fromname, fromname, fromlen);
+ newp->module = NULL;
+
+ inserted = (void **) tsearch (newp, &aliases, alias_compare);
+ if (inserted == NULL)
+ error (EXIT_FAILURE, errno, gettext ("while inserting in search tree"));
+ if (*inserted != newp)
+ /* Something went wrong, free this entry. */
+ free (newp);
+ else
+ {
+ newp->froment = strtabadd (strtab, newp->fromname, fromlen);
+ newp->toent = strtabadd (strtab, newp->toname, tolen);
+ }
+}
+
+
+/* Add new alias. */
+static void
+add_alias (char *rp)
+{
+ /* We now expect two more string. The strings are normalized
+ (converted to UPPER case) and strored in the alias database. */
+ char *from;
+ char *to;
+ char *wp;
+
+ while (isspace (*rp))
+ ++rp;
+ from = wp = rp;
+ while (*rp != '\0' && !isspace (*rp))
+ *wp++ = toupper (*rp++);
+ if (*rp == '\0')
+ /* There is no `to' string on the line. Ignore it. */
+ return;
+ *wp++ = '\0';
+ to = ++rp;
+ while (isspace (*rp))
+ ++rp;
+ while (*rp != '\0' && !isspace (*rp))
+ *wp++ = toupper (*rp++);
+ if (to == wp)
+ /* No `to' string, ignore the line. */
+ return;
+ *wp++ = '\0';
+
+ assert (strlen (from) + 1 == to - from);
+ assert (strlen (to) + 1 == wp - to);
+
+ new_alias (from, to - from, to, wp - to);
+}
+
+
+static void
+append_alias (const void *nodep, VISIT value, int level)
+{
+ if (value != leaf && value != postorder)
+ return;
+
+ if (nalias_list_max == nalias_list)
+ {
+ nalias_list_max += 50;
+ alias_list = (struct alias **) xrealloc (alias_list,
+ (nalias_list_max
+ * sizeof (struct alias *)));
+ }
+
+ alias_list[nalias_list++] = *(struct alias **) nodep;
+}
+
+
+static void
+get_aliases (void)
+{
+ twalk (aliases, append_alias);
+}
+
+
+static int
+module_compare (const void *p1, const void *p2)
+{
+ const struct module *m1 = (const struct module *) p1;
+ const struct module *m2 = (const struct module *) p2;
+ int result;
+
+ result = strcmp (m1->fromname, m2->fromname);
+ if (result == 0)
+ result = strcmp (m1->toname, m2->toname);
+
+ return result;
+}
+
+
+/* Create new module record. */
+static void
+new_module (const char *fromname, size_t fromlen, const char *toname,
+ size_t tolen, const char *directory,
+ const char *filename, size_t filelen, int cost, size_t need_ext)
+{
+ struct module *new_module;
+ size_t dirlen = strlen (directory) + 1;
+ char *tmp;
+ void **inserted;
+
+ new_module = (struct module *) xmalloc (sizeof (struct module)
+ + fromlen + tolen + filelen
+ + need_ext);
+
+ new_module->fromname = memcpy (new_module->toname, toname, tolen);
+ new_module->fromname += tolen;
+
+ new_module->filename = memcpy (new_module->fromname, fromname, fromlen);
+ new_module->filename += fromlen;
+
+ new_module->cost = cost;
+ new_module->next = NULL;
+
+ tmp = memcpy (new_module->filename, filename, filelen);
+ tmp += filelen;
+
+ if (need_ext)
+ {
+ memcpy (tmp - 1, gconv_module_ext, need_ext + 1);
+ filelen += need_ext;
+ }
+ new_module->directory = directory;
+
+ /* Now insert the new module data structure in our search tree. */
+ inserted = (void **) tsearch (new_module, &modules, module_compare);
+ if (inserted == NULL)
+ error (EXIT_FAILURE, errno, "while inserting in search tree");
+ if (*inserted != new_module)
+ free (new_module);
+ else
+ {
+ new_module->fromname_strent = strtabadd (strtab, new_module->fromname,
+ fromlen);
+ new_module->toname_strent = strtabadd (strtab, new_module->toname,
+ tolen);
+ new_module->filename_strent = strtabadd (strtab, new_module->filename,
+ filelen);
+ new_module->directory_strent = strtabadd (strtab, directory, dirlen);
+ }
+}
+
+
+/* Add new module. */
+static void
+internal_function
+add_module (char *rp, const char *directory)
+{
+ /* We expect now
+ 1. `from' name
+ 2. `to' name
+ 3. filename of the module
+ 4. an optional cost value
+ */
+ char *from;
+ char *to;
+ char *module;
+ char *wp;
+ int need_ext;
+ int cost;
+
+ while (isspace (*rp))
+ ++rp;
+ from = rp;
+ while (*rp != '\0' && !isspace (*rp))
+ {
+ *rp = toupper (*rp);
+ ++rp;
+ }
+ if (*rp == '\0')
+ return;
+ *rp++ = '\0';
+ to = wp = rp;
+ while (isspace (*rp))
+ ++rp;
+ while (*rp != '\0' && !isspace (*rp))
+ *wp++ = toupper (*rp++);
+ if (*rp == '\0')
+ return;
+ *wp++ = '\0';
+ do
+ ++rp;
+ while (isspace (*rp));
+ module = wp;
+ while (*rp != '\0' && !isspace (*rp))
+ *wp++ = *rp++;
+ if (*rp == '\0')
+ {
+ /* There is no cost, use one by default. */
+ *wp++ = '\0';
+ cost = 1;
+ }
+ else
+ {
+ /* There might be a cost value. */
+ char *endp;
+
+ *wp++ = '\0';
+ cost = strtol (rp, &endp, 10);
+ if (rp == endp || cost < 1)
+ /* No useful information. */
+ cost = 1;
+ }
+
+ if (module[0] == '\0')
+ /* No module name given. */
+ return;
+
+ /* See whether we must add the ending. */
+ need_ext = 0;
+ if (wp - module < sizeof (gconv_module_ext)
+ || memcmp (wp - sizeof (gconv_module_ext), gconv_module_ext,
+ sizeof (gconv_module_ext)) != 0)
+ /* We must add the module extension. */
+ need_ext = sizeof (gconv_module_ext) - 1;
+
+ assert (strlen (from) + 1 == to - from);
+ assert (strlen (to) + 1 == module - to);
+ assert (strlen (module) + 1 == wp - module);
+
+ new_module (from, to - from, to, module - to, directory, module, wp - module,
+ cost, need_ext);
+}
+
+
+/* Read the config file and add the data for this directory to that. */
+static int
+handle_dir (const char *dir)
+{
+ char *infile;
+ FILE *fp;
+ char *line = NULL;
+ size_t linelen = 0;
+ size_t dirlen = strlen (dir);
+ char *tmp;
+
+ if (dir[dirlen - 1] != '/')
+ {
+ char *newp = (char *) xmalloc (dirlen + 2);
+ dir = memcpy (newp, dir, dirlen);
+ newp[dirlen++] = '/';
+ newp[dirlen] = '\0';
+ }
+
+ infile = (char *) alloca (dirlen + sizeof "gconv-modules");
+ tmp = mempcpy (infile, dir, dirlen);
+ tmp += dirlen;
+ strcpy (tmp, "gconv-modules");
+
+ fp = fopen (infile, "r");
+ if (fp == NULL)
+ {
+ error (0, errno, "cannot open `%s'", infile);
+ return 1;
+ }
+
+ /* No threads present. */
+ __fsetlocking (fp, FSETLOCKING_BYCALLER);
+
+ while (!feof_unlocked (fp))
+ {
+ char *rp, *endp, *word;
+ ssize_t n = __getdelim (&line, &linelen, '\n', fp);
+
+ if (n < 0)
+ /* An error occurred. */
+ break;
+
+ rp = line;
+ /* Terminate the line (excluding comments or newline) with a NUL
+ byte to simplify the following code. */
+ endp = strchr (rp, '#');
+ if (endp != NULL)
+ *endp = '\0';
+ else
+ if (rp[n - 1] == '\n')
+ rp[n - 1] = '\0';
+
+ while (isspace (*rp))
+ ++rp;
+
+ /* If this is an empty line go on with the next one. */
+ if (rp == endp)
+ continue;
+
+ word = rp;
+ while (*rp != '\0' && !isspace (*rp))
+ ++rp;
+
+ if (rp - word == sizeof ("alias") - 1
+ && memcmp (word, "alias", sizeof ("alias") - 1) == 0)
+ add_alias (rp);
+ else if (rp - word == sizeof ("module") - 1
+ && memcmp (word, "module", sizeof ("module") - 1) == 0)
+ add_module (rp, dir);
+ /* else */
+ /* Otherwise ignore the line. */
+ }
+
+ free (line);
+
+ fclose (fp);
+
+ return 0;
+}
+
+
+static void
+append_module (const void *nodep, VISIT value, int level)
+{
+ struct module *mo;
+
+ if (value != leaf && value != postorder)
+ return;
+
+ mo = *(struct module **) nodep;
+
+ if (nmodule_list > 0
+ && strcmp (module_list[nmodule_list - 1]->fromname, mo->fromname) == 0)
+ {
+ /* Same name. */
+ mo->next = module_list[nmodule_list - 1];
+ module_list[nmodule_list - 1] = mo;
+
+ return;
+ }
+
+ if (nmodule_list_max == nmodule_list)
+ {
+ nmodule_list_max += 50;
+ module_list = (struct module **) xrealloc (module_list,
+ (nmodule_list_max
+ * sizeof (struct module *)));
+ }
+
+ module_list[nmodule_list++] = mo;
+}
+
+
+static void
+get_modules (void)
+{
+ twalk (modules, append_module);
+}
+
+
+static void
+add_builtins (void)
+{
+ size_t cnt;
+
+ /* Add all aliases. */
+ for (cnt = 0; cnt < nbuiltin_alias; ++cnt)
+ new_alias (builtin_alias[cnt].from,
+ strlen (builtin_alias[cnt].from) + 1,
+ builtin_alias[cnt].to,
+ strlen (builtin_alias[cnt].to) + 1);
+
+ /* add the builtin transformations. */
+ for (cnt = 0; cnt < nbuiltin_trans; ++cnt)
+ new_module (builtin_trans[cnt].from,
+ strlen (builtin_trans[cnt].from) + 1,
+ builtin_trans[cnt].to,
+ strlen (builtin_trans[cnt].to) + 1,
+ "", builtin_trans[cnt].module,
+ strlen (builtin_trans[cnt].module) + 1,
+ builtin_trans[cnt].cost, 0);
+}
+
+
+static int
+name_compare (const void *p1, const void *p2)
+{
+ const struct name *n1 = (const struct name *) p1;
+ const struct name *n2 = (const struct name *) p2;
+
+ return strcmp (n1->name, n2->name);
+}
+
+
+static struct name *
+new_name (const char *str, struct Strent *strent)
+{
+ struct name *newp = (struct name *) xmalloc (sizeof (struct name));
+
+ newp->name = str;
+ newp->strent = strent;
+ newp->module_idx = -1;
+ newp->hashval = hash_string (str);
+
+ ++nnames;
+
+ return newp;
+}
+
+
+static void
+generate_name_list (void)
+{
+ size_t i;
+
+ /* A name we always need. */
+ tsearch (new_name ("INTERNAL", strtabadd (strtab, "INTERNAL",
+ sizeof ("INTERNAL"))),
+ &names, name_compare);
+
+ for (i = 0; i < nmodule_list; ++i)
+ {
+ struct module *runp;
+
+ if (strcmp (module_list[i]->fromname, "INTERNAL") != 0)
+ tsearch (new_name (module_list[i]->fromname,
+ module_list[i]->fromname_strent),
+ &names, name_compare);
+
+ for (runp = module_list[i]; runp != NULL; runp = runp->next)
+ if (strcmp (runp->toname, "INTERNAL") != 0)
+ tsearch (new_name (runp->toname, runp->toname_strent),
+ &names, name_compare);
+ }
+}
+
+
+static int
+name_to_module_idx (const char *name, int add)
+{
+ struct name **res;
+ struct name fake_name = { .name = name };
+ int idx;
+
+ res = (struct name **) tfind (&fake_name, &names, name_compare);
+ if (res == NULL)
+ abort ();
+
+ idx = (*res)->module_idx;
+ if (idx == -1 && add)
+ /* No module index assigned yet. */
+ idx = (*res)->module_idx = nname_info++;
+
+ return idx;
+}
+
+
+static void
+generate_name_info (void)
+{
+ size_t i;
+ int idx;
+
+ name_info = (struct name_info *) xcalloc (nmodule_list + 1,
+ sizeof (struct name_info));
+
+ /* First add a special entry for the INTERNAL name. This must have
+ index zero. */
+ idx = name_to_module_idx ("INTERNAL", 1);
+ name_info[0].canonical_name = "INTERNAL";
+ name_info[0].canonical_strent = strtabadd (strtab, "INTERNAL",
+ sizeof ("INTERNAL"));
+ assert (nname_info == 1);
+
+ for (i = 0; i < nmodule_list; ++i)
+ {
+ struct module *runp;
+
+ for (runp = module_list[i]; runp != NULL; runp = runp->next)
+ if (strcmp (runp->fromname, "INTERNAL") == 0)
+ {
+ idx = name_to_module_idx (runp->toname, 1);
+ name_info[idx].from_internal = runp;
+ assert (name_info[idx].canonical_name == NULL
+ || strcmp (name_info[idx].canonical_name,
+ runp->toname) == 0);
+ name_info[idx].canonical_name = runp->toname;
+ name_info[idx].canonical_strent = runp->toname_strent;
+ }
+ else if (strcmp (runp->toname, "INTERNAL") == 0)
+ {
+ idx = name_to_module_idx (runp->fromname, 1);
+ name_info[idx].to_internal = runp;
+ assert (name_info[idx].canonical_name == NULL
+ || strcmp (name_info[idx].canonical_name,
+ runp->fromname) == 0);
+ name_info[idx].canonical_name = runp->fromname;
+ name_info[idx].canonical_strent = runp->fromname_strent;
+ }
+ else
+ {
+ /* This is a transformation not to or from the INTERNAL
+ encoding. */
+ int from_idx = name_to_module_idx (runp->fromname, 1);
+ int to_idx = name_to_module_idx (runp->toname, 1);
+ struct other_conv_list *newp;
+
+ newp = (struct other_conv_list *)
+ xmalloc (sizeof (struct other_conv_list));
+ newp->other_conv.module_idx = to_idx;
+ newp->other_conv.module = runp;
+ newp->other_conv.next = NULL; /* XXX Allow multiple module sequence */
+ newp->dest_idx = to_idx;
+ newp->next = name_info[from_idx].other_conv_list;
+ name_info[from_idx].other_conv_list = newp;
+ assert (name_info[from_idx].canonical_name == NULL
+ || strcmp (name_info[from_idx].canonical_name,
+ runp->fromname) == 0);
+ name_info[from_idx].canonical_name = runp->fromname;
+ name_info[from_idx].canonical_strent = runp->fromname_strent;
+
+ ++nextra_modules;
+ }
+ }
+
+ /* Now add the module index information for all the aliases. */
+ for (i = 0; i < nalias_list; ++i)
+ {
+ struct name fake_name = { .name = alias_list[i]->toname };
+ struct name **tonamep;
+
+ tonamep = (struct name **) tfind (&fake_name, &names, name_compare);
+ if (tonamep != NULL)
+ {
+ struct name *newp = new_name (alias_list[i]->fromname,
+ alias_list[i]->froment);
+ newp->module_idx = (*tonamep)->module_idx;
+ tsearch (newp, &names, name_compare);
+ }
+ }
+}
+
+
+static int
+is_prime (unsigned long int candidate)
+{
+ /* No even number and none less than 10 will be passed here. */
+ unsigned long int divn = 3;
+ unsigned long int sq = divn * divn;
+
+ while (sq < candidate && candidate % divn != 0)
+ {
+ ++divn;
+ sq += 4 * divn;
+ ++divn;
+ }
+
+ return candidate % divn != 0;
+}
+
+
+static uint32_t
+next_prime (uint32_t seed)
+{
+ /* Make it definitely odd. */
+ seed |= 1;
+
+ while (!is_prime (seed))
+ seed += 2;
+
+ return seed;
+}
+
+
+/* Format of the output file.
+
+ Offset Length Description
+ 0000 4 Magic header bytes
+ 0004 4 Offset of string table (stoff)
+ 0008 4 Offset of name hashing table (hoff)
+ 000C 4 Hashing table size (hsize)
+ 0010 4 Offset of module table (moff)
+ 0014 4 Offset of other conversion module table (ooff)
+
+ stoff ??? String table
+
+ hoff 8*hsize Array of tuples
+ string table offset
+ module index
+
+ moff ??? Array of tuples
+ canonical name offset
+ from-internal module dir name offset
+ from-internal module name off
+ to-internal module dir name offset
+ to-internal module name offset
+ offset into other conversion table
+
+ ooff ??? One or more of
+ number of steps/modules
+ one or more of tuple
+ canonical name offset for output
+ module dir name offset
+ module name offset
+ (following last entry with step count 0)
+*/
+static int
+write_output (void)
+{
+ int fd;
+ char *string_table;
+ size_t string_table_size;
+ struct gconvcache_header header;
+ struct hash_entry *hash_table;
+ size_t hash_size;
+ struct module_entry *module_table;
+ char *extra_table;
+ char *cur_extra_table;
+ size_t n;
+ int idx;
+ struct iovec iov[6];
+ static const gidx_t null_word;
+ size_t total;
+ char tmpfname[sizeof (GCONV_MODULES_CACHE) + strlen (".XXXXXX")];
+
+ /* Function to insert the names. */
+ static void name_insert (const void *nodep, VISIT value, int level)
+ {
+ struct name *name;
+ unsigned int idx;
+ unsigned int hval2;
+
+ if (value != leaf && value != postorder)
+ return;
+
+ name = *(struct name **) nodep;
+ idx = name->hashval % hash_size;
+ hval2 = 1 + name->hashval % (hash_size - 2);
+
+ while (hash_table[idx].string_offset != 0)
+ if ((idx += hval2) >= hash_size)
+ idx -= hash_size;
+
+ hash_table[idx].string_offset = strtaboffset (name->strent);
+
+ assert (name->module_idx != -1);
+ hash_table[idx].module_idx = name->module_idx;
+ }
+
+ /* Open the output file. */
+ strcpy (stpcpy (tmpfname, GCONV_MODULES_CACHE), ".XXXXXX");
+ fd = mkstemp (tmpfname);
+ if (fd == -1)
+ return 1;
+
+ /* Create the string table. */
+ string_table = strtabfinalize (strtab, &string_table_size);
+
+ /* Create the hashing table. We know how many strings we have.
+ Creating a perfect hash table is not reasonable here. Therefore
+ we use open hashing and a table size which is the next prime 40%
+ larger than the number of strings. */
+ hash_size = next_prime (nnames * 1.4);
+ hash_table = (struct hash_entry *) xcalloc (hash_size,
+ sizeof (struct hash_entry));
+ /* Fill the hash table. */
+ twalk (names, name_insert);
+
+ /* Create the section for the module list. */
+ module_table = (struct module_entry *) xcalloc (sizeof (struct module_entry),
+ nname_info);
+
+ /* Allocate memory for the non-INTERNAL conversions. The allocated
+ memory can be more than is actually needed. */
+ extra_table = (char *) xcalloc (sizeof (struct extra_entry)
+ + sizeof (gidx_t)
+ + sizeof (struct extra_entry_module),
+ nextra_modules);
+ cur_extra_table = extra_table;
+
+ /* Fill in the module information. */
+ for (n = 0; n < nname_info; ++n)
+ {
+ module_table[n].canonname_offset =
+ strtaboffset (name_info[n].canonical_strent);
+
+ if (name_info[n].from_internal == NULL)
+ {
+ module_table[n].fromdir_offset = 0;
+ module_table[n].fromname_offset = 0;
+ }
+ else
+ {
+ module_table[n].fromdir_offset =
+ strtaboffset (name_info[n].from_internal->directory_strent);
+ module_table[n].fromname_offset =
+ strtaboffset (name_info[n].from_internal->filename_strent);
+ }
+
+ if (name_info[n].to_internal == NULL)
+ {
+ module_table[n].todir_offset = 0;
+ module_table[n].toname_offset = 0;
+ }
+ else
+ {
+ module_table[n].todir_offset =
+ strtaboffset (name_info[n].to_internal->directory_strent);
+ module_table[n].toname_offset =
+ strtaboffset (name_info[n].to_internal->filename_strent);
+ }
+
+ if (name_info[n].other_conv_list != NULL)
+ {
+ struct other_conv_list *other = name_info[n].other_conv_list;
+
+ /* Store the reference. We add 1 to distinguish the entry
+ at offset zero from the case where no extra modules are
+ available. The file reader has to account for the
+ offset. */
+ module_table[n].extra_offset = 1 + cur_extra_table - extra_table;
+
+ do
+ {
+ struct other_conv *runp;
+ struct extra_entry *extra;
+
+ /* Allocate new entry. */
+ extra = (struct extra_entry *) cur_extra_table;
+ cur_extra_table += sizeof (struct extra_entry);
+ extra->module_cnt = 0;
+
+ runp = &other->other_conv;
+ do
+ {
+ cur_extra_table += sizeof (struct extra_entry_module);
+ extra->module[extra->module_cnt].outname_offset =
+ runp->next == NULL
+ ? other->dest_idx : runp->next->module_idx;
+ extra->module[extra->module_cnt].dir_offset =
+ strtaboffset (runp->module->directory_strent);
+ extra->module[extra->module_cnt].name_offset =
+ strtaboffset (runp->module->filename_strent);
+ ++extra->module_cnt;
+
+ runp = runp->next;
+ }
+ while (runp != NULL);
+
+ other = other->next;
+ }
+ while (other != NULL);
+
+ /* Final module_cnt is zero. */
+ *((gidx_t *) cur_extra_table) = 0;
+ cur_extra_table += sizeof (gidx_t);
+ }
+ }
+
+ header.magic = GCONVCACHE_MAGIC;
+
+ iov[0].iov_base = &header;
+ iov[0].iov_len = sizeof (struct gconvcache_header);
+ total = iov[0].iov_len;
+
+ header.string_offset = total;
+ iov[1].iov_base = string_table;
+ iov[1].iov_len = string_table_size;
+ total += iov[1].iov_len;
+
+ idx = 2;
+ if ((string_table_size & (sizeof (gidx_t) - 1)) != 0)
+ {
+ iov[2].iov_base = (void *) &null_word;
+ iov[2].iov_len = (sizeof (gidx_t)
+ - (string_table_size & (sizeof (gidx_t) - 1)));
+ total += iov[2].iov_len;
+ ++idx;
+ }
+
+ header.hash_offset = total;
+ header.hash_size = hash_size;
+ iov[idx].iov_base = hash_table;
+ iov[idx].iov_len = hash_size * sizeof (struct hash_entry);
+ total += iov[idx].iov_len;
+ ++idx;
+
+ header.module_offset = total;
+ iov[idx].iov_base = module_table;
+ iov[idx].iov_len = nname_info * sizeof (struct module_entry);
+ total += iov[idx].iov_len;
+ ++idx;
+
+ assert (cur_extra_table - extra_table
+ <= ((sizeof (struct extra_entry) + sizeof (gidx_t)
+ + sizeof (struct extra_entry_module))
+ * nextra_modules));
+ header.otherconv_offset = total;
+ iov[idx].iov_base = extra_table;
+ iov[idx].iov_len = cur_extra_table - extra_table;
+ total += iov[idx].iov_len;
+ ++idx;
+
+ if (TEMP_FAILURE_RETRY (writev (fd, iov, idx)) != total
+ /* The file was created with mode 0600. Make it world-readable. */
+ || fchmod (fd, 0644) != 0
+ /* Rename the file, possibly replacing an old one. */
+ || rename (tmpfname, GCONV_MODULES_CACHE) != 0)
+ {
+ int save_errno = errno;
+ close (fd);
+ unlink (tmpfname);
+ error (EXIT_FAILURE, save_errno,
+ gettext ("cannot generate output file"));
+ }
+
+ close (fd);
+
+ return 0;
+}
diff --git a/newlib/libc/sys/linux/iconv/strtab.c b/newlib/libc/sys/linux/iconv/strtab.c
new file mode 100644
index 000000000..0f5e2b632
--- /dev/null
+++ b/newlib/libc/sys/linux/iconv/strtab.c
@@ -0,0 +1,341 @@
+/* C string table handling.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Written by Ulrich Drepper <drepper@redhat.com>, 2000.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/cdefs.h>
+#include <sys/param.h>
+
+
+struct Strent
+{
+ const char *string;
+ size_t len;
+ struct Strent *next;
+ struct Strent *left;
+ struct Strent *right;
+ size_t offset;
+ char reverse[0];
+};
+
+
+struct memoryblock
+{
+ struct memoryblock *next;
+ char memory[0];
+};
+
+
+struct Strtab
+{
+ struct Strent *root;
+ struct memoryblock *memory;
+ char *backp;
+ size_t left;
+ size_t total;
+
+ struct Strent null;
+};
+
+
+/* Cache for the pagesize. We correct this value a bit so that `malloc'
+ is not allocating more than a page. */
+static size_t ps;
+
+
+extern void *xmalloc (size_t n) __attribute_malloc__;
+
+/* Prototypes for our functions that are used from iconvconfig.c. If
+ you change these, change also iconvconfig.c. */
+/* Create new C string table object in memory. */
+extern struct Strtab *strtabinit (void);
+
+/* Free resources allocated for C string table ST. */
+extern void strtabfree (struct Strtab *st);
+
+/* Add string STR (length LEN is != 0) to C string table ST. */
+extern struct Strent *strtabadd (struct Strtab *st, const char *str,
+ size_t len);
+
+/* Finalize string table ST and store size in *SIZE and return a pointer. */
+extern void *strtabfinalize (struct Strtab *st, size_t *size);
+
+/* Get offset in string table for string associated with SE. */
+extern size_t strtaboffset (struct Strent *se);
+
+
+struct Strtab *
+strtabinit (void)
+{
+ struct Strtab *ret;
+
+ if (ps == 0)
+ {
+ ps = sysconf (_SC_PAGESIZE) - 2 * sizeof (void *);
+ assert (sizeof (struct memoryblock) < ps);
+ }
+
+ ret = (struct Strtab *) calloc (1, sizeof (struct Strtab));
+ if (ret != NULL)
+ {
+ ret->null.len = 1;
+ ret->null.string = "";
+ }
+ return ret;
+}
+
+
+static void
+morememory (struct Strtab *st, size_t len)
+{
+ struct memoryblock *newmem;
+
+ if (len < ps)
+ len = ps;
+ newmem = (struct memoryblock *) malloc (len);
+ if (newmem == NULL)
+ abort ();
+
+ newmem->next = st->memory;
+ st->memory = newmem;
+ st->backp = newmem->memory;
+ st->left = len - offsetof (struct memoryblock, memory);
+}
+
+
+void
+strtabfree (struct Strtab *st)
+{
+ struct memoryblock *mb = st->memory;
+
+ while (mb != NULL)
+ {
+ void *old = mb;
+ mb = mb->next;
+ free (old);
+ }
+
+ free (st);
+}
+
+
+static struct Strent *
+newstring (struct Strtab *st, const char *str, size_t len)
+{
+ struct Strent *newstr;
+ size_t align;
+ int i;
+
+ /* Compute the amount of padding needed to make the structure aligned. */
+ align = ((__alignof__ (struct Strent)
+ - (((uintptr_t) st->backp)
+ & (__alignof__ (struct Strent) - 1)))
+ & (__alignof__ (struct Strent) - 1));
+
+ /* Make sure there is enough room in the memory block. */
+ if (st->left < align + sizeof (struct Strent) + len)
+ {
+ morememory (st, sizeof (struct Strent) + len);
+ align = 0;
+ }
+
+ /* Create the reserved string. */
+ newstr = (struct Strent *) (st->backp + align);
+ newstr->string = str;
+ newstr->len = len;
+ newstr->next = NULL;
+ newstr->left = NULL;
+ newstr->right = NULL;
+ newstr->offset = 0;
+ for (i = len - 2; i >= 0; --i)
+ newstr->reverse[i] = str[len - 2 - i];
+ newstr->reverse[len - 1] = '\0';
+ st->backp += align + sizeof (struct Strent) + len;
+ st->left -= align + sizeof (struct Strent) + len;
+
+ return newstr;
+}
+
+
+/* XXX This function should definitely be rewritten to use a balancing
+ tree algorith (AVL, red-black trees). For now a simple, correct
+ implementation is enough. */
+static struct Strent **
+searchstring (struct Strent **sep, struct Strent *newstr)
+{
+ int cmpres;
+
+ /* More strings? */
+ if (*sep == NULL)
+ {
+ *sep = newstr;
+ return sep;
+ }
+
+ /* Compare the strings. */
+ cmpres = memcmp ((*sep)->reverse, newstr->reverse,
+ MIN ((*sep)->len, newstr->len) - 1);
+ if (cmpres == 0)
+ /* We found a matching string. */
+ return sep;
+ else if (cmpres > 0)
+ return searchstring (&(*sep)->left, newstr);
+ else
+ return searchstring (&(*sep)->right, newstr);
+}
+
+
+/* Add new string. The actual string is assumed to be permanent. */
+struct Strent *
+strtabadd (struct Strtab *st, const char *str, size_t len)
+{
+ struct Strent *newstr;
+ struct Strent **sep;
+
+ /* Compute the string length if the caller doesn't know it. */
+ if (len == 0)
+ len = strlen (str) + 1;
+
+ /* Make sure all "" strings get offset 0. */
+ if (len == 1)
+ return &st->null;
+
+ /* Allocate memory for the new string and its associated information. */
+ newstr = newstring (st, str, len);
+
+ /* Search in the array for the place to insert the string. If there
+ is no string with matching prefix and no string with matching
+ leading substring, create a new entry. */
+ sep = searchstring (&st->root, newstr);
+ if (*sep != newstr)
+ {
+ /* This is not the same entry. This means we have a prefix match. */
+ if ((*sep)->len > newstr->len)
+ {
+ struct Strent *subs;
+
+ for (subs = (*sep)->next; subs; subs = subs->next)
+ if (subs->len == newstr->len)
+ {
+ /* We have an exact match with a substring. Free the memory
+ we allocated. */
+ st->left += st->backp - (char *) newstr;
+ st->backp = (char *) newstr;
+
+ return subs;
+ }
+
+ /* We have a new substring. This means we don't need the reverse
+ string of this entry anymore. */
+ st->backp -= newstr->len;
+ st->left += newstr->len;
+
+ newstr->next = (*sep)->next;
+ (*sep)->next = newstr;
+ }
+ else if ((*sep)->len != newstr->len)
+ {
+ /* When we get here it means that the string we are about to
+ add has a common prefix with a string we already have but
+ it is longer. In this case we have to put it first. */
+ st->total += newstr->len - (*sep)->len;
+ newstr->next = *sep;
+ newstr->left = (*sep)->left;
+ newstr->right = (*sep)->right;
+ *sep = newstr;
+ }
+ else
+ {
+ /* We have an exact match. Free the memory we allocated. */
+ st->left += st->backp - (char *) newstr;
+ st->backp = (char *) newstr;
+
+ newstr = *sep;
+ }
+ }
+ else
+ st->total += newstr->len;
+
+ return newstr;
+}
+
+
+static void
+copystrings (struct Strent *nodep, char **freep, size_t *offsetp)
+{
+ struct Strent *subs;
+
+ if (nodep->left != NULL)
+ copystrings (nodep->left, freep, offsetp);
+
+ /* Process the current node. */
+ nodep->offset = *offsetp;
+ *freep = (char *) memcpy (*freep, nodep->string, nodep->len);
+ *freep += nodep->len;
+ *offsetp += nodep->len;
+
+ for (subs = nodep->next; subs != NULL; subs = subs->next)
+ {
+ assert (subs->len < nodep->len);
+ subs->offset = nodep->offset + nodep->len - subs->len;
+ }
+
+ if (nodep->right != NULL)
+ copystrings (nodep->right, freep, offsetp);
+}
+
+
+void *
+strtabfinalize (struct Strtab *st, size_t *size)
+{
+ size_t copylen;
+ char *endp;
+ char *retval;
+
+ /* Fill in the information. */
+ endp = retval = (char *) xmalloc (st->total + 1);
+
+ /* Always put an empty string at the beginning so that a zero offset
+ can mean error. */
+ *endp++ = '\0';
+
+ /* Now run through the tree and add all the string while also updating
+ the offset members of the elfstrent records. */
+ copylen = 1;
+ copystrings (st->root, &endp, &copylen);
+ assert (copylen == st->total + 1);
+ assert (endp = retval + st->total + 1);
+ *size = copylen;
+
+ return retval;
+}
+
+
+size_t
+strtaboffset (struct Strent *se)
+{
+ return se->offset;
+}
diff --git a/newlib/libc/sys/linux/include/arpa/nameser.h b/newlib/libc/sys/linux/include/arpa/nameser.h
index 6209afdf7..8735b8bd3 100644
--- a/newlib/libc/sys/linux/include/arpa/nameser.h
+++ b/newlib/libc/sys/linux/include/arpa/nameser.h
@@ -202,11 +202,7 @@ typedef enum __ns_rcode {
ns_r_nxrrset = 8, /* RRset does not exist */
ns_r_notauth = 9, /* Not authoritative for zone */
ns_r_notzone = 10, /* Zone of record different from zone section */
- ns_r_max = 11,
- /* The following are TSIG extended errors */
- ns_r_badsig = 16,
- ns_r_badkey = 17,
- ns_r_badtime = 18
+ ns_r_max = 11
} ns_rcode;
/* BIND_UPDATE */
@@ -217,104 +213,6 @@ typedef enum __ns_update_operation {
} ns_update_operation;
/*
- * * This structure is used for TSIG authenticated messages
- * */
-struct ns_tsig_key {
- char name[NS_MAXDNAME], alg[NS_MAXDNAME];
- unsigned char *data;
- int len;
-};
-typedef struct ns_tsig_key ns_tsig_key;
-
-/*
- * * This structure is used for TSIG authenticated TCP messages
- * */
-struct ns_tcp_tsig_state {
- int counter;
- struct dst_key *key;
- void *ctx;
- unsigned char sig[NS_PACKETSZ];
- int siglen;
-};
-typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
-
-#define NS_TSIG_FUDGE 300
-#define NS_TSIG_TCP_COUNT 100
-#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
-
-#define NS_TSIG_ERROR_NO_TSIG -10
-#define NS_TSIG_ERROR_NO_SPACE -11
-#define NS_TSIG_ERROR_FORMERR -12
-
-/*
- * Currently defined type values for resources and queries.
- */
-typedef enum __ns_type {
- ns_t_invalid = 0, /* Cookie. */
- ns_t_a = 1, /* Host address. */
- ns_t_ns = 2, /* Authoritative server. */
- ns_t_md = 3, /* Mail destination. */
- ns_t_mf = 4, /* Mail forwarder. */
- ns_t_cname = 5, /* Canonical name. */
- ns_t_soa = 6, /* Start of authority zone. */
- ns_t_mb = 7, /* Mailbox domain name. */
- ns_t_mg = 8, /* Mail group member. */
- ns_t_mr = 9, /* Mail rename name. */
- ns_t_null = 10, /* Null resource record. */
- ns_t_wks = 11, /* Well known service. */
- ns_t_ptr = 12, /* Domain name pointer. */
- ns_t_hinfo = 13, /* Host information. */
- ns_t_minfo = 14, /* Mailbox information. */
- ns_t_mx = 15, /* Mail routing information. */
- ns_t_txt = 16, /* Text strings. */
- ns_t_rp = 17, /* Responsible person. */
- ns_t_afsdb = 18, /* AFS cell database. */
- ns_t_x25 = 19, /* X_25 calling address. */
- ns_t_isdn = 20, /* ISDN calling address. */
- ns_t_rt = 21, /* Router. */
- ns_t_nsap = 22, /* NSAP address. */
- ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
- ns_t_sig = 24, /* Security signature. */
- ns_t_key = 25, /* Security key. */
- ns_t_px = 26, /* X.400 mail mapping. */
- ns_t_gpos = 27, /* Geographical position (withdrawn). */
- ns_t_aaaa = 28, /* Ip6 Address. */
- ns_t_loc = 29, /* Location Information. */
- ns_t_nxt = 30, /* Next domain (security). */
- ns_t_eid = 31, /* Endpoint identifier. */
- ns_t_nimloc = 32, /* Nimrod Locator. */
- ns_t_srv = 33, /* Server Selection. */
- ns_t_atma = 34, /* ATM Address */
- ns_t_naptr = 35, /* Naming Authority PoinTeR */
- ns_t_kx = 36, /* Key Exchange */
- ns_t_cert = 37, /* Certification record */
- ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
- ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
- ns_t_sink = 40, /* Kitchen sink (experimentatl) */
- ns_t_opt = 41, /* EDNS0 option (meta-RR) */
- ns_t_tsig = 250, /* Transaction signature. */
- ns_t_ixfr = 251, /* Incremental zone transfer. */
- ns_t_axfr = 252, /* Transfer zone of authority. */
- ns_t_mailb = 253, /* Transfer mailbox records. */
- ns_t_maila = 254, /* Transfer mail agent records. */
- ns_t_any = 255, /* Wildcard match. */
- ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
- ns_t_max = 65536
-} ns_type;
-
-/* Exclusively a QTYPE? (not also an RTYPE) */
-#define ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
- (t) == ns_t_mailb || (t) == ns_t_maila)
-/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
-#define ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
-/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
-#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
-#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
-#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
- (t) == ns_t_zxfr)
-
-
-/*
* This RR-like structure is particular to UPDATE.
*/
struct ns_updrec {
@@ -336,6 +234,54 @@ struct ns_updrec {
};
typedef struct ns_updrec ns_updrec;
+/*
+ * Currently defined type values for resources and queries.
+ */
+typedef enum __ns_type {
+ ns_t_a = 1, /* Host address. */
+ ns_t_ns = 2, /* Authoritative server. */
+ ns_t_md = 3, /* Mail destination. */
+ ns_t_mf = 4, /* Mail forwarder. */
+ ns_t_cname = 5, /* Canonical name. */
+ ns_t_soa = 6, /* Start of authority zone. */
+ ns_t_mb = 7, /* Mailbox domain name. */
+ ns_t_mg = 8, /* Mail group member. */
+ ns_t_mr = 9, /* Mail rename name. */
+ ns_t_null = 10, /* Null resource record. */
+ ns_t_wks = 11, /* Well known service. */
+ ns_t_ptr = 12, /* Domain name pointer. */
+ ns_t_hinfo = 13, /* Host information. */
+ ns_t_minfo = 14, /* Mailbox information. */
+ ns_t_mx = 15, /* Mail routing information. */
+ ns_t_txt = 16, /* Text strings. */
+ ns_t_rp = 17, /* Responsible person. */
+ ns_t_afsdb = 18, /* AFS cell database. */
+ ns_t_x25 = 19, /* X_25 calling address. */
+ ns_t_isdn = 20, /* ISDN calling address. */
+ ns_t_rt = 21, /* Router. */
+ ns_t_nsap = 22, /* NSAP address. */
+ ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
+ ns_t_sig = 24, /* Security signature. */
+ ns_t_key = 25, /* Security key. */
+ ns_t_px = 26, /* X.400 mail mapping. */
+ ns_t_gpos = 27, /* Geographical position (withdrawn). */
+ ns_t_aaaa = 28, /* Ip6 Address. */
+ ns_t_loc = 29, /* Location Information. */
+ ns_t_nxt = 30, /* Next domain (security). */
+ ns_t_eid = 31, /* Endpoint identifier. */
+ ns_t_nimloc = 32, /* Nimrod Locator. */
+ ns_t_srv = 33, /* Server Selection. */
+ ns_t_atma = 34, /* ATM Address */
+ ns_t_naptr = 35, /* Naming Authority PoinTeR */
+ ns_t_opt = 41, /* OPT pseudo-RR, RFC2761 */
+ /* Query type values which do not appear in resource records. */
+ ns_t_ixfr = 251, /* Incremental zone transfer. */
+ ns_t_axfr = 252, /* Transfer zone of authority. */
+ ns_t_mailb = 253, /* Transfer mailbox records. */
+ ns_t_maila = 254, /* Transfer mail agent records. */
+ ns_t_any = 255, /* Wildcard match. */
+ ns_t_max = 65536
+} ns_type;
/*
* Values for class field
@@ -351,24 +297,6 @@ typedef enum __ns_class {
ns_c_max = 65536
} ns_class;
-/* DNSSEC constants. */
-
-typedef enum __ns_key_types {
- ns_kt_rsa = 1, /* key type RSA/MD5 */
- ns_kt_dh = 2, /* Diffie Hellman */
- ns_kt_dsa = 3, /* Digital Signature Standard (MANDATORY) */
- ns_kt_private = 254 /* Private key type starts with OID */
-} ns_key_types;
-
-typedef enum __ns_cert_types {
- cert_t_pkix = 1, /* PKIX (X.509v3) */
- cert_t_spki = 2, /* SPKI */
- cert_t_pgp = 3, /* PGP */
- cert_t_url = 253, /* URL private type */
- cert_t_oid = 254 /* OID private type */
-} ns_cert_types;
-
-
/*
* Flags field of the KEY RR rdata
*/
@@ -399,10 +327,6 @@ typedef enum __ns_cert_types {
/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
#define NS_ALG_MD5RSA 1 /* MD5 with RSA */
-#define NS_ALG_DH 2 /* Diffie Hellman KEY */
-#define NS_ALG_DSA 3 /* DSA KEY */
-#define NS_ALG_DSS NS_ALG_DSA
-
#define NS_ALG_EXPIRE_ONLY 253 /* No alg, no security */
#define NS_ALG_PRIVATE_OID 254 /* Key begins with OID giving alg */
diff --git a/newlib/libc/sys/linux/include/hesiod.h b/newlib/libc/sys/linux/include/hesiod.h
index 82fce3076..c7dbeee33 100644
--- a/newlib/libc/sys/linux/include/hesiod.h
+++ b/newlib/libc/sys/linux/include/hesiod.h
@@ -1,5 +1,42 @@
+/* $NetBSD: hesiod.h,v 1.3 1999/01/24 23:53:18 lukem Exp $ */
+/* $FreeBSD: src/include/hesiod.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */
+
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
/*
- * Copyright (c) 1996,1999 by Internet Software Consortium.
+ * Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,26 +52,47 @@
* SOFTWARE.
*/
-/*
- * This file is primarily maintained by <tytso@mit.edu> and <ghudson@mit.edu>.
- */
+#ifndef _HESIOD_H_
+#define _HESIOD_H_
-/*
- * $BINDId: hesiod.h,v 1.7 1999/01/08 19:22:45 vixie Exp $
- */
+ /* Application-visible indication that we have the new interfaces */
+
+#define HESIOD_INTERFACES
+
+ /* Configuration information. */
+
+#ifndef _PATH_HESIOD_CONF /* Configuration file. */
+#define _PATH_HESIOD_CONF "/etc/hesiod.conf"
+#endif
+
+#define DEF_RHS "" /* Defaults if HESIOD_CONF */
+#define DEF_LHS "" /* file is not present. */
+
+ /* Error codes (for backwards compatibility) */
+
+#define HES_ER_UNINIT -1 /* uninitialized */
+#define HES_ER_OK 0 /* no error */
+#define HES_ER_NOTFOUND 1 /* Hesiod name not found by server */
+#define HES_ER_CONFIG 2 /* local problem (no config file?) */
+#define HES_ER_NET 3 /* network problem */
+
+ /* Declaration of routines */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int hesiod_init(void **);
+char **hesiod_resolve(void *, const char *, const char *);
+void hesiod_free_list(void *, char **);
+char *hesiod_to_bind(void *, const char *, const char *);
+void hesiod_end(void *);
+
+ /* backwards compatibility */
+int hes_init(void);
+char *hes_to_bind(const char *, const char *);
+char **hes_resolve(const char *, const char *);
+int hes_error(void);
+void hes_free(char **);
+__END_DECLS
-#ifndef _HESIOD_H_INCLUDED
-#define _HESIOD_H_INCLUDED
-
-int hesiod_init (void **context);
-void hesiod_end (void *context);
-char * hesiod_to_bind (void *context, const char *name,
- const char *type);
-char ** hesiod_resolve (void *context, const char *name,
- const char *type);
-void hesiod_free_list (void *context, char **list);
-struct __res_state * __hesiod_res_get (void *context);
-void __hesiod_res_set (void *context, struct __res_state *,
- void (*)(void *));
-
-#endif /*_HESIOD_H_INCLUDED*/
+#endif /* ! _HESIOD_H_ */
diff --git a/newlib/libc/sys/linux/include/libc_private.h b/newlib/libc/sys/linux/include/libc_private.h
new file mode 100644
index 000000000..af7df8c8b
--- /dev/null
+++ b/newlib/libc/sys/linux/include/libc_private.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>.
+ * 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 John Birrell.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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.
+ *
+ * $FreeBSD: src/lib/libc/include/libc_private.h,v 1.5 2002/03/29 22:43:42 markm Exp $
+ *
+ * Private definitions for libc, libc_r and libpthread.
+ *
+ */
+
+#ifndef _LIBC_PRIVATE_H_
+#define _LIBC_PRIVATE_H_
+
+/*
+ * This global flag is non-zero when a process has created one
+ * or more threads. It is used to avoid calling locking functions
+ * when they are not required.
+ */
+extern int __isthreaded;
+
+/*
+ * File lock contention is difficult to diagnose without knowing
+ * where locks were set. Allow a debug library to be built which
+ * records the source file and line number of each lock call.
+ */
+#ifdef _FLOCK_DEBUG
+#define _FLOCKFILE(x) _flockfile_debug(x, __FILE__, __LINE__)
+#else
+#define _FLOCKFILE(x) _flockfile(x)
+#endif
+
+/*
+ * Macros for locking and unlocking FILEs. These test if the
+ * process is threaded to avoid locking when not required.
+ */
+#define FLOCKFILE(fp) if (__isthreaded) _FLOCKFILE(fp)
+#define FUNLOCKFILE(fp) if (__isthreaded) _funlockfile(fp)
+
+/*
+ * This is a pointer in the C run-time startup code. It is used
+ * by getprogname() and setprogname().
+ */
+extern const char *__progname;
+
+#endif /* _LIBC_PRIVATE_H_ */
diff --git a/newlib/libc/sys/linux/include/net/ethernet.h b/newlib/libc/sys/linux/include/net/ethernet.h
index 7ca8e8348..6b1d1c9be 100644
--- a/newlib/libc/sys/linux/include/net/ethernet.h
+++ b/newlib/libc/sys/linux/include/net/ethernet.h
@@ -1,66 +1,75 @@
-/* Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/*
+ * Fundamental constants relating to ethernet.
+ *
+ * $FreeBSD: src/sys/net/ethernet.h,v 1.20 2002/04/04 05:42:09 luigi Exp $
+ *
+ */
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+#ifndef _NET_ETHERNET_H_
+#define _NET_ETHERNET_H_
- The GNU C 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
- Lesser General Public License for more details.
+/*
+ * The number of bytes in an ethernet (MAC) address.
+ */
+#define ETHER_ADDR_LEN 6
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+/*
+ * The number of bytes in the type field.
+ */
+#define ETHER_TYPE_LEN 2
-/* Based on the FreeBSD version of this file. Curiously, that file
- lacks a copyright in the header. */
+/*
+ * The number of bytes in the trailing CRC field.
+ */
+#define ETHER_CRC_LEN 4
-#ifndef __NET_ETHERNET_H
-#define __NET_ETHERNET_H 1
+/*
+ * The length of the combined header.
+ */
+#define ETHER_HDR_LEN (ETHER_ADDR_LEN*2+ETHER_TYPE_LEN)
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <linux/if_ether.h> /* IEEE 802.3 Ethernet constants */
+/*
+ * The minimum packet length.
+ */
+#define ETHER_MIN_LEN 64
-__BEGIN_DECLS
+/*
+ * The maximum packet length.
+ */
+#define ETHER_MAX_LEN 1518
-/* This is a name for the 48 bit ethernet address available on many
- systems. */
-struct ether_addr
-{
- u_int8_t ether_addr_octet[ETH_ALEN];
-} __attribute__ ((__packed__));
-
-/* 10Mb/s ethernet header */
-struct ether_header
-{
- u_int8_t ether_dhost[ETH_ALEN]; /* destination eth addr */
- u_int8_t ether_shost[ETH_ALEN]; /* source ether addr */
- u_int16_t ether_type; /* packet type ID field */
-} __attribute__ ((__packed__));
-
-/* Ethernet protocol ID's */
-#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */
-#define ETHERTYPE_IP 0x0800 /* IP */
-#define ETHERTYPE_ARP 0x0806 /* Address resolution */
-#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */
-
-#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */
-#define ETHER_TYPE_LEN 2 /* bytes in type field */
-#define ETHER_CRC_LEN 4 /* bytes in CRC field */
-#define ETHER_HDR_LEN ETH_HLEN /* total octets in header */
-#define ETHER_MIN_LEN (ETH_ZLEN + ETHER_CRC_LEN) /* min packet length */
-#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETHER_CRC_LEN) /* max packet length */
-
-/* make sure ethenet length is valid */
+/*
+ * A macro to validate a length with
+ */
#define ETHER_IS_VALID_LEN(foo) \
((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN)
/*
+ * Structure of a 10Mb/s Ethernet header.
+ */
+struct ether_header {
+ u_char ether_dhost[ETHER_ADDR_LEN];
+ u_char ether_shost[ETHER_ADDR_LEN];
+ u_short ether_type;
+};
+
+/*
+ * Structure of a 48-bit Ethernet address.
+ */
+struct ether_addr {
+ u_char octet[ETHER_ADDR_LEN];
+};
+
+#define ETHERTYPE_PUP 0x0200 /* PUP protocol */
+#define ETHERTYPE_IP 0x0800 /* IP protocol */
+#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */
+#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */
+#define ETHERTYPE_VLAN 0x8100 /* IEEE 802.1Q VLAN tagging */
+#define ETHERTYPE_IPV6 0x86dd /* IPv6 */
+#define ETHERTYPE_LOOPBACK 0x9000 /* used to test interfaces */
+/* XXX - add more useful types here */
+
+/*
* The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have
* (type-ETHERTYPE_TRAIL)*512 bytes of data followed
* by an ETHER type (as given above) and then the (variable-length) header.
@@ -68,9 +77,58 @@ struct ether_header
#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */
#define ETHERTYPE_NTRAILER 16
-#define ETHERMTU ETH_DATA_LEN
-#define ETHERMIN (ETHER_MIN_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
+#define ETHERMTU (ETHER_MAX_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
+#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
+#ifdef _KERNEL
+
+/*
+ * For device drivers to specify whether they support BPF or not
+ */
+#define ETHER_BPF_UNSUPPORTED 0
+#define ETHER_BPF_SUPPORTED 1
+
+struct ifnet;
+struct mbuf;
+
+extern void (*ng_ether_input_p)(struct ifnet *ifp,
+ struct mbuf **mp, struct ether_header *eh);
+extern void (*ng_ether_input_orphan_p)(struct ifnet *ifp,
+ struct mbuf *m, struct ether_header *eh);
+extern int (*ng_ether_output_p)(struct ifnet *ifp, struct mbuf **mp);
+extern void (*ng_ether_attach_p)(struct ifnet *ifp);
+extern void (*ng_ether_detach_p)(struct ifnet *ifp);
+
+extern int (*vlan_input_p)(struct ether_header *eh, struct mbuf *m);
+extern int (*vlan_input_tag_p)(struct ether_header *eh, struct mbuf *m,
+ u_int16_t t);
+
+#define VLAN_INPUT_TAG(eh, m, t) do { \
+ /* XXX: lock */ \
+ if (vlan_input_tag_p != NULL) \
+ (*vlan_input_tag_p)(eh, m, t); \
+ else { \
+ (m)->m_pkthdr.rcvif->if_noproto++; \
+ m_freem(m); \
+ } \
+ /* XXX: unlock */ \
+} while (0)
+
+#else /* _KERNEL */
+
+#include <sys/cdefs.h>
+
+/*
+ * Ethernet address conversion/parsing routines.
+ */
+__BEGIN_DECLS
+struct ether_addr *ether_aton(const char *);
+int ether_hostton(const char *, struct ether_addr *);
+int ether_line(const char *, struct ether_addr *, char *);
+char *ether_ntoa(const struct ether_addr *);
+int ether_ntohost(char *, const struct ether_addr *);
__END_DECLS
-#endif /* net/ethernet.h */
+#endif /* !_KERNEL */
+
+#endif /* !_NET_ETHERNET_H_ */
diff --git a/newlib/libc/sys/linux/include/net/if_atm.h b/newlib/libc/sys/linux/include/net/if_atm.h
new file mode 100644
index 000000000..c9ff107c0
--- /dev/null
+++ b/newlib/libc/sys/linux/include/net/if_atm.h
@@ -0,0 +1,107 @@
+/* $NetBSD: if_atm.h,v 1.7 1996/11/09 23:02:27 chuck Exp $ */
+/* $FreeBSD: src/sys/net/if_atm.h,v 1.5 2002/03/19 21:54:16 alfred Exp $ */
+
+/*
+ *
+ * Copyright (c) 1996 Charles D. Cranor and Washington University.
+ * 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 Charles D. Cranor and
+ * Washington University.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * net/if_atm.h
+ */
+
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
+#define RTALLOC1(A,B) rtalloc1((A),(B))
+#elif defined(__FreeBSD__)
+#define RTALLOC1(A,B) rtalloc1((A),(B),0UL)
+#endif
+
+/*
+ * pseudo header for packet transmission
+ */
+struct atm_pseudohdr {
+ u_int8_t atm_ph[4]; /* flags+VPI+VCI1(msb)+VCI2(lsb) */
+};
+
+#define ATM_PH_FLAGS(X) ((X)->atm_ph[0])
+#define ATM_PH_VPI(X) ((X)->atm_ph[1])
+#define ATM_PH_VCI(X) ((((X)->atm_ph[2]) << 8) | ((X)->atm_ph[3]))
+#define ATM_PH_SETVCI(X,V) { \
+ (X)->atm_ph[2] = ((V) >> 8) & 0xff; \
+ (X)->atm_ph[3] = ((V) & 0xff); \
+}
+
+#define ATM_PH_AAL5 0x01 /* use AAL5? (0 == aal0) */
+#define ATM_PH_LLCSNAP 0x02 /* use the LLC SNAP encoding (iff aal5) */
+
+#define ATM_PH_DRIVER7 0x40 /* reserve for driver's use */
+#define ATM_PH_DRIVER8 0x80 /* reserve for driver's use */
+
+#define ATMMTU 9180 /* ATM MTU size for IP */
+ /* XXX: could be 9188 with LLC/SNAP according
+ to comer */
+
+/* user's ioctl hook for raw atm mode */
+#define SIOCRAWATM _IOWR('a', 122, int) /* set driver's raw mode */
+
+/* atm_pseudoioctl: turns on and off RX VCIs [for internal use only!] */
+struct atm_pseudoioctl {
+ struct atm_pseudohdr aph;
+ void *rxhand;
+};
+#define SIOCATMENA _IOWR('a', 123, struct atm_pseudoioctl) /* enable */
+#define SIOCATMDIS _IOWR('a', 124, struct atm_pseudoioctl) /* disable */
+
+
+/*
+ * XXX forget all the garbage in if_llc.h and do it the easy way
+ */
+
+#define ATMLLC_HDR "\252\252\3\0\0\0"
+struct atmllc {
+ u_int8_t llchdr[6]; /* aa.aa.03.00.00.00 */
+ u_int8_t type[2]; /* "ethernet" type */
+};
+
+/* ATM_LLC macros: note type code in host byte order */
+#define ATM_LLC_TYPE(X) (((X)->type[0] << 8) | ((X)->type[1]))
+#define ATM_LLC_SETTYPE(X,V) { \
+ (X)->type[1] = ((V) >> 8) & 0xff; \
+ (X)->type[0] = ((V) & 0xff); \
+}
+
+#ifdef _KERNEL
+void atm_ifattach(struct ifnet *);
+void atm_input(struct ifnet *, struct atm_pseudohdr *,
+ struct mbuf *, void *);
+int atm_output(struct ifnet *, struct mbuf *, struct sockaddr *,
+ struct rtentry *);
+#endif
+
diff --git a/newlib/libc/sys/linux/include/net/if_media.h b/newlib/libc/sys/linux/include/net/if_media.h
new file mode 100644
index 000000000..80599bdc0
--- /dev/null
+++ b/newlib/libc/sys/linux/include/net/if_media.h
@@ -0,0 +1,409 @@
+/* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */
+/* $FreeBSD: src/sys/net/if_media.h,v 1.17 2002/05/07 18:16:39 imp Exp $ */
+
+/*
+ * Copyright (c) 1997
+ * Jonathan Stone and Jason R. Thorpe. All rights reserved.
+ *
+ * This software is derived from information provided by Matt Thomas.
+ *
+ * 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 Jonathan Stone
+ * and Jason R. Thorpe for the NetBSD Project.
+ * 4. The names of the authors may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHOR 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.
+ */
+
+#ifndef _NET_IF_MEDIA_H_
+#define _NET_IF_MEDIA_H_
+
+/*
+ * Prototypes and definitions for BSD/OS-compatible network interface
+ * media selection.
+ *
+ * Where it is safe to do so, this code strays slightly from the BSD/OS
+ * design. Software which uses the API (device drivers, basically)
+ * shouldn't notice any difference.
+ *
+ * Many thanks to Matt Thomas for providing the information necessary
+ * to implement this interface.
+ */
+
+#ifdef _KERNEL
+
+#include <sys/queue.h>
+
+/*
+ * Driver callbacks for media status and change requests.
+ */
+typedef int (*ifm_change_cb_t)(struct ifnet *ifp);
+typedef void (*ifm_stat_cb_t)(struct ifnet *ifp, struct ifmediareq *req);
+
+/*
+ * In-kernel representation of a single supported media type.
+ */
+struct ifmedia_entry {
+ LIST_ENTRY(ifmedia_entry) ifm_list;
+ int ifm_media; /* description of this media attachment */
+ int ifm_data; /* for driver-specific use */
+ void *ifm_aux; /* for driver-specific use */
+};
+
+/*
+ * One of these goes into a network interface's softc structure.
+ * It is used to keep general media state.
+ */
+struct ifmedia {
+ int ifm_mask; /* mask of changes we don't care about */
+ int ifm_media; /* current user-set media word */
+ struct ifmedia_entry *ifm_cur; /* currently selected media */
+ LIST_HEAD(, ifmedia_entry) ifm_list; /* list of all supported media */
+ ifm_change_cb_t ifm_change; /* media change driver callback */
+ ifm_stat_cb_t ifm_status; /* media status driver callback */
+};
+
+/* Initialize an interface's struct if_media field. */
+void ifmedia_init(struct ifmedia *ifm, int dontcare_mask,
+ ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback);
+
+/* Remove all mediums from a struct ifmedia. */
+void ifmedia_removeall( struct ifmedia *ifm);
+
+/* Add one supported medium to a struct ifmedia. */
+void ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux);
+
+/* Add an array (of ifmedia_entry) media to a struct ifmedia. */
+void ifmedia_list_add(struct ifmedia *mp, struct ifmedia_entry *lp,
+ int count);
+
+/* Set default media type on initialization. */
+void ifmedia_set(struct ifmedia *ifm, int mword);
+
+/* Common ioctl function for getting/setting media, called by driver. */
+int ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr,
+ struct ifmedia *ifm, u_long cmd);
+
+#endif /*_KERNEL */
+
+/*
+ * if_media Options word:
+ * Bits Use
+ * ---- -------
+ * 0-4 Media variant
+ * 5-7 Media type
+ * 8-15 Type specific options
+ * 16-19 RFU
+ * 20-27 Shared (global) options
+ * 28-31 Instance
+ */
+
+/*
+ * Ethernet
+ */
+#define IFM_ETHER 0x00000020
+#define IFM_10_T 3 /* 10BaseT - RJ45 */
+#define IFM_10_2 4 /* 10Base2 - Thinnet */
+#define IFM_10_5 5 /* 10Base5 - AUI */
+#define IFM_100_TX 6 /* 100BaseTX - RJ45 */
+#define IFM_100_FX 7 /* 100BaseFX - Fiber */
+#define IFM_100_T4 8 /* 100BaseT4 - 4 pair cat 3 */
+#define IFM_100_VG 9 /* 100VG-AnyLAN */
+#define IFM_100_T2 10 /* 100BaseT2 */
+#define IFM_1000_SX 11 /* 1000BaseSX - multi-mode fiber */
+#define IFM_10_STP 12 /* 10BaseT over shielded TP */
+#define IFM_10_FL 13 /* 10BaseFL - Fiber */
+#define IFM_1000_LX 14 /* 1000baseLX - single-mode fiber */
+#define IFM_1000_CX 15 /* 1000baseCX - 150ohm STP */
+#define IFM_1000_T 16 /* 1000baseT - 4 pair cat 5 */
+#define IFM_HPNA_1 17 /* HomePNA 1.0 (1Mb/s) */
+/* note 31 is the max! */
+
+#define IFM_ETH_MASTER 0x00000100 /* master mode (1000baseT) */
+
+/*
+ * Token ring
+ */
+#define IFM_TOKEN 0x00000040
+#define IFM_TOK_STP4 3 /* Shielded twisted pair 4m - DB9 */
+#define IFM_TOK_STP16 4 /* Shielded twisted pair 16m - DB9 */
+#define IFM_TOK_UTP4 5 /* Unshielded twisted pair 4m - RJ45 */
+#define IFM_TOK_UTP16 6 /* Unshielded twisted pair 16m - RJ45 */
+#define IFM_TOK_STP100 7 /* Shielded twisted pair 100m - DB9 */
+#define IFM_TOK_UTP100 8 /* Unshielded twisted pair 100m - RJ45 */
+#define IFM_TOK_ETR 0x00000200 /* Early token release */
+#define IFM_TOK_SRCRT 0x00000400 /* Enable source routing features */
+#define IFM_TOK_ALLR 0x00000800 /* All routes / Single route bcast */
+#define IFM_TOK_DTR 0x00002000 /* Dedicated token ring */
+#define IFM_TOK_CLASSIC 0x00004000 /* Classic token ring */
+#define IFM_TOK_AUTO 0x00008000 /* Automatic Dedicate/Classic token ring */
+
+/*
+ * FDDI
+ */
+#define IFM_FDDI 0x00000060
+#define IFM_FDDI_SMF 3 /* Single-mode fiber */
+#define IFM_FDDI_MMF 4 /* Multi-mode fiber */
+#define IFM_FDDI_UTP 5 /* CDDI / UTP */
+#define IFM_FDDI_DA 0x00000100 /* Dual attach / single attach */
+
+/*
+ * IEEE 802.11 Wireless
+ */
+#define IFM_IEEE80211 0x00000080
+#define IFM_IEEE80211_FH1 3 /* Frequency Hopping 1Mbps */
+#define IFM_IEEE80211_FH2 4 /* Frequency Hopping 2Mbps */
+#define IFM_IEEE80211_DS1 5 /* Direct Sequence 1Mbps */
+#define IFM_IEEE80211_DS2 6 /* Direct Sequence 2Mbps */
+#define IFM_IEEE80211_DS5 7 /* Direct Sequence 5.5Mbps */
+#define IFM_IEEE80211_DS11 8 /* Direct Sequence 11Mbps */
+#define IFM_IEEE80211_DS22 9 /* Direct Sequence 22Mbps */
+#define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */
+#define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */
+#define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */
+#define IFM_IEEE80211_IBSSMASTER 0x00000800 /* Operate as an IBSS master */
+
+/*
+ * Shared media sub-types
+ */
+#define IFM_AUTO 0 /* Autoselect best media */
+#define IFM_MANUAL 1 /* Jumper/dipswitch selects media */
+#define IFM_NONE 2 /* Deselect all media */
+
+/*
+ * Shared options
+ */
+#define IFM_FDX 0x00100000 /* Force full duplex */
+#define IFM_HDX 0x00200000 /* Force half duplex */
+#define IFM_FLAG0 0x01000000 /* Driver defined flag */
+#define IFM_FLAG1 0x02000000 /* Driver defined flag */
+#define IFM_FLAG2 0x04000000 /* Driver defined flag */
+#define IFM_LOOP 0x08000000 /* Put hardware in loopback */
+
+/*
+ * Masks
+ */
+#define IFM_NMASK 0x000000e0 /* Network type */
+#define IFM_TMASK 0x0000001f /* Media sub-type */
+#define IFM_IMASK 0xf0000000 /* Instance */
+#define IFM_ISHIFT 28 /* Instance shift */
+#define IFM_OMASK 0x0000ff00 /* Type specific options */
+#define IFM_GMASK 0x0ff00000 /* Global options */
+
+/*
+ * Status bits
+ */
+#define IFM_AVALID 0x00000001 /* Active bit valid */
+#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
+
+/*
+ * Macros to extract various bits of information from the media word.
+ */
+#define IFM_TYPE(x) ((x) & IFM_NMASK)
+#define IFM_SUBTYPE(x) ((x) & IFM_TMASK)
+#define IFM_TYPE_OPTIONS(x) ((x) & IFM_OMASK)
+#define IFM_INST(x) (((x) & IFM_IMASK) >> IFM_ISHIFT)
+#define IFM_OPTIONS(x) ((x) & (IFM_OMASK|IFM_GMASK))
+
+#define IFM_INST_MAX IFM_INST(IFM_IMASK)
+
+/*
+ * Macro to create a media word.
+ */
+#define IFM_MAKEWORD(type, subtype, options, instance) \
+ ((type) | (subtype) | (options) | ((instance) << IFM_ISHIFT))
+
+/*
+ * NetBSD extension not defined in the BSDI API. This is used in various
+ * places to get the canonical description for a given type/subtype.
+ *
+ * NOTE: all but the top-level type descriptions must contain NO whitespace!
+ * Otherwise, parsing these in ifconfig(8) would be a nightmare.
+ */
+struct ifmedia_description {
+ int ifmt_word; /* word value; may be masked */
+ const char *ifmt_string; /* description */
+};
+
+#define IFM_TYPE_DESCRIPTIONS { \
+ { IFM_ETHER, "Ethernet" }, \
+ { IFM_TOKEN, "Token ring" }, \
+ { IFM_FDDI, "FDDI" }, \
+ { IFM_IEEE80211, "IEEE 802.11 Wireless Ethernet" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_ETHERNET_DESCRIPTIONS { \
+ { IFM_10_T, "10baseT/UTP" }, \
+ { IFM_10_2, "10base2/BNC" }, \
+ { IFM_10_5, "10base5/AUI" }, \
+ { IFM_100_TX, "100baseTX" }, \
+ { IFM_100_FX, "100baseFX" }, \
+ { IFM_100_T4, "100baseT4" }, \
+ { IFM_100_VG, "100baseVG" }, \
+ { IFM_100_T2, "100baseT2" }, \
+ { IFM_10_STP, "10baseSTP" }, \
+ { IFM_10_FL, "10baseFL" }, \
+ { IFM_1000_SX, "1000baseSX" }, \
+ { IFM_1000_LX, "1000baseLX" }, \
+ { IFM_1000_CX, "1000baseCX" }, \
+ { IFM_1000_T, "1000baseTX" }, \
+ { IFM_1000_T, "1000baseT" }, \
+ { IFM_HPNA_1, "homePNA" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_ETHERNET_ALIASES { \
+ { IFM_10_T, "UTP" }, \
+ { IFM_10_T, "10UTP" }, \
+ { IFM_10_2, "BNC" }, \
+ { IFM_10_2, "10BNC" }, \
+ { IFM_10_5, "AUI" }, \
+ { IFM_10_5, "10AUI" }, \
+ { IFM_100_TX, "100TX" }, \
+ { IFM_100_T4, "100T4" }, \
+ { IFM_100_VG, "100VG" }, \
+ { IFM_100_T2, "100T2" }, \
+ { IFM_10_STP, "10STP" }, \
+ { IFM_10_FL, "10FL" }, \
+ { IFM_1000_SX, "1000SX" }, \
+ { IFM_1000_LX, "1000LX" }, \
+ { IFM_1000_CX, "1000CX" }, \
+ { IFM_1000_T, "1000TX" }, \
+ { IFM_1000_T, "1000T" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS { \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_TOKENRING_DESCRIPTIONS { \
+ { IFM_TOK_STP4, "DB9/4Mbit" }, \
+ { IFM_TOK_STP16, "DB9/16Mbit" }, \
+ { IFM_TOK_UTP4, "UTP/4Mbit" }, \
+ { IFM_TOK_UTP16, "UTP/16Mbit" }, \
+ { IFM_TOK_STP100, "STP/100Mbit" }, \
+ { IFM_TOK_UTP100, "UTP/100Mbit" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_TOKENRING_ALIASES { \
+ { IFM_TOK_STP4, "4STP" }, \
+ { IFM_TOK_STP16, "16STP" }, \
+ { IFM_TOK_UTP4, "4UTP" }, \
+ { IFM_TOK_UTP16, "16UTP" }, \
+ { IFM_TOK_STP100, "100STP" }, \
+ { IFM_TOK_UTP100, "100UTP" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS { \
+ { IFM_TOK_ETR, "EarlyTokenRelease" }, \
+ { IFM_TOK_SRCRT, "SourceRouting" }, \
+ { IFM_TOK_ALLR, "AllRoutes" }, \
+ { IFM_TOK_DTR, "Dedicated" }, \
+ { IFM_TOK_CLASSIC,"Classic" }, \
+ { IFM_TOK_AUTO, " " }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_FDDI_DESCRIPTIONS { \
+ { IFM_FDDI_SMF, "Single-mode" }, \
+ { IFM_FDDI_MMF, "Multi-mode" }, \
+ { IFM_FDDI_UTP, "UTP" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_FDDI_ALIASES { \
+ { IFM_FDDI_SMF, "SMF" }, \
+ { IFM_FDDI_MMF, "MMF" }, \
+ { IFM_FDDI_UTP, "CDDI" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS { \
+ { IFM_FDDI_DA, "Dual-attach" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_IEEE80211_DESCRIPTIONS { \
+ { IFM_IEEE80211_FH1, "FH/1Mbps" }, \
+ { IFM_IEEE80211_FH2, "FH/2Mbps" }, \
+ { IFM_IEEE80211_DS1, "DS/1Mbps" }, \
+ { IFM_IEEE80211_DS2, "DS/2Mbps" }, \
+ { IFM_IEEE80211_DS5, "DS/5.5Mbps" }, \
+ { IFM_IEEE80211_DS11, "DS/11Mbps" }, \
+ { IFM_IEEE80211_DS22, "DS/22Mbps" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_IEEE80211_ALIASES { \
+ { IFM_IEEE80211_FH1, "FH1" }, \
+ { IFM_IEEE80211_FH2, "FH2" }, \
+ { IFM_IEEE80211_FH1, "FrequencyHopping/1Mbps" }, \
+ { IFM_IEEE80211_FH2, "FrequencyHopping/2Mbps" }, \
+ { IFM_IEEE80211_DS1, "DS1" }, \
+ { IFM_IEEE80211_DS2, "DS2" }, \
+ { IFM_IEEE80211_DS5, "DS5.5" }, \
+ { IFM_IEEE80211_DS11, "DS11" }, \
+ { IFM_IEEE80211_DS22, "DS22" }, \
+ { IFM_IEEE80211_DS1, "DirectSequence/1Mbps" }, \
+ { IFM_IEEE80211_DS2, "DirectSequence/2Mbps" }, \
+ { IFM_IEEE80211_DS5, "DirectSequence/5.5Mbps" }, \
+ { IFM_IEEE80211_DS11, "DirectSequence/11Mbps" }, \
+ { IFM_IEEE80211_DS22, "DirectSequence/22Mbps" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS { \
+ { IFM_IEEE80211_ADHOC, "adhoc" }, \
+ { IFM_IEEE80211_HOSTAP, "hostap" }, \
+ { IFM_IEEE80211_IBSS, "ibss" }, \
+ { IFM_IEEE80211_IBSSMASTER, "ibss-master" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_SHARED_DESCRIPTIONS { \
+ { IFM_AUTO, "autoselect" }, \
+ { IFM_MANUAL, "manual" }, \
+ { IFM_NONE, "none" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SUBTYPE_SHARED_ALIASES { \
+ { IFM_AUTO, "auto" }, \
+ { 0, NULL }, \
+}
+
+#define IFM_SHARED_OPTION_DESCRIPTIONS { \
+ { IFM_FDX, "full-duplex" }, \
+ { IFM_HDX, "half-duplex" }, \
+ { IFM_FLAG0, "flag0" }, \
+ { IFM_FLAG1, "flag1" }, \
+ { IFM_FLAG2, "flag2" }, \
+ { IFM_LOOP, "hw-loopback" }, \
+ { 0, NULL }, \
+}
+
+#endif /* _NET_IF_MEDIA_H_ */
diff --git a/newlib/libc/sys/linux/include/net/if_ppp.h b/newlib/libc/sys/linux/include/net/if_ppp.h
index bf5ec8387..0d4b6078f 100644
--- a/newlib/libc/sys/linux/include/net/if_ppp.h
+++ b/newlib/libc/sys/linux/include/net/if_ppp.h
@@ -1,78 +1,41 @@
-/* From: if_ppp.h,v 1.3 1995/06/12 11:36:50 paulus Exp */
-
/*
* if_ppp.h - Point-to-Point Protocol definitions.
*
- * Copyright (c) 1989 Carnegie Mellon University.
- *
- * 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. 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.
+ * Copyright (c) 1989 Carnegie Mellon University.
+ * All rights reserved.
*
- * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY 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 UNIVERSITY 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.
- *
- */
-
-/*
- * ==FILEVERSION 960926==
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by Carnegie Mellon University. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * NOTE TO MAINTAINERS:
- * If you modify this file at all, please set the above date.
- * if_ppp.h is shipped with a PPP distribution as well as with the kernel;
- * if everyone increases the FILEVERSION number above, then scripts
- * can do the right thing when deciding whether to install a new if_ppp.h
- * file. Don't change the format of that line otherwise, so the
- * installation script can recognize it.
+ * $FreeBSD: src/sys/net/if_ppp.h,v 1.14 1999/08/28 00:48:20 peter Exp $
*/
+#ifndef _IF_PPP_H_
+#define _IF_PPP_H_
-#ifndef __NET_IF_PPP_H
-#define __NET_IF_PPP_H 1
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-#include <net/if.h>
-#include <sys/ioctl.h>
+/* XXX this used to be self-contained. */
#include <net/ppp_defs.h>
-
-__BEGIN_DECLS
+#include <net/if.h>
/*
* Packet sizes
*/
-
#define PPP_MTU 1500 /* Default MTU (size of Info field) */
#define PPP_MAXMRU 65000 /* Largest MRU we allow */
-#define PPP_VERSION "2.2.0"
-#define PPP_MAGIC 0x5002 /* Magic value for the ppp structure */
-#define PROTO_IPX 0x002b /* protocol numbers */
-#define PROTO_DNA_RT 0x0027 /* DNA Routing */
-
+#define PPP_MAXMTU 16384 /* Largest MTU we allow */
/*
* Bit definitions for flags.
*/
-
#define SC_COMP_PROT 0x00000001 /* protocol compression (output) */
#define SC_COMP_AC 0x00000002 /* header compression (output) */
#define SC_COMP_TCP 0x00000004 /* TCP (VJ) compression (output) */
@@ -81,57 +44,57 @@ __BEGIN_DECLS
#define SC_REJ_COMP_TCP 0x00000020 /* reject TCP (VJ) comp. on input */
#define SC_CCP_OPEN 0x00000040 /* Look at CCP packets */
#define SC_CCP_UP 0x00000080 /* May send/recv compressed packets */
-#define SC_ENABLE_IP 0x00000100 /* IP packets may be exchanged */
-#define SC_COMP_RUN 0x00001000 /* compressor has been inited */
-#define SC_DECOMP_RUN 0x00002000 /* decompressor has been inited */
#define SC_DEBUG 0x00010000 /* enable debug messages */
#define SC_LOG_INPKT 0x00020000 /* log contents of good pkts recvd */
#define SC_LOG_OUTPKT 0x00040000 /* log contents of pkts sent */
#define SC_LOG_RAWIN 0x00080000 /* log all chars received */
#define SC_LOG_FLUSH 0x00100000 /* log all chars flushed */
-#define SC_MASK 0x0fE0ffff /* bits that user can change */
+#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
+#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
+#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
+#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
+#define SC_MASK 0x0fff00ff /* bits that user can change */
-/* state bits */
-#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
+/*
+ * State bits in sc_flags, not changeable by user.
+ */
+#define SC_TIMEOUT 0x00000400 /* timeout is currently pending */
+#define SC_VJ_RESET 0x00000800 /* need to reset VJ decomp */
+#define SC_COMP_RUN 0x00001000 /* compressor has been initiated */
+#define SC_DECOMP_RUN 0x00002000 /* decompressor has been initiated */
+#define SC_DC_ERROR 0x00004000 /* non-fatal decomp error detected */
+#define SC_DC_FERROR 0x00008000 /* fatal decomp error detected */
+#define SC_TBUSY 0x10000000 /* xmitter doesn't need a packet yet */
+#define SC_PKTLOST 0x20000000 /* have lost or dropped a packet */
#define SC_FLUSH 0x40000000 /* flush input until next PPP_FLAG */
-#define SC_VJ_RESET 0x20000000 /* Need to reset the VJ decompressor */
-#define SC_XMIT_BUSY 0x10000000 /* ppp_write_wakeup is active */
-#define SC_RCV_ODDP 0x08000000 /* have rcvd char with odd parity */
-#define SC_RCV_EVNP 0x04000000 /* have rcvd char with even parity */
-#define SC_RCV_B7_1 0x02000000 /* have rcvd char with bit 7 = 1 */
-#define SC_RCV_B7_0 0x01000000 /* have rcvd char with bit 7 = 0 */
-#define SC_DC_FERROR 0x00800000 /* fatal decomp error detected */
-#define SC_DC_ERROR 0x00400000 /* non-fatal decomp error detected */
+#define SC_ESCAPED 0x80000000 /* saw a PPP_ESCAPE */
/*
* Ioctl definitions.
*/
struct npioctl {
- int protocol; /* PPP protocol, e.g. PPP_IP */
+ int protocol; /* PPP procotol, e.g. PPP_IP */
enum NPmode mode;
};
/* Structure describing a CCP configuration option, for PPPIOCSCOMPRESS */
struct ppp_option_data {
- u_int8_t *ptr;
- u_int32_t length;
- int transmit;
+ u_char *ptr;
+ u_int length;
+ int transmit;
};
struct ifpppstatsreq {
- struct ifreq b;
- struct ppp_stats stats; /* statistic information */
+ char ifr_name[IFNAMSIZ];
+ struct ppp_stats stats;
};
struct ifpppcstatsreq {
- struct ifreq b;
- struct ppp_comp_stats stats;
+ char ifr_name[IFNAMSIZ];
+ struct ppp_comp_stats stats;
};
-#define ifr__name b.ifr_ifrn.ifrn_name
-#define stats_ptr b.ifr_ifru.ifru_data
-
/*
* Ioctl definitions.
*/
@@ -152,18 +115,23 @@ struct ifpppcstatsreq {
#define PPPIOCSCOMPRESS _IOW('t', 77, struct ppp_option_data)
#define PPPIOCGNPMODE _IOWR('t', 76, struct npioctl) /* get NP mode */
#define PPPIOCSNPMODE _IOW('t', 75, struct npioctl) /* set NP mode */
-#define PPPIOCGDEBUG _IOR('t', 65, int) /* Read debug level */
-#define PPPIOCSDEBUG _IOW('t', 64, int) /* Set debug level */
-#define PPPIOCGIDLE _IOR('t', 63, struct ppp_idle) /* get idle time */
+#define PPPIOCGIDLE _IOR('t', 74, struct ppp_idle) /* get idle time */
+#define PPPIOCSPASS _IOW('t', 71, struct bpf_program) /* set pass filter */
+#define PPPIOCSACTIVE _IOW('t', 70, struct bpf_program) /* set active filt */
-#define SIOCGPPPSTATS (SIOCDEVPRIVATE + 0)
-#define SIOCGPPPVER (SIOCDEVPRIVATE + 1) /* NEVER change this!! */
-#define SIOCGPPPCSTATS (SIOCDEVPRIVATE + 2)
+/* PPPIOC[GS]MTU are alternatives to SIOC[GS]IFMTU, used under Ultrix */
+#define PPPIOCGMTU _IOR('t', 73, int) /* get interface MTU */
+#define PPPIOCSMTU _IOW('t', 72, int) /* set interface MTU */
+
+/*
+ * These two are interface ioctls so that pppstats can do them on
+ * a socket without having to open the serial device.
+ */
+#define SIOCGPPPSTATS _IOWR('i', 123, struct ifpppstatsreq)
+#define SIOCGPPPCSTATS _IOWR('i', 122, struct ifpppcstatsreq)
#if !defined(ifr_mtu)
#define ifr_mtu ifr_ifru.ifru_metric
#endif
-__END_DECLS
-
-#endif /* net/if_ppp.h */
+#endif /* _IF_PPP_H_ */
diff --git a/newlib/libc/sys/linux/include/net/if_pppvar.h b/newlib/libc/sys/linux/include/net/if_pppvar.h
new file mode 100644
index 000000000..b4380f4ec
--- /dev/null
+++ b/newlib/libc/sys/linux/include/net/if_pppvar.h
@@ -0,0 +1,109 @@
+/*
+ * if_pppvar.h - private structures and declarations for PPP.
+ *
+ * Copyright (c) 1994 The Australian National University.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation is hereby granted, provided that the above copyright
+ * notice appears in all copies. This software is provided without any
+ * warranty, express or implied. The Australian National University
+ * makes no representations about the suitability of this software for
+ * any purpose.
+ *
+ * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY
+ * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+ * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ *
+ * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
+ * OR MODIFICATIONS.
+ *
+ * Copyright (c) 1989 Carnegie Mellon University.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by Carnegie Mellon University. The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $FreeBSD: src/sys/net/if_pppvar.h,v 1.19 2002/03/24 09:34:04 bde Exp $
+ */
+
+/*
+ * Supported network protocols. These values are used for
+ * indexing sc_npmode.
+ */
+#define NP_IP 0 /* Internet Protocol */
+#define NUM_NP 1 /* Number of NPs. */
+
+/*
+ * Structure describing each ppp unit.
+ */
+struct ppp_softc {
+ struct ifnet sc_if; /* network-visible interface */
+/*hi*/ u_int sc_flags; /* control/status bits; see if_ppp.h */
+ struct callout_handle sc_ch; /* Used for scheduling timeouts */
+ void *sc_devp; /* pointer to device-dep structure */
+ void (*sc_start)(struct ppp_softc *); /* start output proc */
+ void (*sc_ctlp)(struct ppp_softc *); /* rcvd control pkt */
+ void (*sc_relinq)(struct ppp_softc *); /* relinquish ifunit */
+ void (*sc_setmtu)(struct ppp_softc *); /* set mtu */
+ short sc_mru; /* max receive unit */
+ pid_t sc_xfer; /* used in transferring unit */
+/*hi*/ struct ifqueue sc_rawq; /* received packets */
+/*net*/ struct ifqueue sc_inq; /* queue of input packets for daemon */
+/*net*/ struct ifqueue sc_fastq; /* interactive output packet q */
+ struct mbuf *sc_npqueue; /* output packets not to be sent yet */
+ struct mbuf **sc_npqtail; /* ptr to last next ptr in npqueue */
+ struct pppstat sc_stats; /* count of bytes/pkts sent/rcvd */
+ enum NPmode sc_npmode[NUM_NP]; /* what to do with each NP */
+ struct compressor *sc_xcomp; /* transmit compressor */
+ void *sc_xc_state; /* transmit compressor state */
+ struct compressor *sc_rcomp; /* receive decompressor */
+ void *sc_rc_state; /* receive decompressor state */
+ time_t sc_last_sent; /* time (secs) last NP pkt sent */
+ time_t sc_last_recv; /* time (secs) last NP pkt rcvd */
+#ifdef PPP_FILTER
+ struct bpf_program sc_pass_filt; /* filter for packets to pass */
+ struct bpf_program sc_active_filt; /* filter for "non-idle" packets */
+#endif /* PPP_FILTER */
+#ifdef VJC
+ struct slcompress *sc_comp; /* vjc control buffer */
+#endif
+
+ /* Device-dependent part for async lines. */
+ ext_accm sc_asyncmap; /* async control character map */
+ u_long sc_rasyncmap; /* receive async control char map */
+ struct mbuf *sc_outm; /* mbuf chain currently being output */
+ struct mbuf *sc_m; /* pointer to input mbuf chain */
+ struct mbuf *sc_mc; /* pointer to current input mbuf */
+ char *sc_mp; /* ptr to next char in input mbuf */
+ short sc_ilen; /* length of input packet so far */
+ u_short sc_fcs; /* FCS so far (input) */
+ u_short sc_outfcs; /* FCS so far for output packet */
+ u_char sc_rawin[16]; /* chars as received */
+ int sc_rawin_count; /* # in sc_rawin */
+};
+
+struct ppp_softc *pppalloc(pid_t pid);
+void pppdealloc(struct ppp_softc *sc);
+int pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag,
+ struct thread *td);
+int pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
+ struct rtentry *rtp);
+void ppp_restart(struct ppp_softc *sc);
+void ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost);
+struct mbuf *ppp_dequeue(struct ppp_softc *sc);
diff --git a/newlib/libc/sys/linux/include/netdb.h b/newlib/libc/sys/linux/include/netdb.h
index 9e57ffe9c..e92b269e2 100644
--- a/newlib/libc/sys/linux/include/netdb.h
+++ b/newlib/libc/sys/linux/include/netdb.h
@@ -83,12 +83,8 @@ typedef _BSD_SOCKLEN_T_ socklen_t;
#define _PATH_NETWORKS "/etc/networks"
#define _PATH_PROTOCOLS "/etc/protocols"
#define _PATH_SERVICES "/etc/services"
-#define _PATH_NSSWITCH_CONF "/etc/nsswitch.conf"
-
-extern int *__h_errno_location(void);
-
-#define h_errno (*(__h_errno_location()))
+extern int h_errno;
#define MAXALIASES 35
/* For now, only support one return address. */
@@ -162,27 +158,20 @@ struct addrinfo {
/*
* Error return codes from getaddrinfo()
*/
-/* Error values for `getaddrinfo' function. */
-# define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field. */
-# define EAI_NONAME -2 /* NAME or SERVICE is unknown. */
-# define EAI_AGAIN -3 /* Temporary failure in name resolution. */
-# define EAI_FAIL -4 /* Non-recoverable failure in name res. */
-# define EAI_NODATA -5 /* No address associated with NAME. */
-# define EAI_FAMILY -6 /* `ai_family' not supported. */
-# define EAI_SOCKTYPE -7 /* `ai_socktype' not supported. */
-# define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype'. */
-# define EAI_ADDRFAMILY -9 /* Address family for NAME not supported. */
-# define EAI_MEMORY -10 /* Memory allocation failure. */
-# define EAI_SYSTEM -11 /* System error returned in `errno'. */
-# define EAI_OVERFLOW -12 /* Argument buffer overflow. */
-# ifdef __USE_GNU
-# define EAI_INPROGRESS -100 /* Processing request in progress. */
-# define EAI_CANCELED -101 /* Request canceled. */
-# define EAI_NOTCANCELED -102 /* Request not canceled. */
-# define EAI_ALLDONE -103 /* All requests done. */
-# define EAI_INTR -104 /* Interrupted by a signal. */
-# define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
-# endif
+#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
+#define EAI_AGAIN 2 /* temporary failure in name resolution */
+#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
+#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
+#define EAI_FAMILY 5 /* ai_family not supported */
+#define EAI_MEMORY 6 /* memory allocation failure */
+#define EAI_NODATA 7 /* no address associated with hostname */
+#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
+#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
+#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
+#define EAI_SYSTEM 11 /* system error returned in errno */
+#define EAI_BADHINTS 12
+#define EAI_PROTOCOL 13
+#define EAI_MAX 14
/*
* Flag values for getaddrinfo()
@@ -190,7 +179,6 @@ struct addrinfo {
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */
-#define AI_NUMERICSERV 0x00000008 /* don't use name resolution. */
/* valid flags for addrinfo */
#define AI_MASK \
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG)
@@ -231,14 +219,14 @@ void endnetgrent(void);
void endprotoent(void);
void endservent(void);
void freehostent(struct hostent *);
-struct hostent *gethostbyaddr(const void *, socklen_t, int);
+struct hostent *gethostbyaddr(const char *, int, int);
struct hostent *gethostbyname(const char *);
struct hostent *gethostbyname2(const char *, int);
struct hostent *gethostent(void);
int gethostent_r(struct hostent *, char *, int, int *, FILE **);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
-struct netent *getnetbyaddr(uint32_t, int);
+struct netent *getnetbyaddr(unsigned long, int);
struct netent *getnetbyname(const char *);
struct netent *getnetent(void);
int getnetgrent(char **, char **, char **);
@@ -259,10 +247,10 @@ void setprotoent(int);
int getaddrinfo(const char *, const char *,
const struct addrinfo *, struct addrinfo **);
int getnameinfo(const struct sockaddr *, socklen_t, char *,
- socklen_t, char *, socklen_t, unsigned int);
+ size_t, char *, size_t, int);
void freeaddrinfo(struct addrinfo *);
char *gai_strerror(int);
-int setnetgrent(const char *);
+void setnetgrent(const char *);
void setservent(int);
/*
diff --git a/newlib/libc/sys/linux/include/netinet/if_atm.h b/newlib/libc/sys/linux/include/netinet/if_atm.h
new file mode 100644
index 000000000..04ce13ea2
--- /dev/null
+++ b/newlib/libc/sys/linux/include/netinet/if_atm.h
@@ -0,0 +1,47 @@
+/* $FreeBSD: src/sys/netinet/if_atm.h,v 1.5 2002/03/19 21:25:46 alfred Exp $ */
+/* $NetBSD: if_atm.h,v 1.2 1996/07/03 17:17:17 chuck Exp $ */
+
+/*
+ *
+ * Copyright (c) 1996 Charles D. Cranor and Washington University.
+ * 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 Charles D. Cranor and
+ * Washington University.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * if_atm.h
+ */
+
+struct atm_pseudohdr;
+struct mbuf;
+struct rtentry;
+struct sockaddr;
+
+void atm_rtrequest(int, struct rtentry *, struct rt_addrinfo *);
+int atmresolve(struct rtentry *, struct mbuf *, struct sockaddr *,
+ struct atm_pseudohdr *);
diff --git a/newlib/libc/sys/linux/include/netinet/if_ether.h b/newlib/libc/sys/linux/include/netinet/if_ether.h
index 4bba84912..ec65a3e58 100644
--- a/newlib/libc/sys/linux/include/netinet/if_ether.h
+++ b/newlib/libc/sys/linux/include/netinet/if_ether.h
@@ -37,9 +37,6 @@
#ifndef _NETINET_IF_ETHER_H_
#define _NETINET_IF_ETHER_H_
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <libc-symbols.h>
#include <net/ethernet.h>
#include <net/if_arp.h>
diff --git a/newlib/libc/sys/linux/include/netinet/ip_flow.h b/newlib/libc/sys/linux/include/netinet/ip_flow.h
new file mode 100644
index 000000000..90561f07b
--- /dev/null
+++ b/newlib/libc/sys/linux/include/netinet/ip_flow.h
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by the 3am Software Foundry ("3am"). It was developed by Matt Thomas.
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ *
+ * $FreeBSD: src/sys/netinet/ip_flow.h,v 1.4 2000/05/26 02:05:46 jake Exp $
+ */
+
+#ifndef _NETINET_IP_FLOW_H
+#define _NETINET_IP_FLOW_H
+
+struct ipflow {
+ LIST_ENTRY(ipflow) ipf_next; /* next ipflow in bucket */
+ struct in_addr ipf_dst; /* destination address */
+ struct in_addr ipf_src; /* source address */
+
+ u_int8_t ipf_tos; /* type-of-service */
+ struct route ipf_ro; /* associated route entry */
+ u_long ipf_uses; /* number of uses in this period */
+
+ int ipf_timer; /* remaining lifetime of this entry */
+ u_long ipf_dropped; /* ENOBUFS returned by if_output */
+ u_long ipf_errors; /* other errors returned by if_output */
+ u_long ipf_last_uses; /* number of uses in last period */
+};
+
+#endif
diff --git a/newlib/libc/sys/linux/include/nsswitch.h b/newlib/libc/sys/linux/include/nsswitch.h
new file mode 100644
index 000000000..3a578e4ff
--- /dev/null
+++ b/newlib/libc/sys/linux/include/nsswitch.h
@@ -0,0 +1,184 @@
+/* $NetBSD: nsswitch.h,v 1.6 1999/01/26 01:04:07 lukem Exp $ */
+/* $FreeBSD: src/include/nsswitch.h,v 1.2 2002/03/23 17:24:53 imp Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _NSSWITCH_H
+#define _NSSWITCH_H 1
+
+#include <sys/types.h>
+
+#include <stdarg.h>
+
+#ifndef _PATH_NS_CONF
+#define _PATH_NS_CONF "/etc/nsswitch.conf"
+#endif
+
+#define NS_CONTINUE 0
+#define NS_RETURN 1
+
+#define NS_SUCCESS (1<<0) /* entry was found */
+#define NS_UNAVAIL (1<<1) /* source not responding, or corrupt */
+#define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */
+#define NS_TRYAGAIN (1<<3) /* source busy, may respond to retrys */
+#define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */
+
+/*
+ * currently implemented sources
+ */
+#define NSSRC_FILES "files" /* local files */
+#define NSSRC_DNS "dns" /* DNS; IN for hosts, HS for others */
+#define NSSRC_NIS "nis" /* YP/NIS */
+#define NSSRC_COMPAT "compat" /* passwd,group in YP compat mode */
+
+/*
+ * currently implemented databases
+ */
+#define NSDB_HOSTS "hosts"
+#define NSDB_GROUP "group"
+#define NSDB_GROUP_COMPAT "group_compat"
+#define NSDB_NETGROUP "netgroup"
+#define NSDB_NETWORKS "networks"
+#define NSDB_PASSWD "passwd"
+#define NSDB_PASSWD_COMPAT "passwd_compat"
+#define NSDB_SHELLS "shells"
+
+/*
+ * suggested databases to implement
+ */
+#define NSDB_ALIASES "aliases"
+#define NSDB_AUTH "auth"
+#define NSDB_AUTOMOUNT "automount"
+#define NSDB_BOOTPARAMS "bootparams"
+#define NSDB_ETHERS "ethers"
+#define NSDB_EXPORTS "exports"
+#define NSDB_NETMASKS "netmasks"
+#define NSDB_PHONES "phones"
+#define NSDB_PRINTCAP "printcap"
+#define NSDB_PROTOCOLS "protocols"
+#define NSDB_REMOTE "remote"
+#define NSDB_RPC "rpc"
+#define NSDB_SENDMAILVARS "sendmailvars"
+#define NSDB_SERVICES "services"
+#define NSDB_TERMCAP "termcap"
+#define NSDB_TTYS "ttys"
+
+/*
+ * ns_dtab - `nsswitch dispatch table'
+ * contains an entry for each source and the appropriate function to call
+ */
+typedef struct {
+ const char *src;
+ int (*callback)(void *retval, void *cb_data, va_list ap);
+ void *cb_data;
+} ns_dtab;
+
+/*
+ * macros to help build an ns_dtab[]
+ */
+#define NS_FILES_CB(F,C) { NSSRC_FILES, F, C },
+#define NS_COMPAT_CB(F,C) { NSSRC_COMPAT, F, C },
+
+#ifdef HESIOD
+# define NS_DNS_CB(F,C) { NSSRC_DNS, F, C },
+#else
+# define NS_DNS_CB(F,C)
+#endif
+
+#ifdef YP
+# define NS_NIS_CB(F,C) { NSSRC_NIS, F, C },
+#else
+# define NS_NIS_CB(F,C)
+#endif
+
+/*
+ * ns_src - `nsswitch source'
+ * used by the nsparser routines to store a mapping between a source
+ * and its dispatch control flags for a given database.
+ */
+typedef struct {
+ const char *name;
+ u_int32_t flags;
+} ns_src;
+
+
+/*
+ * default sourcelist (if nsswitch.conf is missing, corrupt,
+ * or the requested database doesn't have an entry.
+ */
+extern const ns_src __nsdefaultsrc[];
+
+
+#ifdef _NS_PRIVATE
+
+/*
+ * private data structures for back-end nsswitch implementation
+ */
+
+/*
+ * ns_dbt - `nsswitch database thang'
+ * for each database in /etc/nsswitch.conf there is a ns_dbt, with its
+ * name and a list of ns_src's containing the source information.
+ */
+typedef struct {
+ const char *name; /* name of database */
+ ns_src *srclist; /* list of sources */
+ int srclistsize; /* size of srclist */
+} ns_dbt;
+
+#endif /* _NS_PRIVATE */
+
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+extern int nsdispatch(void *, const ns_dtab [], const char *,
+ const char *, const ns_src [], ...);
+
+#ifdef _NS_PRIVATE
+extern void _nsdbtaddsrc(ns_dbt *, const ns_src *);
+extern void _nsdbtdump(const ns_dbt *);
+extern const ns_dbt *_nsdbtget(const char *);
+extern void _nsdbtput(const ns_dbt *);
+extern void _nsyyerror(const char *);
+extern int _nsyylex(void);
+extern int _nsyylineno;
+#endif /* _NS_PRIVATE */
+
+__END_DECLS
+
+#endif /* !_NSSWITCH_H */
diff --git a/newlib/libc/sys/linux/include/resolv.h b/newlib/libc/sys/linux/include/resolv.h
index 35db205d9..1114f2d92 100644
--- a/newlib/libc/sys/linux/include/resolv.h
+++ b/newlib/libc/sys/linux/include/resolv.h
@@ -94,27 +94,6 @@
#define RES_TIMEOUT 5 /* min. seconds between retries */
#define MAXRESOLVSORT 10 /* number of net to sort on */
#define RES_MAXNDOTS 15 /* should reflect bit field size */
-#define RES_MAXRETRANS 30 /* only for resolv.conf/RES_OPTIONS */
-#define RES_MAXRETRY 5 /* only for resolv.conf/RES_OPTIONS */
-#define RES_DFLRETRY 2 /* Default #/tries. */
-#define RES_MAXTIME 65535 /* Infinity, in milliseconds. */
-
-
-typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
- res_sendhookact;
-typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *ns, const u_char **query,
- int *querylen,
- u_char *ans,
- int anssiz,
- int *resplen);
-
-typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *ns,
- const u_char *query,
- int querylen,
- u_char *ans,
- int anssiz,
- int *resplen);
-
struct __res_state {
int retrans; /* retransmition time interval */
@@ -135,31 +114,9 @@ struct __res_state {
struct in_addr addr;
u_int32_t mask;
} sort_list[MAXRESOLVSORT];
- res_send_qhook qhook; /* query hook */
- res_send_rhook rhook; /* response hook */
- int res_h_errno; /* last one set for this context */
- int _vcsock; /* PRIVATE: for res_send VC i/o */
- u_int _flags; /* PRIVATE: see below */
- union {
- char pad[52]; /* On an i386 this means 512b total. */
- struct {
- u_int16_t nscount;
- u_int16_t nsmap[MAXNS];
- int nssocks[MAXNS];
- u_int16_t nscount6;
- u_int16_t nsinit;
- struct sockaddr_in6 *nsaddrs[MAXNS];
- unsigned long long int initstamp
- __attribute__((packed));
-#if 0
- unsigned int _initstamp[2];
-#endif
- } _ext;
- } _u;
+ char pad[72]; /* on an i386 this means 512b total */
};
-typedef struct __res_state *res_state;
-
/* for INET6 */
/*
* replacement of __res_state, separated to keep binary compatibility.
@@ -176,15 +133,6 @@ struct __res_state_ext {
};
/*
- * * Resolver flags (used to be discrete per-module statics ints).
- * */
-#define RES_F_VC 0x00000001 /* socket is TCP */
-#define RES_F_CONN 0x00000002 /* socket is connected */
-
-/* res_findzonecut() options */
-#define RES_EXHAUSTIVE 0x00000001 /* always do all queries */
-
-/*
* Resolver options (keep these in synch with res_debug.c, please)
*/
#define RES_INIT 0x00000001 /* address initialized */
@@ -201,16 +149,11 @@ struct __res_state_ext {
#define RES_INSECURE2 0x00000800 /* type 2 security disabled */
#define RES_NOALIASES 0x00001000 /* shuts off HOSTALIASES feature */
#define RES_USE_INET6 0x00002000 /* use/map IPv6 in gethostbyname() */
-#define RES_ROTATE 0x00004000 /* rotate ns list after each query */
-#define RES_NOCHECKNAME 0x00008000 /* do not check names for sanity. */
-#define RES_KEEPTSIG 0x00010000 /* do not strip TSIG records */
-#define RES_BLAST 0x00020000 /* blast all recursive servers */
-#define RES_USEBSTRING 0x00040000 /* IPv6 reverse lookup with byte
- strings */
-#define RES_NOIP6DOTINT 0x00080000 /* Do not use .ip6.int in IPv6
- reverse lookup */
+#define RES_NOTLDQUERY 0x00004000 /* Don't query TLD names */
+/* KAME extensions: use higher bit to avoid conflict with ISC use */
+#define RES_USE_EDNS0 0x40000000 /* use EDNS0 */
-#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
+#define RES_DEFAULT (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH)
/*
* Resolver "pfcode" values. Used by dig.
@@ -232,13 +175,22 @@ struct __res_state_ext {
#define RES_PRF_INIT 0x00004000
/* 0x00008000 */
-#define RES_SET_H_ERRNO(r,x) \
- do \
- { \
- (r)->res_h_errno = x; \
- h_errno = (x); \
- } \
- while (0)
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+ res_sendhookact;
+
+typedef res_sendhookact (*res_send_qhook)(struct sockaddr_in * const *ns,
+ const u_char **query,
+ int *querylen,
+ u_char *ans,
+ int anssiz,
+ int *resplen);
+
+typedef res_sendhookact (*res_send_rhook)(const struct sockaddr_in *ns,
+ const u_char *query,
+ int querylen,
+ u_char *ans,
+ int anssiz,
+ int *resplen);
struct res_sym {
int number; /* Identifying number, like T_MX */
@@ -255,7 +207,6 @@ extern const struct res_sym __p_type_syms[];
/* Private routines shared between libc/net, named, nslookup and others. */
#define res_hnok __res_hnok
-#define res_hostalias __res_hostalias
#define res_ownok __res_ownok
#define res_mailok __res_mailok
#define res_dnok __res_dnok
@@ -276,7 +227,6 @@ extern const struct res_sym __p_type_syms[];
#define putlong __putlong
#define putshort __putshort
#define p_class __p_class
-#define p_rcode __p_rcode
#define p_time __p_time
#define p_type __p_type
#define p_query __p_query
@@ -299,15 +249,6 @@ extern const struct res_sym __p_type_syms[];
#define res_send __res_send
#define res_isourserver __res_isourserver
#define res_nameinquery __res_nameinquery
-#define res_nclose __res_nclose
-#define res_ninit __res_ninit
-#define res_nmkquery __res_nmkquery
-#define res_npquery __res_npquery
-#define res_nquery __res_nquery
-#define res_nquerydomain __res_nquerydomain
-#define res_nsearch __res_nsearch
-#define res_nsend __res_nsend
-#define res_nisourserver __res_nisourserver
#define res_queriesmatch __res_queriesmatch
#define res_close __res_close
#define res_opt __res_opt
@@ -335,7 +276,6 @@ const char * hostalias(const char *);
void putlong(u_int32_t, u_char *);
void putshort(u_int16_t, u_char *);
const char * p_class(int);
-const char * p_rcode (int);
const char * p_time(u_int32_t);
const char * p_type(int);
void p_query(const u_char *);
@@ -362,18 +302,6 @@ int res_send(const u_char *, int, u_char *, int);
int res_isourserver(const struct sockaddr_in *);
int res_nameinquery(const char *, int, int,
const u_char *, const u_char *);
-void res_npquery (const res_state, const u_char *, int, FILE *);
-const char * res_hostalias (const res_state, const char *, char *, size_t);
-int res_nquery (res_state, const char *, int, int, u_char *, int);
-int res_nsearch (res_state, const char *, int, int, u_char *, int);
-int res_nquerydomain (res_state, const char *, const char *, int,
- int, u_char *, int);
-int res_nmkquery (res_state, int, const char *, int, int,
- const u_char *, int, const u_char *, u_char *,
- int);
-int res_nsend (res_state, const u_char *, int, u_char *, int);
-void res_nclose (res_state);
-
int res_queriesmatch(const u_char *, const u_char *,
const u_char *, const u_char *);
void res_close(void);
@@ -386,7 +314,6 @@ int res_mkupdate(ns_updrec *, u_char *, int);
ns_updrec * res_mkupdrec(int, const char *, u_int, u_int, u_long);
void res_freeupdrec(ns_updrec *);
#endif
-
__END_DECLS
#endif /* !_RESOLV_H_ */
diff --git a/newlib/libc/sys/linux/include/sched.h b/newlib/libc/sys/linux/include/sched.h
index 91a7a7e7b..becad0f36 100644
--- a/newlib/libc/sys/linux/include/sched.h
+++ b/newlib/libc/sys/linux/include/sched.h
@@ -22,9 +22,6 @@
#include <features.h>
-#define __need_size_t
-#include <stddef.h>
-
/* Get type definitions. */
#include <bits/types.h>
diff --git a/newlib/libc/sys/linux/include/stdint.h b/newlib/libc/sys/linux/include/stdint.h
index 682af1f7a..d1197f66c 100644
--- a/newlib/libc/sys/linux/include/stdint.h
+++ b/newlib/libc/sys/linux/include/stdint.h
@@ -15,7 +15,6 @@
#define _STDINT_H
#include <sys/types.h>
-#include <bits/wordsize.h>
#ifdef __cplusplus
extern "C" {
@@ -88,34 +87,6 @@ typedef uint32_t uint_least16_t;
#endif
#endif
-/* Fast types. */
-
-/* Signed. */
-typedef signed char int_fast8_t;
-#if __WORDSIZE == 64
-typedef long int int_fast16_t;
-typedef long int int_fast32_t;
-typedef long int int_fast64_t;
-#else
-typedef int int_fast16_t;
-typedef int int_fast32_t;
-__extension__
-typedef long long int int_fast64_t;
-#endif
-
-/* Unsigned. */
-typedef unsigned char uint_fast8_t;
-#if __WORDSIZE == 64
-typedef unsigned long int uint_fast16_t;
-typedef unsigned long int uint_fast32_t;
-typedef unsigned long int uint_fast64_t;
-#else
-typedef unsigned int uint_fast16_t;
-typedef unsigned int uint_fast32_t;
-__extension__
-typedef unsigned long long int uint_fast64_t;
-#endif
-
#if __STDINT_EXP(LONG_MAX) > 0x7fffffff
#define __int64_t_defined 1
#define __have_long64 1
diff --git a/newlib/libc/sys/linux/intl/locale.alias b/newlib/libc/sys/linux/intl/locale.alias
new file mode 100644
index 000000000..08c250d35
--- /dev/null
+++ b/newlib/libc/sys/linux/intl/locale.alias
@@ -0,0 +1,75 @@
+# Locale name alias data base.
+# Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# The format of this file is the same as for the corresponding file of
+# the X Window System, which normally can be found in
+# /usr/lib/X11/locale/locale.alias
+# A single line contains two fields: an alias and a substitution value.
+# All entries are case independent.
+
+# Note: This file is far from being complete. If you have a value for
+# your own site which you think might be useful for others too, share
+# it with the rest of us. Send it using the `glibcbug' script to
+# bugs@gnu.org.
+
+bokmal no_NO.ISO-8859-1
+bokmål no_NO.ISO-8859-1
+catalan ca_ES.ISO-8859-1
+croatian hr_HR.ISO-8859-2
+czech cs_CZ.ISO-8859-2
+danish da_DK.ISO-8859-1
+dansk da_DK.ISO-8859-1
+deutsch de_DE.ISO-8859-1
+dutch nl_NL.ISO-8859-1
+eesti et_EE.ISO-8859-1
+estonian et_EE.ISO-8859-1
+finnish fi_FI.ISO-8859-1
+français fr_FR.ISO-8859-1
+french fr_FR.ISO-8859-1
+galego gl_ES.ISO-8859-1
+galician gl_ES.ISO-8859-1
+german de_DE.ISO-8859-1
+greek el_GR.ISO-8859-7
+hebrew he_IL.ISO-8859-8
+hrvatski hr_HR.ISO-8859-2
+hungarian hu_HU.ISO-8859-2
+icelandic is_IS.ISO-8859-1
+italian it_IT.ISO-8859-1
+japanese ja_JP.eucJP
+japanese.euc ja_JP.eucJP
+ja_JP ja_JP.eucJP
+ja_JP.ujis ja_JP.eucJP
+japanese.sjis ja_JP.SJIS
+korean ko_KR.eucKR
+korean.euc ko_KR.eucKR
+ko_KR ko_KR.eucKR
+lithuanian lt_LT.ISO-8859-13
+nb_NO no_NO.ISO-8859-1
+nb_NO.ISO-8859-1 no_NO.ISO-8859-1
+norwegian no_NO.ISO-8859-1
+nynorsk nn_NO.ISO-8859-1
+polish pl_PL.ISO-8859-2
+portuguese pt_PT.ISO-8859-1
+romanian ro_RO.ISO-8859-2
+russian ru_RU.ISO-8859-5
+slovak sk_SK.ISO-8859-2
+slovene sl_SI.ISO-8859-2
+slovenian sl_SI.ISO-8859-2
+spanish es_ES.ISO-8859-1
+swedish sv_SE.ISO-8859-1
+thai th_TH.TIS-620
+turkish tr_TR.ISO-8859-9
diff --git a/newlib/libc/sys/linux/isatty.c b/newlib/libc/sys/linux/isatty.c
deleted file mode 100644
index 45e09400e..000000000
--- a/newlib/libc/sys/linux/isatty.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1991, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <unistd.h>
-#include <termios.h>
-
-#include <machine/weakalias.h>
-
-/* Return 1 if FD is a terminal, 0 if not. */
-int
-__isatty (fd)
- int fd;
-{
- struct termios term;
-
- return tcgetattr (fd, &term) == 0;
-}
-
-weak_alias (__isatty, isatty)
diff --git a/newlib/libc/sys/linux/libc-symbols.h b/newlib/libc/sys/linux/libc-symbols.h
index f32260c95..97b672643 100644
--- a/newlib/libc/sys/linux/libc-symbols.h
+++ b/newlib/libc/sys/linux/libc-symbols.h
@@ -349,31 +349,4 @@
strong_alias(real, name)
#endif
-#define libc_hidden_def(x)
-#define libc_hidden_weak(x)
-#define libc_hidden_proto(x)
-#define libc_hidden_data_def(x)
-#define libresolv_hidden_def(x)
-#define libresolv_hidden_weak(x)
-#define libresolv_hidden_data_def(x)
-#define libresolv_hidden_proto(x)
-#define static_link_warning(x)
-#define libc_freeres_ptr(x) x
-#define DL_CALL_FCT(x,y) x y
-#define attribute_hidden
-#define internal_function
-
-/* Move compatibility symbols out of the way by placing them all in a
- special section. */
-#ifndef __ASSEMBLER__
-# define attribute_compat_text_section \
- __attribute__ ((section (".text.compat")))
-# define attribute_compat_data_section \
- __attribute__ ((section (".data.compat")))
-#else
-# define compat_text_section .section ".text.compat", "ax";
-# define compat_data_section .section ".data.compat", "aw";
-#endif
-
-
#endif /* libc-symbols.h */
diff --git a/newlib/libc/sys/linux/machine/i386/atomic.h b/newlib/libc/sys/linux/machine/i386/atomic.h
deleted file mode 100644
index c74876175..000000000
--- a/newlib/libc/sys/linux/machine/i386/atomic.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-
-
-typedef int8_t atomic8_t;
-typedef uint8_t uatomic8_t;
-typedef int_fast8_t atomic_fast8_t;
-typedef uint_fast8_t uatomic_fast8_t;
-
-typedef int16_t atomic16_t;
-typedef uint16_t uatomic16_t;
-typedef int_fast16_t atomic_fast16_t;
-typedef uint_fast16_t uatomic_fast16_t;
-
-typedef int32_t atomic32_t;
-typedef uint32_t uatomic32_t;
-typedef int_fast32_t atomic_fast32_t;
-typedef uint_fast32_t uatomic_fast32_t;
-
-typedef int64_t atomic64_t;
-typedef uint64_t uatomic64_t;
-typedef int_fast64_t atomic_fast64_t;
-typedef uint_fast64_t uatomic_fast64_t;
-
-typedef intptr_t atomicptr_t;
-typedef uintptr_t uatomicptr_t;
-typedef intmax_t atomic_max_t;
-typedef uintmax_t uatomic_max_t;
-
-
-#ifndef LOCK_PREFIX
-# ifdef UP
-# define LOCK_PREFIX /* nothing */
-# else
-# define LOCK_PREFIX "lock;"
-# endif
-#endif
-
-
-#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
- ({ __typeof (*mem) ret; \
- __asm __volatile (LOCK_PREFIX "cmpxchgb %b2, %1" \
- : "=a" (ret), "=m" (*mem) \
- : "q" (newval), "m" (*mem), "0" (oldval)); \
- ret; })
-
-#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
- ({ __typeof (*mem) ret; \
- __asm __volatile (LOCK_PREFIX "cmpxchgw %w2, %1" \
- : "=a" (ret), "=m" (*mem) \
- : "r" (newval), "m" (*mem), "0" (oldval)); \
- ret; })
-
-#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
- ({ __typeof (*mem) ret; \
- __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \
- : "=a" (ret), "=m" (*mem) \
- : "r" (newval), "m" (*mem), "0" (oldval)); \
- ret; })
-
-/* XXX We do not really need 64-bit compare-and-exchange. At least
- not in the moment. Using it would mean causing portability
- problems since not many other 32-bit architectures have support for
- such an operation. So don't define any code for now. If it is
- really going to be used the code below can be used on Intel Pentium
- and later, but NOT on i486. */
-#if 1
-# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
- ({ __typeof (*mem) ret = *(mem); abort (); ret = (newval); ret = (oldval); })
-#else
-# ifdef __PIC__
-# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
- ({ __typeof (*mem) ret; \
- __asm __volatile ("xchgl %2, %%ebx\n\t" \
- LOCK_PREFIX "cmpxchg8b %1\n\t" \
- "xchgl %2, %%ebx" \
- : "=A" (ret), "=m" (*mem) \
- : "DS" (((unsigned long long int) (newval)) \
- & 0xffffffff), \
- "c" (((unsigned long long int) (newval)) >> 32), \
- "m" (*mem), "a" (((unsigned long long int) (oldval)) \
- & 0xffffffff), \
- "d" (((unsigned long long int) (oldval)) >> 32)); \
- ret; })
-# else
-# define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
- ({ __typeof (*mem) ret; \
- __asm __volatile (LOCK_PREFIX "cmpxchg8b %1" \
- : "=A" (ret), "=m" (*mem) \
- : "b" (((unsigned long long int) (newval)) \
- & 0xffffffff), \
- "c" (((unsigned long long int) (newval)) >> 32), \
- "m" (*mem), "a" (((unsigned long long int) (oldval)) \
- & 0xffffffff), \
- "d" (((unsigned long long int) (oldval)) >> 32)); \
- ret; })
-# endif
-#endif
-
-
-/* Note that we need no lock prefix. */
-#define atomic_exchange_acq(mem, newvalue) \
- ({ __typeof (*mem) result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile ("xchgb %b0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (newvalue), "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile ("xchgw %w0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (newvalue), "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile ("xchgl %0, %1" \
- : "=r" (result), "=m" (*mem) \
- : "0" (newvalue), "m" (*mem)); \
- else \
- { \
- result = 0; \
- abort (); \
- } \
- result; })
-
-
-#define atomic_exchange_and_add(mem, value) \
- ({ __typeof (*mem) __result; \
- __typeof (value) __addval = (value); \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "xaddb %b0, %1" \
- : "=r" (__result), "=m" (*mem) \
- : "0" (__addval), "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "xaddw %w0, %1" \
- : "=r" (__result), "=m" (*mem) \
- : "0" (__addval), "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "xaddl %0, %1" \
- : "=r" (__result), "=m" (*mem) \
- : "0" (__addval), "m" (*mem)); \
- else \
- { \
- __typeof (mem) __memp = (mem); \
- __typeof (*mem) __tmpval; \
- __result = *__memp; \
- do \
- __tmpval = __result; \
- while ((__result = __arch_compare_and_exchange_val_64_acq \
- (__memp, __result + __addval, __result)) == __tmpval); \
- } \
- __result; })
-
-
-#define atomic_add(mem, value) \
- (void) ({ if (__builtin_constant_p (value) && (value) == 1) \
- atomic_increment (mem); \
- else if (__builtin_constant_p (value) && (value) == -1) \
- atomic_decrement (mem); \
- else if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "addb %b1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "addw %w1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "addl %1, %0" \
- : "=m" (*mem) \
- : "ir" (value), "m" (*mem)); \
- else \
- { \
- __typeof (value) __addval = (value); \
- __typeof (mem) __memp = (mem); \
- __typeof (*mem) __oldval = *__memp; \
- __typeof (*mem) __tmpval; \
- do \
- __tmpval = __oldval; \
- while ((__oldval = __arch_compare_and_exchange_val_64_acq \
- (__memp, __oldval + __addval, __oldval)) == __tmpval); \
- } \
- })
-
-
-#define atomic_add_negative(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "addb %b2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "iq" (value), "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "addw %w2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "addl %2, %0; sets %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "m" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_add_zero(mem, value) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "addb %b2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "addw %w2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "addl %2, %0; setz %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "ir" (value), "m" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_increment(mem) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "incb %b0" \
- : "=m" (*mem) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "incw %w0" \
- : "=m" (*mem) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "incl %0" \
- : "=m" (*mem) \
- : "m" (*mem)); \
- else \
- { \
- __typeof (mem) __memp = (mem); \
- __typeof (*mem) __oldval = *__memp; \
- __typeof (*mem) __tmpval; \
- do \
- __tmpval = __oldval; \
- while ((__oldval = __arch_compare_and_exchange_val_64_acq \
- (__memp, __oldval + 1, __oldval)) == __tmpval); \
- } \
- })
-
-
-#define atomic_increment_and_test(mem) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "incb %0; sete %b1" \
- : "=m" (*mem), "=qm" (__result) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "incw %0; sete %w1" \
- : "=m" (*mem), "=qm" (__result) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "incl %0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "m" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_decrement(mem) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "decb %b0" \
- : "=m" (*mem) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "decw %w0" \
- : "=m" (*mem) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "decl %0" \
- : "=m" (*mem) \
- : "m" (*mem)); \
- else \
- { \
- __typeof (mem) __memp = (mem); \
- __typeof (*mem) __oldval = *__memp; \
- __typeof (*mem) __tmpval; \
- do \
- __tmpval = __oldval; \
- while ((__oldval = __arch_compare_and_exchange_val_64_acq \
- (__memp, __oldval - 1, __oldval)) == __tmpval); \
- } \
- })
-
-
-#define atomic_decrement_and_test(mem) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "decb %b0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "decw %w0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "m" (*mem)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "decl %0; sete %1" \
- : "=m" (*mem), "=qm" (__result) \
- : "m" (*mem)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_bit_set(mem, bit) \
- (void) ({ if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "orb %b2, %0" \
- : "=m" (*mem) \
- : "m" (*mem), "ir" (1 << (bit))); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "orw %w2, %0" \
- : "=m" (*mem) \
- : "m" (*mem), "ir" (1 << (bit))); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "orl %2, %0" \
- : "=m" (*mem) \
- : "m" (*mem), "ir" (1 << (bit))); \
- else \
- abort (); \
- })
-
-
-#define atomic_bit_test_set(mem, bit) \
- ({ unsigned char __result; \
- if (sizeof (*mem) == 1) \
- __asm __volatile (LOCK_PREFIX "btsb %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "m" (*mem), "ir" (bit)); \
- else if (sizeof (*mem) == 2) \
- __asm __volatile (LOCK_PREFIX "btsw %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "m" (*mem), "ir" (bit)); \
- else if (sizeof (*mem) == 4) \
- __asm __volatile (LOCK_PREFIX "btsl %3, %1; setc %0" \
- : "=q" (__result), "=m" (*mem) \
- : "m" (*mem), "ir" (bit)); \
- else \
- abort (); \
- __result; })
-
-
-#define atomic_delay() asm ("rep; nop")
diff --git a/newlib/libc/sys/linux/machine/i386/get_clockfreq.c b/newlib/libc/sys/linux/machine/i386/get_clockfreq.c
index 0f49fb07c..ea46ed427 100644
--- a/newlib/libc/sys/linux/machine/i386/get_clockfreq.c
+++ b/newlib/libc/sys/linux/machine/i386/get_clockfreq.c
@@ -23,6 +23,33 @@
#include <unistd.h>
#include <libc-internal.h>
+static
+void *memmem (const void *a, size_t len1, const void *b, size_t len2)
+{
+ char *end, *start;
+ char *ptr1, *ptr2;
+
+ if (len2 > len1)
+ return NULL;
+
+ start = (char *)a;
+ end = start + len1;
+
+ while (start < end)
+ {
+ size_t len = len2;
+ ptr1 = start;
+ ptr2 = (char *)b;
+ while (len > 0 && *ptr1++ == *ptr2++)
+ --len;
+ if (len == 0)
+ return start;
+ ++start;
+ }
+
+ return NULL;
+}
+
hp_timing_t
__get_clockfreq (void)
{
diff --git a/newlib/libc/sys/linux/machine/i386/include/endian.h b/newlib/libc/sys/linux/machine/i386/include/endian.h
index f5a8aafc7..aa9cd90a3 100644
--- a/newlib/libc/sys/linux/machine/i386/include/endian.h
+++ b/newlib/libc/sys/linux/machine/i386/include/endian.h
@@ -47,22 +47,11 @@
* Definitions for byte order, according to byte significance from low
* address to high.
*/
-
-#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
-#endif
-
-#ifndef BIG_ENDIAN
#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
-#endif
-
-#ifndef PDP_ENDIAN
#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
-#endif
-#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
-#endif
#ifndef KERNEL
#include <sys/cdefs.h>
diff --git a/newlib/libc/sys/linux/machine/i386/include/param.h b/newlib/libc/sys/linux/machine/i386/include/param.h
index 977a65711..fbe1be2ac 100644
--- a/newlib/libc/sys/linux/machine/i386/include/param.h
+++ b/newlib/libc/sys/linux/machine/i386/include/param.h
@@ -60,9 +60,7 @@
#define LITTLE_ENDIAN 1234
#endif
-#ifndef BYTE_ORDER
#define BYTE_ORDER LITTLE_ENDIAN
-#endif
/*
* OBJFORMAT_NAMES is a comma-separated list of the object formats
diff --git a/newlib/libc/sys/linux/net/Makefile.am b/newlib/libc/sys/linux/net/Makefile.am
index 0b1a0d978..080709f4d 100644
--- a/newlib/libc/sys/linux/net/Makefile.am
+++ b/newlib/libc/sys/linux/net/Makefile.am
@@ -2,38 +2,28 @@
AUTOMAKE_OPTIONS = cygnus
-INCLUDES = -I$(srcdir)/../include -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
-GENERAL_SOURCES = addr2ascii.c ascii2addr.c alias-lookup.c \
- base64.c check_pf.c digits_dots.c \
- ether_aton.c ether_aton_r.c ether_hton.c \
- ether_line.c ether_ntoa.c ether_ntoa_r.c ether_ntoh.c \
- ethers-lookup.c getaddrinfo.c getaliasent.c \
- getaliasent_r.c getaliasname.c getaliasname_r.c gethstbyad.c \
- gethstbyad_r.c gethstbynm2.c gethstbynm2_r.c gethstbynm.c \
- gethstbynm_r.c gethstent.c gethstent_r.c getnameinfo.c getnetbyad.c \
- getnetbyad_r.c getnetbynm.c getnetbynm_r.c getnetent.c getnetent_r.c \
- getnetgrent.c getnetgrent_r.c getnssent.c getnssent_r.c getproto.c \
- getproto_r.c getprtent.c \
- getprtent_r.c getprtname.c getprtname_r.c getrpcbyname.c \
- getrpcbyname_r.c getrpcbynumber.c getrpcbynumber_r.c getrpcent.c \
- getrpcent_r.c getservent.c getservent_r.c getsrvbynm.c getsrvbynm_r.c \
- getsrvbypt.c getsrvbypt_r.c grp-lookup.c \
- herrno.c hosts-lookup.c ifreq.c \
- in6_addr.c inet6_option.c inet_addr.c \
- inet_lnaof.c inet_mkadr.c inet_net.c inet_neta.c inet_netof.c \
- inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c \
- inet_pton.c issetugid-stub.c key-lookup.c netgrp-lookup.c \
- network-lookup.c nsswitch.c \
- ns_name.c ns_netint.c ns_parse.c ns_print.c ns_samedomain.c \
- ns_ttl.c nsap_addr.c proto-lookup.c opensock.c pwd-lookup.c recv.c \
- res_comp.c res_data.c res_debug.c res_hconf.c res_init.c \
- res_libc.c res_mkquery.c \
- res_query.c res_send.c \
- rexec.c rpc-lookup.c ruserpass.c send.c service-lookup.c spwd-lookup.c
+GENERAL_SOURCES = addr2ascii.c ascii2addr.c base64.c bindresvport.c ether_addr.c getaddrinfo.c \
+ gethostbydns.c gethostbyht.c gethostbynis.c gethostnamadr.c \
+ getifaddrs.c getnameinfo.c \
+ getnetbydns.c getnetbyht.c getnetbynis.c getnetnamadr.c \
+ getproto.c getprotoent.c getprotoname.c getservbyname.c \
+ getservbyport.c getservent.c herror.c hesiod.c inet_addr.c \
+ ifname.c inet_lnaof.c \
+ inet_makeaddr.c inet_net_ntop.c inet_net_pton.c inet_neta.c \
+ inet_netof.c inet_network.c inet_ntoa.c inet_ntop.c \
+ inet_pton.c innetgr-stub.c ip6opt.c issetugid-stub.c \
+ linkaddr.c map_v4v6.c namespace.h un-namespace.h \
+ name6.c ns_addr.c \
+ ns_name.c ns_netint.c \
+ ns_ntoa.c ns_parse.c ns_print.c ns_ttl.c \
+ nsdispatch.c nslexer.c nsparser.c nsparser.h \
+ nsap_addr.c res_comp.c res_data.c res_debug.c \
+ res_init.c res_mkquery.c res_mkupdate.c res_query.c \
+ res_send.c res_update.c rthdr.c vars.c
ELIX_4_SOURCES = \
- ifname.c \
rcmd.$(oext) \
rcmdsh.$(oext)
diff --git a/newlib/libc/sys/linux/net/Makefile.in b/newlib/libc/sys/linux/net/Makefile.in
index f373a9094..84aeff804 100644
--- a/newlib/libc/sys/linux/net/Makefile.in
+++ b/newlib/libc/sys/linux/net/Makefile.in
@@ -56,59 +56,38 @@ ARFLAGS = cru
lib_a_AR = $(AR) $(ARFLAGS)
lib_a_LIBADD =
am__objects_1 = lib_a-addr2ascii.$(OBJEXT) lib_a-ascii2addr.$(OBJEXT) \
- lib_a-alias-lookup.$(OBJEXT) lib_a-base64.$(OBJEXT) \
- lib_a-check_pf.$(OBJEXT) lib_a-digits_dots.$(OBJEXT) \
- lib_a-ether_aton.$(OBJEXT) lib_a-ether_aton_r.$(OBJEXT) \
- lib_a-ether_hton.$(OBJEXT) lib_a-ether_line.$(OBJEXT) \
- lib_a-ether_ntoa.$(OBJEXT) lib_a-ether_ntoa_r.$(OBJEXT) \
- lib_a-ether_ntoh.$(OBJEXT) lib_a-ethers-lookup.$(OBJEXT) \
- lib_a-getaddrinfo.$(OBJEXT) lib_a-getaliasent.$(OBJEXT) \
- lib_a-getaliasent_r.$(OBJEXT) lib_a-getaliasname.$(OBJEXT) \
- lib_a-getaliasname_r.$(OBJEXT) lib_a-gethstbyad.$(OBJEXT) \
- lib_a-gethstbyad_r.$(OBJEXT) lib_a-gethstbynm2.$(OBJEXT) \
- lib_a-gethstbynm2_r.$(OBJEXT) lib_a-gethstbynm.$(OBJEXT) \
- lib_a-gethstbynm_r.$(OBJEXT) lib_a-gethstent.$(OBJEXT) \
- lib_a-gethstent_r.$(OBJEXT) lib_a-getnameinfo.$(OBJEXT) \
- lib_a-getnetbyad.$(OBJEXT) lib_a-getnetbyad_r.$(OBJEXT) \
- lib_a-getnetbynm.$(OBJEXT) lib_a-getnetbynm_r.$(OBJEXT) \
- lib_a-getnetent.$(OBJEXT) lib_a-getnetent_r.$(OBJEXT) \
- lib_a-getnetgrent.$(OBJEXT) lib_a-getnetgrent_r.$(OBJEXT) \
- lib_a-getnssent.$(OBJEXT) lib_a-getnssent_r.$(OBJEXT) \
- lib_a-getproto.$(OBJEXT) lib_a-getproto_r.$(OBJEXT) \
- lib_a-getprtent.$(OBJEXT) lib_a-getprtent_r.$(OBJEXT) \
- lib_a-getprtname.$(OBJEXT) lib_a-getprtname_r.$(OBJEXT) \
- lib_a-getrpcbyname.$(OBJEXT) lib_a-getrpcbyname_r.$(OBJEXT) \
- lib_a-getrpcbynumber.$(OBJEXT) \
- lib_a-getrpcbynumber_r.$(OBJEXT) lib_a-getrpcent.$(OBJEXT) \
- lib_a-getrpcent_r.$(OBJEXT) lib_a-getservent.$(OBJEXT) \
- lib_a-getservent_r.$(OBJEXT) lib_a-getsrvbynm.$(OBJEXT) \
- lib_a-getsrvbynm_r.$(OBJEXT) lib_a-getsrvbypt.$(OBJEXT) \
- lib_a-getsrvbypt_r.$(OBJEXT) lib_a-grp-lookup.$(OBJEXT) \
- lib_a-herrno.$(OBJEXT) lib_a-hosts-lookup.$(OBJEXT) \
- lib_a-ifreq.$(OBJEXT) lib_a-in6_addr.$(OBJEXT) \
- lib_a-inet6_option.$(OBJEXT) lib_a-inet_addr.$(OBJEXT) \
- lib_a-inet_lnaof.$(OBJEXT) lib_a-inet_mkadr.$(OBJEXT) \
- lib_a-inet_net.$(OBJEXT) lib_a-inet_neta.$(OBJEXT) \
- lib_a-inet_netof.$(OBJEXT) lib_a-inet_net_ntop.$(OBJEXT) \
- lib_a-inet_net_pton.$(OBJEXT) lib_a-inet_ntoa.$(OBJEXT) \
+ lib_a-base64.$(OBJEXT) lib_a-bindresvport.$(OBJEXT) \
+ lib_a-ether_addr.$(OBJEXT) lib_a-getaddrinfo.$(OBJEXT) \
+ lib_a-gethostbydns.$(OBJEXT) lib_a-gethostbyht.$(OBJEXT) \
+ lib_a-gethostbynis.$(OBJEXT) lib_a-gethostnamadr.$(OBJEXT) \
+ lib_a-getifaddrs.$(OBJEXT) lib_a-getnameinfo.$(OBJEXT) \
+ lib_a-getnetbydns.$(OBJEXT) lib_a-getnetbyht.$(OBJEXT) \
+ lib_a-getnetbynis.$(OBJEXT) lib_a-getnetnamadr.$(OBJEXT) \
+ lib_a-getproto.$(OBJEXT) lib_a-getprotoent.$(OBJEXT) \
+ lib_a-getprotoname.$(OBJEXT) lib_a-getservbyname.$(OBJEXT) \
+ lib_a-getservbyport.$(OBJEXT) lib_a-getservent.$(OBJEXT) \
+ lib_a-herror.$(OBJEXT) lib_a-hesiod.$(OBJEXT) \
+ lib_a-inet_addr.$(OBJEXT) lib_a-ifname.$(OBJEXT) \
+ lib_a-inet_lnaof.$(OBJEXT) lib_a-inet_makeaddr.$(OBJEXT) \
+ lib_a-inet_net_ntop.$(OBJEXT) lib_a-inet_net_pton.$(OBJEXT) \
+ lib_a-inet_neta.$(OBJEXT) lib_a-inet_netof.$(OBJEXT) \
+ lib_a-inet_network.$(OBJEXT) lib_a-inet_ntoa.$(OBJEXT) \
lib_a-inet_ntop.$(OBJEXT) lib_a-inet_pton.$(OBJEXT) \
- lib_a-issetugid-stub.$(OBJEXT) lib_a-key-lookup.$(OBJEXT) \
- lib_a-netgrp-lookup.$(OBJEXT) lib_a-network-lookup.$(OBJEXT) \
- lib_a-nsswitch.$(OBJEXT) lib_a-ns_name.$(OBJEXT) \
- lib_a-ns_netint.$(OBJEXT) lib_a-ns_parse.$(OBJEXT) \
- lib_a-ns_print.$(OBJEXT) lib_a-ns_samedomain.$(OBJEXT) \
- lib_a-ns_ttl.$(OBJEXT) lib_a-nsap_addr.$(OBJEXT) \
- lib_a-proto-lookup.$(OBJEXT) lib_a-opensock.$(OBJEXT) \
- lib_a-pwd-lookup.$(OBJEXT) lib_a-recv.$(OBJEXT) \
- lib_a-res_comp.$(OBJEXT) lib_a-res_data.$(OBJEXT) \
- lib_a-res_debug.$(OBJEXT) lib_a-res_hconf.$(OBJEXT) \
- lib_a-res_init.$(OBJEXT) lib_a-res_libc.$(OBJEXT) \
- lib_a-res_mkquery.$(OBJEXT) lib_a-res_query.$(OBJEXT) \
- lib_a-res_send.$(OBJEXT) lib_a-rexec.$(OBJEXT) \
- lib_a-rpc-lookup.$(OBJEXT) lib_a-ruserpass.$(OBJEXT) \
- lib_a-send.$(OBJEXT) lib_a-service-lookup.$(OBJEXT) \
- lib_a-spwd-lookup.$(OBJEXT)
-am__objects_2 = lib_a-ifname.$(OBJEXT)
+ lib_a-innetgr-stub.$(OBJEXT) lib_a-ip6opt.$(OBJEXT) \
+ lib_a-issetugid-stub.$(OBJEXT) lib_a-linkaddr.$(OBJEXT) \
+ lib_a-map_v4v6.$(OBJEXT) lib_a-name6.$(OBJEXT) \
+ lib_a-ns_addr.$(OBJEXT) lib_a-ns_name.$(OBJEXT) \
+ lib_a-ns_netint.$(OBJEXT) lib_a-ns_ntoa.$(OBJEXT) \
+ lib_a-ns_parse.$(OBJEXT) lib_a-ns_print.$(OBJEXT) \
+ lib_a-ns_ttl.$(OBJEXT) lib_a-nsdispatch.$(OBJEXT) \
+ lib_a-nslexer.$(OBJEXT) lib_a-nsparser.$(OBJEXT) \
+ lib_a-nsap_addr.$(OBJEXT) lib_a-res_comp.$(OBJEXT) \
+ lib_a-res_data.$(OBJEXT) lib_a-res_debug.$(OBJEXT) \
+ lib_a-res_init.$(OBJEXT) lib_a-res_mkquery.$(OBJEXT) \
+ lib_a-res_mkupdate.$(OBJEXT) lib_a-res_query.$(OBJEXT) \
+ lib_a-res_send.$(OBJEXT) lib_a-res_update.$(OBJEXT) \
+ lib_a-rthdr.$(OBJEXT) lib_a-vars.$(OBJEXT)
+am__objects_2 =
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_3 = $(am__objects_2)
@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
@USE_LIBTOOL_FALSE@ $(am__objects_3)
@@ -116,61 +95,38 @@ lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libnet_la_LIBADD =
am__objects_4 = libnet_la-addr2ascii.lo libnet_la-ascii2addr.lo \
- libnet_la-alias-lookup.lo libnet_la-base64.lo \
- libnet_la-check_pf.lo libnet_la-digits_dots.lo \
- libnet_la-ether_aton.lo libnet_la-ether_aton_r.lo \
- libnet_la-ether_hton.lo libnet_la-ether_line.lo \
- libnet_la-ether_ntoa.lo libnet_la-ether_ntoa_r.lo \
- libnet_la-ether_ntoh.lo libnet_la-ethers-lookup.lo \
- libnet_la-getaddrinfo.lo libnet_la-getaliasent.lo \
- libnet_la-getaliasent_r.lo libnet_la-getaliasname.lo \
- libnet_la-getaliasname_r.lo libnet_la-gethstbyad.lo \
- libnet_la-gethstbyad_r.lo libnet_la-gethstbynm2.lo \
- libnet_la-gethstbynm2_r.lo libnet_la-gethstbynm.lo \
- libnet_la-gethstbynm_r.lo libnet_la-gethstent.lo \
- libnet_la-gethstent_r.lo libnet_la-getnameinfo.lo \
- libnet_la-getnetbyad.lo libnet_la-getnetbyad_r.lo \
- libnet_la-getnetbynm.lo libnet_la-getnetbynm_r.lo \
- libnet_la-getnetent.lo libnet_la-getnetent_r.lo \
- libnet_la-getnetgrent.lo libnet_la-getnetgrent_r.lo \
- libnet_la-getnssent.lo libnet_la-getnssent_r.lo \
- libnet_la-getproto.lo libnet_la-getproto_r.lo \
- libnet_la-getprtent.lo libnet_la-getprtent_r.lo \
- libnet_la-getprtname.lo libnet_la-getprtname_r.lo \
- libnet_la-getrpcbyname.lo libnet_la-getrpcbyname_r.lo \
- libnet_la-getrpcbynumber.lo libnet_la-getrpcbynumber_r.lo \
- libnet_la-getrpcent.lo libnet_la-getrpcent_r.lo \
- libnet_la-getservent.lo libnet_la-getservent_r.lo \
- libnet_la-getsrvbynm.lo libnet_la-getsrvbynm_r.lo \
- libnet_la-getsrvbypt.lo libnet_la-getsrvbypt_r.lo \
- libnet_la-grp-lookup.lo libnet_la-herrno.lo \
- libnet_la-hosts-lookup.lo libnet_la-ifreq.lo \
- libnet_la-in6_addr.lo libnet_la-inet6_option.lo \
- libnet_la-inet_addr.lo libnet_la-inet_lnaof.lo \
- libnet_la-inet_mkadr.lo libnet_la-inet_net.lo \
- libnet_la-inet_neta.lo libnet_la-inet_netof.lo \
- libnet_la-inet_net_ntop.lo libnet_la-inet_net_pton.lo \
+ libnet_la-base64.lo libnet_la-bindresvport.lo \
+ libnet_la-ether_addr.lo libnet_la-getaddrinfo.lo \
+ libnet_la-gethostbydns.lo libnet_la-gethostbyht.lo \
+ libnet_la-gethostbynis.lo libnet_la-gethostnamadr.lo \
+ libnet_la-getifaddrs.lo libnet_la-getnameinfo.lo \
+ libnet_la-getnetbydns.lo libnet_la-getnetbyht.lo \
+ libnet_la-getnetbynis.lo libnet_la-getnetnamadr.lo \
+ libnet_la-getproto.lo libnet_la-getprotoent.lo \
+ libnet_la-getprotoname.lo libnet_la-getservbyname.lo \
+ libnet_la-getservbyport.lo libnet_la-getservent.lo \
+ libnet_la-herror.lo libnet_la-hesiod.lo libnet_la-inet_addr.lo \
+ libnet_la-ifname.lo libnet_la-inet_lnaof.lo \
+ libnet_la-inet_makeaddr.lo libnet_la-inet_net_ntop.lo \
+ libnet_la-inet_net_pton.lo libnet_la-inet_neta.lo \
+ libnet_la-inet_netof.lo libnet_la-inet_network.lo \
libnet_la-inet_ntoa.lo libnet_la-inet_ntop.lo \
- libnet_la-inet_pton.lo libnet_la-issetugid-stub.lo \
- libnet_la-key-lookup.lo libnet_la-netgrp-lookup.lo \
- libnet_la-network-lookup.lo libnet_la-nsswitch.lo \
- libnet_la-ns_name.lo libnet_la-ns_netint.lo \
+ libnet_la-inet_pton.lo libnet_la-innetgr-stub.lo \
+ libnet_la-ip6opt.lo libnet_la-issetugid-stub.lo \
+ libnet_la-linkaddr.lo libnet_la-map_v4v6.lo libnet_la-name6.lo \
+ libnet_la-ns_addr.lo libnet_la-ns_name.lo \
+ libnet_la-ns_netint.lo libnet_la-ns_ntoa.lo \
libnet_la-ns_parse.lo libnet_la-ns_print.lo \
- libnet_la-ns_samedomain.lo libnet_la-ns_ttl.lo \
- libnet_la-nsap_addr.lo libnet_la-proto-lookup.lo \
- libnet_la-opensock.lo libnet_la-pwd-lookup.lo \
- libnet_la-recv.lo libnet_la-res_comp.lo libnet_la-res_data.lo \
- libnet_la-res_debug.lo libnet_la-res_hconf.lo \
- libnet_la-res_init.lo libnet_la-res_libc.lo \
- libnet_la-res_mkquery.lo libnet_la-res_query.lo \
- libnet_la-res_send.lo libnet_la-rexec.lo \
- libnet_la-rpc-lookup.lo libnet_la-ruserpass.lo \
- libnet_la-send.lo libnet_la-service-lookup.lo \
- libnet_la-spwd-lookup.lo
-am__objects_5 = libnet_la-ifname.lo
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_6 = $(am__objects_5)
+ libnet_la-ns_ttl.lo libnet_la-nsdispatch.lo \
+ libnet_la-nslexer.lo libnet_la-nsparser.lo \
+ libnet_la-nsap_addr.lo libnet_la-res_comp.lo \
+ libnet_la-res_data.lo libnet_la-res_debug.lo \
+ libnet_la-res_init.lo libnet_la-res_mkquery.lo \
+ libnet_la-res_mkupdate.lo libnet_la-res_query.lo \
+ libnet_la-res_send.lo libnet_la-res_update.lo \
+ libnet_la-rthdr.lo libnet_la-vars.lo
@USE_LIBTOOL_TRUE@am_libnet_la_OBJECTS = $(am__objects_4) \
-@USE_LIBTOOL_TRUE@ $(am__objects_6)
+@USE_LIBTOOL_TRUE@ $(am__objects_3)
libnet_la_OBJECTS = $(am_libnet_la_OBJECTS)
@USE_LIBTOOL_TRUE@am_libnet_la_rpath =
DEFAULT_INCLUDES = -I. -I$(srcdir)
@@ -321,37 +277,27 @@ sys_dir = @sys_dir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
AUTOMAKE_OPTIONS = cygnus
-INCLUDES = -I$(srcdir)/../include -I$(srcdir)/.. $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
-GENERAL_SOURCES = addr2ascii.c ascii2addr.c alias-lookup.c \
- base64.c check_pf.c digits_dots.c \
- ether_aton.c ether_aton_r.c ether_hton.c \
- ether_line.c ether_ntoa.c ether_ntoa_r.c ether_ntoh.c \
- ethers-lookup.c getaddrinfo.c getaliasent.c \
- getaliasent_r.c getaliasname.c getaliasname_r.c gethstbyad.c \
- gethstbyad_r.c gethstbynm2.c gethstbynm2_r.c gethstbynm.c \
- gethstbynm_r.c gethstent.c gethstent_r.c getnameinfo.c getnetbyad.c \
- getnetbyad_r.c getnetbynm.c getnetbynm_r.c getnetent.c getnetent_r.c \
- getnetgrent.c getnetgrent_r.c getnssent.c getnssent_r.c getproto.c \
- getproto_r.c getprtent.c \
- getprtent_r.c getprtname.c getprtname_r.c getrpcbyname.c \
- getrpcbyname_r.c getrpcbynumber.c getrpcbynumber_r.c getrpcent.c \
- getrpcent_r.c getservent.c getservent_r.c getsrvbynm.c getsrvbynm_r.c \
- getsrvbypt.c getsrvbypt_r.c grp-lookup.c \
- herrno.c hosts-lookup.c ifreq.c \
- in6_addr.c inet6_option.c inet_addr.c \
- inet_lnaof.c inet_mkadr.c inet_net.c inet_neta.c inet_netof.c \
- inet_net_ntop.c inet_net_pton.c inet_ntoa.c inet_ntop.c \
- inet_pton.c issetugid-stub.c key-lookup.c netgrp-lookup.c \
- network-lookup.c nsswitch.c \
- ns_name.c ns_netint.c ns_parse.c ns_print.c ns_samedomain.c \
- ns_ttl.c nsap_addr.c proto-lookup.c opensock.c pwd-lookup.c recv.c \
- res_comp.c res_data.c res_debug.c res_hconf.c res_init.c \
- res_libc.c res_mkquery.c \
- res_query.c res_send.c \
- rexec.c rpc-lookup.c ruserpass.c send.c service-lookup.c spwd-lookup.c
+INCLUDES = -I$(srcdir)/../include $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+GENERAL_SOURCES = addr2ascii.c ascii2addr.c base64.c bindresvport.c ether_addr.c getaddrinfo.c \
+ gethostbydns.c gethostbyht.c gethostbynis.c gethostnamadr.c \
+ getifaddrs.c getnameinfo.c \
+ getnetbydns.c getnetbyht.c getnetbynis.c getnetnamadr.c \
+ getproto.c getprotoent.c getprotoname.c getservbyname.c \
+ getservbyport.c getservent.c herror.c hesiod.c inet_addr.c \
+ ifname.c inet_lnaof.c \
+ inet_makeaddr.c inet_net_ntop.c inet_net_pton.c inet_neta.c \
+ inet_netof.c inet_network.c inet_ntoa.c inet_ntop.c \
+ inet_pton.c innetgr-stub.c ip6opt.c issetugid-stub.c \
+ linkaddr.c map_v4v6.c namespace.h un-namespace.h \
+ name6.c ns_addr.c \
+ ns_name.c ns_netint.c \
+ ns_ntoa.c ns_parse.c ns_print.c ns_ttl.c \
+ nsdispatch.c nslexer.c nsparser.c nsparser.h \
+ nsap_addr.c res_comp.c res_data.c res_debug.c \
+ res_init.c res_mkquery.c res_mkupdate.c res_query.c \
+ res_send.c res_update.c rthdr.c vars.c
ELIX_4_SOURCES = \
- ifname.c \
rcmd.$(oext) \
rcmdsh.$(oext)
@@ -447,77 +393,23 @@ lib_a-ascii2addr.o: ascii2addr.c
lib_a-ascii2addr.obj: ascii2addr.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ascii2addr.obj `if test -f 'ascii2addr.c'; then $(CYGPATH_W) 'ascii2addr.c'; else $(CYGPATH_W) '$(srcdir)/ascii2addr.c'; fi`
-lib_a-alias-lookup.o: alias-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-alias-lookup.o `test -f 'alias-lookup.c' || echo '$(srcdir)/'`alias-lookup.c
-
-lib_a-alias-lookup.obj: alias-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-alias-lookup.obj `if test -f 'alias-lookup.c'; then $(CYGPATH_W) 'alias-lookup.c'; else $(CYGPATH_W) '$(srcdir)/alias-lookup.c'; fi`
-
lib_a-base64.o: base64.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-base64.o `test -f 'base64.c' || echo '$(srcdir)/'`base64.c
lib_a-base64.obj: base64.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-base64.obj `if test -f 'base64.c'; then $(CYGPATH_W) 'base64.c'; else $(CYGPATH_W) '$(srcdir)/base64.c'; fi`
-lib_a-check_pf.o: check_pf.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-check_pf.o `test -f 'check_pf.c' || echo '$(srcdir)/'`check_pf.c
-
-lib_a-check_pf.obj: check_pf.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-check_pf.obj `if test -f 'check_pf.c'; then $(CYGPATH_W) 'check_pf.c'; else $(CYGPATH_W) '$(srcdir)/check_pf.c'; fi`
-
-lib_a-digits_dots.o: digits_dots.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-digits_dots.o `test -f 'digits_dots.c' || echo '$(srcdir)/'`digits_dots.c
-
-lib_a-digits_dots.obj: digits_dots.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-digits_dots.obj `if test -f 'digits_dots.c'; then $(CYGPATH_W) 'digits_dots.c'; else $(CYGPATH_W) '$(srcdir)/digits_dots.c'; fi`
-
-lib_a-ether_aton.o: ether_aton.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton.o `test -f 'ether_aton.c' || echo '$(srcdir)/'`ether_aton.c
-
-lib_a-ether_aton.obj: ether_aton.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton.obj `if test -f 'ether_aton.c'; then $(CYGPATH_W) 'ether_aton.c'; else $(CYGPATH_W) '$(srcdir)/ether_aton.c'; fi`
-
-lib_a-ether_aton_r.o: ether_aton_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton_r.o `test -f 'ether_aton_r.c' || echo '$(srcdir)/'`ether_aton_r.c
-
-lib_a-ether_aton_r.obj: ether_aton_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_aton_r.obj `if test -f 'ether_aton_r.c'; then $(CYGPATH_W) 'ether_aton_r.c'; else $(CYGPATH_W) '$(srcdir)/ether_aton_r.c'; fi`
-
-lib_a-ether_hton.o: ether_hton.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_hton.o `test -f 'ether_hton.c' || echo '$(srcdir)/'`ether_hton.c
-
-lib_a-ether_hton.obj: ether_hton.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_hton.obj `if test -f 'ether_hton.c'; then $(CYGPATH_W) 'ether_hton.c'; else $(CYGPATH_W) '$(srcdir)/ether_hton.c'; fi`
-
-lib_a-ether_line.o: ether_line.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_line.o `test -f 'ether_line.c' || echo '$(srcdir)/'`ether_line.c
-
-lib_a-ether_line.obj: ether_line.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_line.obj `if test -f 'ether_line.c'; then $(CYGPATH_W) 'ether_line.c'; else $(CYGPATH_W) '$(srcdir)/ether_line.c'; fi`
+lib_a-bindresvport.o: bindresvport.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-bindresvport.o `test -f 'bindresvport.c' || echo '$(srcdir)/'`bindresvport.c
-lib_a-ether_ntoa.o: ether_ntoa.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa.o `test -f 'ether_ntoa.c' || echo '$(srcdir)/'`ether_ntoa.c
+lib_a-bindresvport.obj: bindresvport.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-bindresvport.obj `if test -f 'bindresvport.c'; then $(CYGPATH_W) 'bindresvport.c'; else $(CYGPATH_W) '$(srcdir)/bindresvport.c'; fi`
-lib_a-ether_ntoa.obj: ether_ntoa.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa.obj `if test -f 'ether_ntoa.c'; then $(CYGPATH_W) 'ether_ntoa.c'; else $(CYGPATH_W) '$(srcdir)/ether_ntoa.c'; fi`
+lib_a-ether_addr.o: ether_addr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_addr.o `test -f 'ether_addr.c' || echo '$(srcdir)/'`ether_addr.c
-lib_a-ether_ntoa_r.o: ether_ntoa_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa_r.o `test -f 'ether_ntoa_r.c' || echo '$(srcdir)/'`ether_ntoa_r.c
-
-lib_a-ether_ntoa_r.obj: ether_ntoa_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoa_r.obj `if test -f 'ether_ntoa_r.c'; then $(CYGPATH_W) 'ether_ntoa_r.c'; else $(CYGPATH_W) '$(srcdir)/ether_ntoa_r.c'; fi`
-
-lib_a-ether_ntoh.o: ether_ntoh.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoh.o `test -f 'ether_ntoh.c' || echo '$(srcdir)/'`ether_ntoh.c
-
-lib_a-ether_ntoh.obj: ether_ntoh.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_ntoh.obj `if test -f 'ether_ntoh.c'; then $(CYGPATH_W) 'ether_ntoh.c'; else $(CYGPATH_W) '$(srcdir)/ether_ntoh.c'; fi`
-
-lib_a-ethers-lookup.o: ethers-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ethers-lookup.o `test -f 'ethers-lookup.c' || echo '$(srcdir)/'`ethers-lookup.c
-
-lib_a-ethers-lookup.obj: ethers-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ethers-lookup.obj `if test -f 'ethers-lookup.c'; then $(CYGPATH_W) 'ethers-lookup.c'; else $(CYGPATH_W) '$(srcdir)/ethers-lookup.c'; fi`
+lib_a-ether_addr.obj: ether_addr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ether_addr.obj `if test -f 'ether_addr.c'; then $(CYGPATH_W) 'ether_addr.c'; else $(CYGPATH_W) '$(srcdir)/ether_addr.c'; fi`
lib_a-getaddrinfo.o: getaddrinfo.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaddrinfo.o `test -f 'getaddrinfo.c' || echo '$(srcdir)/'`getaddrinfo.c
@@ -525,77 +417,35 @@ lib_a-getaddrinfo.o: getaddrinfo.c
lib_a-getaddrinfo.obj: getaddrinfo.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaddrinfo.obj `if test -f 'getaddrinfo.c'; then $(CYGPATH_W) 'getaddrinfo.c'; else $(CYGPATH_W) '$(srcdir)/getaddrinfo.c'; fi`
-lib_a-getaliasent.o: getaliasent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent.o `test -f 'getaliasent.c' || echo '$(srcdir)/'`getaliasent.c
-
-lib_a-getaliasent.obj: getaliasent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent.obj `if test -f 'getaliasent.c'; then $(CYGPATH_W) 'getaliasent.c'; else $(CYGPATH_W) '$(srcdir)/getaliasent.c'; fi`
-
-lib_a-getaliasent_r.o: getaliasent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent_r.o `test -f 'getaliasent_r.c' || echo '$(srcdir)/'`getaliasent_r.c
-
-lib_a-getaliasent_r.obj: getaliasent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasent_r.obj `if test -f 'getaliasent_r.c'; then $(CYGPATH_W) 'getaliasent_r.c'; else $(CYGPATH_W) '$(srcdir)/getaliasent_r.c'; fi`
-
-lib_a-getaliasname.o: getaliasname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname.o `test -f 'getaliasname.c' || echo '$(srcdir)/'`getaliasname.c
-
-lib_a-getaliasname.obj: getaliasname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname.obj `if test -f 'getaliasname.c'; then $(CYGPATH_W) 'getaliasname.c'; else $(CYGPATH_W) '$(srcdir)/getaliasname.c'; fi`
-
-lib_a-getaliasname_r.o: getaliasname_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname_r.o `test -f 'getaliasname_r.c' || echo '$(srcdir)/'`getaliasname_r.c
-
-lib_a-getaliasname_r.obj: getaliasname_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getaliasname_r.obj `if test -f 'getaliasname_r.c'; then $(CYGPATH_W) 'getaliasname_r.c'; else $(CYGPATH_W) '$(srcdir)/getaliasname_r.c'; fi`
-
-lib_a-gethstbyad.o: gethstbyad.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad.o `test -f 'gethstbyad.c' || echo '$(srcdir)/'`gethstbyad.c
+lib_a-gethostbydns.o: gethostbydns.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostbydns.o `test -f 'gethostbydns.c' || echo '$(srcdir)/'`gethostbydns.c
-lib_a-gethstbyad.obj: gethstbyad.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad.obj `if test -f 'gethstbyad.c'; then $(CYGPATH_W) 'gethstbyad.c'; else $(CYGPATH_W) '$(srcdir)/gethstbyad.c'; fi`
+lib_a-gethostbydns.obj: gethostbydns.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostbydns.obj `if test -f 'gethostbydns.c'; then $(CYGPATH_W) 'gethostbydns.c'; else $(CYGPATH_W) '$(srcdir)/gethostbydns.c'; fi`
-lib_a-gethstbyad_r.o: gethstbyad_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad_r.o `test -f 'gethstbyad_r.c' || echo '$(srcdir)/'`gethstbyad_r.c
+lib_a-gethostbyht.o: gethostbyht.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostbyht.o `test -f 'gethostbyht.c' || echo '$(srcdir)/'`gethostbyht.c
-lib_a-gethstbyad_r.obj: gethstbyad_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbyad_r.obj `if test -f 'gethstbyad_r.c'; then $(CYGPATH_W) 'gethstbyad_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstbyad_r.c'; fi`
+lib_a-gethostbyht.obj: gethostbyht.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostbyht.obj `if test -f 'gethostbyht.c'; then $(CYGPATH_W) 'gethostbyht.c'; else $(CYGPATH_W) '$(srcdir)/gethostbyht.c'; fi`
-lib_a-gethstbynm2.o: gethstbynm2.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2.o `test -f 'gethstbynm2.c' || echo '$(srcdir)/'`gethstbynm2.c
+lib_a-gethostbynis.o: gethostbynis.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostbynis.o `test -f 'gethostbynis.c' || echo '$(srcdir)/'`gethostbynis.c
-lib_a-gethstbynm2.obj: gethstbynm2.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2.obj `if test -f 'gethstbynm2.c'; then $(CYGPATH_W) 'gethstbynm2.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm2.c'; fi`
+lib_a-gethostbynis.obj: gethostbynis.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostbynis.obj `if test -f 'gethostbynis.c'; then $(CYGPATH_W) 'gethostbynis.c'; else $(CYGPATH_W) '$(srcdir)/gethostbynis.c'; fi`
-lib_a-gethstbynm2_r.o: gethstbynm2_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2_r.o `test -f 'gethstbynm2_r.c' || echo '$(srcdir)/'`gethstbynm2_r.c
+lib_a-gethostnamadr.o: gethostnamadr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostnamadr.o `test -f 'gethostnamadr.c' || echo '$(srcdir)/'`gethostnamadr.c
-lib_a-gethstbynm2_r.obj: gethstbynm2_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm2_r.obj `if test -f 'gethstbynm2_r.c'; then $(CYGPATH_W) 'gethstbynm2_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm2_r.c'; fi`
+lib_a-gethostnamadr.obj: gethostnamadr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethostnamadr.obj `if test -f 'gethostnamadr.c'; then $(CYGPATH_W) 'gethostnamadr.c'; else $(CYGPATH_W) '$(srcdir)/gethostnamadr.c'; fi`
-lib_a-gethstbynm.o: gethstbynm.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm.o `test -f 'gethstbynm.c' || echo '$(srcdir)/'`gethstbynm.c
+lib_a-getifaddrs.o: getifaddrs.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getifaddrs.o `test -f 'getifaddrs.c' || echo '$(srcdir)/'`getifaddrs.c
-lib_a-gethstbynm.obj: gethstbynm.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm.obj `if test -f 'gethstbynm.c'; then $(CYGPATH_W) 'gethstbynm.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm.c'; fi`
-
-lib_a-gethstbynm_r.o: gethstbynm_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm_r.o `test -f 'gethstbynm_r.c' || echo '$(srcdir)/'`gethstbynm_r.c
-
-lib_a-gethstbynm_r.obj: gethstbynm_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstbynm_r.obj `if test -f 'gethstbynm_r.c'; then $(CYGPATH_W) 'gethstbynm_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstbynm_r.c'; fi`
-
-lib_a-gethstent.o: gethstent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent.o `test -f 'gethstent.c' || echo '$(srcdir)/'`gethstent.c
-
-lib_a-gethstent.obj: gethstent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent.obj `if test -f 'gethstent.c'; then $(CYGPATH_W) 'gethstent.c'; else $(CYGPATH_W) '$(srcdir)/gethstent.c'; fi`
-
-lib_a-gethstent_r.o: gethstent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent_r.o `test -f 'gethstent_r.c' || echo '$(srcdir)/'`gethstent_r.c
-
-lib_a-gethstent_r.obj: gethstent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gethstent_r.obj `if test -f 'gethstent_r.c'; then $(CYGPATH_W) 'gethstent_r.c'; else $(CYGPATH_W) '$(srcdir)/gethstent_r.c'; fi`
+lib_a-getifaddrs.obj: getifaddrs.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getifaddrs.obj `if test -f 'getifaddrs.c'; then $(CYGPATH_W) 'getifaddrs.c'; else $(CYGPATH_W) '$(srcdir)/getifaddrs.c'; fi`
lib_a-getnameinfo.o: getnameinfo.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnameinfo.o `test -f 'getnameinfo.c' || echo '$(srcdir)/'`getnameinfo.c
@@ -603,65 +453,29 @@ lib_a-getnameinfo.o: getnameinfo.c
lib_a-getnameinfo.obj: getnameinfo.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnameinfo.obj `if test -f 'getnameinfo.c'; then $(CYGPATH_W) 'getnameinfo.c'; else $(CYGPATH_W) '$(srcdir)/getnameinfo.c'; fi`
-lib_a-getnetbyad.o: getnetbyad.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad.o `test -f 'getnetbyad.c' || echo '$(srcdir)/'`getnetbyad.c
-
-lib_a-getnetbyad.obj: getnetbyad.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad.obj `if test -f 'getnetbyad.c'; then $(CYGPATH_W) 'getnetbyad.c'; else $(CYGPATH_W) '$(srcdir)/getnetbyad.c'; fi`
-
-lib_a-getnetbyad_r.o: getnetbyad_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad_r.o `test -f 'getnetbyad_r.c' || echo '$(srcdir)/'`getnetbyad_r.c
-
-lib_a-getnetbyad_r.obj: getnetbyad_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyad_r.obj `if test -f 'getnetbyad_r.c'; then $(CYGPATH_W) 'getnetbyad_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetbyad_r.c'; fi`
-
-lib_a-getnetbynm.o: getnetbynm.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm.o `test -f 'getnetbynm.c' || echo '$(srcdir)/'`getnetbynm.c
-
-lib_a-getnetbynm.obj: getnetbynm.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm.obj `if test -f 'getnetbynm.c'; then $(CYGPATH_W) 'getnetbynm.c'; else $(CYGPATH_W) '$(srcdir)/getnetbynm.c'; fi`
-
-lib_a-getnetbynm_r.o: getnetbynm_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm_r.o `test -f 'getnetbynm_r.c' || echo '$(srcdir)/'`getnetbynm_r.c
-
-lib_a-getnetbynm_r.obj: getnetbynm_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynm_r.obj `if test -f 'getnetbynm_r.c'; then $(CYGPATH_W) 'getnetbynm_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetbynm_r.c'; fi`
+lib_a-getnetbydns.o: getnetbydns.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbydns.o `test -f 'getnetbydns.c' || echo '$(srcdir)/'`getnetbydns.c
-lib_a-getnetent.o: getnetent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent.o `test -f 'getnetent.c' || echo '$(srcdir)/'`getnetent.c
+lib_a-getnetbydns.obj: getnetbydns.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbydns.obj `if test -f 'getnetbydns.c'; then $(CYGPATH_W) 'getnetbydns.c'; else $(CYGPATH_W) '$(srcdir)/getnetbydns.c'; fi`
-lib_a-getnetent.obj: getnetent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent.obj `if test -f 'getnetent.c'; then $(CYGPATH_W) 'getnetent.c'; else $(CYGPATH_W) '$(srcdir)/getnetent.c'; fi`
+lib_a-getnetbyht.o: getnetbyht.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyht.o `test -f 'getnetbyht.c' || echo '$(srcdir)/'`getnetbyht.c
-lib_a-getnetent_r.o: getnetent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent_r.o `test -f 'getnetent_r.c' || echo '$(srcdir)/'`getnetent_r.c
+lib_a-getnetbyht.obj: getnetbyht.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbyht.obj `if test -f 'getnetbyht.c'; then $(CYGPATH_W) 'getnetbyht.c'; else $(CYGPATH_W) '$(srcdir)/getnetbyht.c'; fi`
-lib_a-getnetent_r.obj: getnetent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetent_r.obj `if test -f 'getnetent_r.c'; then $(CYGPATH_W) 'getnetent_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetent_r.c'; fi`
+lib_a-getnetbynis.o: getnetbynis.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynis.o `test -f 'getnetbynis.c' || echo '$(srcdir)/'`getnetbynis.c
-lib_a-getnetgrent.o: getnetgrent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent.o `test -f 'getnetgrent.c' || echo '$(srcdir)/'`getnetgrent.c
+lib_a-getnetbynis.obj: getnetbynis.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetbynis.obj `if test -f 'getnetbynis.c'; then $(CYGPATH_W) 'getnetbynis.c'; else $(CYGPATH_W) '$(srcdir)/getnetbynis.c'; fi`
-lib_a-getnetgrent.obj: getnetgrent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent.obj `if test -f 'getnetgrent.c'; then $(CYGPATH_W) 'getnetgrent.c'; else $(CYGPATH_W) '$(srcdir)/getnetgrent.c'; fi`
+lib_a-getnetnamadr.o: getnetnamadr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetnamadr.o `test -f 'getnetnamadr.c' || echo '$(srcdir)/'`getnetnamadr.c
-lib_a-getnetgrent_r.o: getnetgrent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent_r.o `test -f 'getnetgrent_r.c' || echo '$(srcdir)/'`getnetgrent_r.c
-
-lib_a-getnetgrent_r.obj: getnetgrent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetgrent_r.obj `if test -f 'getnetgrent_r.c'; then $(CYGPATH_W) 'getnetgrent_r.c'; else $(CYGPATH_W) '$(srcdir)/getnetgrent_r.c'; fi`
-
-lib_a-getnssent.o: getnssent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent.o `test -f 'getnssent.c' || echo '$(srcdir)/'`getnssent.c
-
-lib_a-getnssent.obj: getnssent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent.obj `if test -f 'getnssent.c'; then $(CYGPATH_W) 'getnssent.c'; else $(CYGPATH_W) '$(srcdir)/getnssent.c'; fi`
-
-lib_a-getnssent_r.o: getnssent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent_r.o `test -f 'getnssent_r.c' || echo '$(srcdir)/'`getnssent_r.c
-
-lib_a-getnssent_r.obj: getnssent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnssent_r.obj `if test -f 'getnssent_r.c'; then $(CYGPATH_W) 'getnssent_r.c'; else $(CYGPATH_W) '$(srcdir)/getnssent_r.c'; fi`
+lib_a-getnetnamadr.obj: getnetnamadr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getnetnamadr.obj `if test -f 'getnetnamadr.c'; then $(CYGPATH_W) 'getnetnamadr.c'; else $(CYGPATH_W) '$(srcdir)/getnetnamadr.c'; fi`
lib_a-getproto.o: getproto.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto.o `test -f 'getproto.c' || echo '$(srcdir)/'`getproto.c
@@ -669,71 +483,29 @@ lib_a-getproto.o: getproto.c
lib_a-getproto.obj: getproto.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto.obj `if test -f 'getproto.c'; then $(CYGPATH_W) 'getproto.c'; else $(CYGPATH_W) '$(srcdir)/getproto.c'; fi`
-lib_a-getproto_r.o: getproto_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto_r.o `test -f 'getproto_r.c' || echo '$(srcdir)/'`getproto_r.c
-
-lib_a-getproto_r.obj: getproto_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getproto_r.obj `if test -f 'getproto_r.c'; then $(CYGPATH_W) 'getproto_r.c'; else $(CYGPATH_W) '$(srcdir)/getproto_r.c'; fi`
-
-lib_a-getprtent.o: getprtent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent.o `test -f 'getprtent.c' || echo '$(srcdir)/'`getprtent.c
-
-lib_a-getprtent.obj: getprtent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent.obj `if test -f 'getprtent.c'; then $(CYGPATH_W) 'getprtent.c'; else $(CYGPATH_W) '$(srcdir)/getprtent.c'; fi`
-
-lib_a-getprtent_r.o: getprtent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent_r.o `test -f 'getprtent_r.c' || echo '$(srcdir)/'`getprtent_r.c
-
-lib_a-getprtent_r.obj: getprtent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtent_r.obj `if test -f 'getprtent_r.c'; then $(CYGPATH_W) 'getprtent_r.c'; else $(CYGPATH_W) '$(srcdir)/getprtent_r.c'; fi`
-
-lib_a-getprtname.o: getprtname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname.o `test -f 'getprtname.c' || echo '$(srcdir)/'`getprtname.c
-
-lib_a-getprtname.obj: getprtname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname.obj `if test -f 'getprtname.c'; then $(CYGPATH_W) 'getprtname.c'; else $(CYGPATH_W) '$(srcdir)/getprtname.c'; fi`
-
-lib_a-getprtname_r.o: getprtname_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname_r.o `test -f 'getprtname_r.c' || echo '$(srcdir)/'`getprtname_r.c
+lib_a-getprotoent.o: getprotoent.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprotoent.o `test -f 'getprotoent.c' || echo '$(srcdir)/'`getprotoent.c
-lib_a-getprtname_r.obj: getprtname_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprtname_r.obj `if test -f 'getprtname_r.c'; then $(CYGPATH_W) 'getprtname_r.c'; else $(CYGPATH_W) '$(srcdir)/getprtname_r.c'; fi`
+lib_a-getprotoent.obj: getprotoent.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprotoent.obj `if test -f 'getprotoent.c'; then $(CYGPATH_W) 'getprotoent.c'; else $(CYGPATH_W) '$(srcdir)/getprotoent.c'; fi`
-lib_a-getrpcbyname.o: getrpcbyname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname.o `test -f 'getrpcbyname.c' || echo '$(srcdir)/'`getrpcbyname.c
+lib_a-getprotoname.o: getprotoname.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprotoname.o `test -f 'getprotoname.c' || echo '$(srcdir)/'`getprotoname.c
-lib_a-getrpcbyname.obj: getrpcbyname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname.obj `if test -f 'getrpcbyname.c'; then $(CYGPATH_W) 'getrpcbyname.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbyname.c'; fi`
+lib_a-getprotoname.obj: getprotoname.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getprotoname.obj `if test -f 'getprotoname.c'; then $(CYGPATH_W) 'getprotoname.c'; else $(CYGPATH_W) '$(srcdir)/getprotoname.c'; fi`
-lib_a-getrpcbyname_r.o: getrpcbyname_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname_r.o `test -f 'getrpcbyname_r.c' || echo '$(srcdir)/'`getrpcbyname_r.c
+lib_a-getservbyname.o: getservbyname.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservbyname.o `test -f 'getservbyname.c' || echo '$(srcdir)/'`getservbyname.c
-lib_a-getrpcbyname_r.obj: getrpcbyname_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbyname_r.obj `if test -f 'getrpcbyname_r.c'; then $(CYGPATH_W) 'getrpcbyname_r.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbyname_r.c'; fi`
+lib_a-getservbyname.obj: getservbyname.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservbyname.obj `if test -f 'getservbyname.c'; then $(CYGPATH_W) 'getservbyname.c'; else $(CYGPATH_W) '$(srcdir)/getservbyname.c'; fi`
-lib_a-getrpcbynumber.o: getrpcbynumber.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber.o `test -f 'getrpcbynumber.c' || echo '$(srcdir)/'`getrpcbynumber.c
+lib_a-getservbyport.o: getservbyport.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservbyport.o `test -f 'getservbyport.c' || echo '$(srcdir)/'`getservbyport.c
-lib_a-getrpcbynumber.obj: getrpcbynumber.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber.obj `if test -f 'getrpcbynumber.c'; then $(CYGPATH_W) 'getrpcbynumber.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbynumber.c'; fi`
-
-lib_a-getrpcbynumber_r.o: getrpcbynumber_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber_r.o `test -f 'getrpcbynumber_r.c' || echo '$(srcdir)/'`getrpcbynumber_r.c
-
-lib_a-getrpcbynumber_r.obj: getrpcbynumber_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcbynumber_r.obj `if test -f 'getrpcbynumber_r.c'; then $(CYGPATH_W) 'getrpcbynumber_r.c'; else $(CYGPATH_W) '$(srcdir)/getrpcbynumber_r.c'; fi`
-
-lib_a-getrpcent.o: getrpcent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent.o `test -f 'getrpcent.c' || echo '$(srcdir)/'`getrpcent.c
-
-lib_a-getrpcent.obj: getrpcent.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent.obj `if test -f 'getrpcent.c'; then $(CYGPATH_W) 'getrpcent.c'; else $(CYGPATH_W) '$(srcdir)/getrpcent.c'; fi`
-
-lib_a-getrpcent_r.o: getrpcent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent_r.o `test -f 'getrpcent_r.c' || echo '$(srcdir)/'`getrpcent_r.c
-
-lib_a-getrpcent_r.obj: getrpcent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getrpcent_r.obj `if test -f 'getrpcent_r.c'; then $(CYGPATH_W) 'getrpcent_r.c'; else $(CYGPATH_W) '$(srcdir)/getrpcent_r.c'; fi`
+lib_a-getservbyport.obj: getservbyport.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservbyport.obj `if test -f 'getservbyport.c'; then $(CYGPATH_W) 'getservbyport.c'; else $(CYGPATH_W) '$(srcdir)/getservbyport.c'; fi`
lib_a-getservent.o: getservent.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent.o `test -f 'getservent.c' || echo '$(srcdir)/'`getservent.c
@@ -741,71 +513,17 @@ lib_a-getservent.o: getservent.c
lib_a-getservent.obj: getservent.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent.obj `if test -f 'getservent.c'; then $(CYGPATH_W) 'getservent.c'; else $(CYGPATH_W) '$(srcdir)/getservent.c'; fi`
-lib_a-getservent_r.o: getservent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent_r.o `test -f 'getservent_r.c' || echo '$(srcdir)/'`getservent_r.c
-
-lib_a-getservent_r.obj: getservent_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getservent_r.obj `if test -f 'getservent_r.c'; then $(CYGPATH_W) 'getservent_r.c'; else $(CYGPATH_W) '$(srcdir)/getservent_r.c'; fi`
-
-lib_a-getsrvbynm.o: getsrvbynm.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm.o `test -f 'getsrvbynm.c' || echo '$(srcdir)/'`getsrvbynm.c
-
-lib_a-getsrvbynm.obj: getsrvbynm.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm.obj `if test -f 'getsrvbynm.c'; then $(CYGPATH_W) 'getsrvbynm.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbynm.c'; fi`
-
-lib_a-getsrvbynm_r.o: getsrvbynm_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm_r.o `test -f 'getsrvbynm_r.c' || echo '$(srcdir)/'`getsrvbynm_r.c
-
-lib_a-getsrvbynm_r.obj: getsrvbynm_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbynm_r.obj `if test -f 'getsrvbynm_r.c'; then $(CYGPATH_W) 'getsrvbynm_r.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbynm_r.c'; fi`
-
-lib_a-getsrvbypt.o: getsrvbypt.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt.o `test -f 'getsrvbypt.c' || echo '$(srcdir)/'`getsrvbypt.c
-
-lib_a-getsrvbypt.obj: getsrvbypt.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt.obj `if test -f 'getsrvbypt.c'; then $(CYGPATH_W) 'getsrvbypt.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbypt.c'; fi`
+lib_a-herror.o: herror.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-herror.o `test -f 'herror.c' || echo '$(srcdir)/'`herror.c
-lib_a-getsrvbypt_r.o: getsrvbypt_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt_r.o `test -f 'getsrvbypt_r.c' || echo '$(srcdir)/'`getsrvbypt_r.c
+lib_a-herror.obj: herror.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-herror.obj `if test -f 'herror.c'; then $(CYGPATH_W) 'herror.c'; else $(CYGPATH_W) '$(srcdir)/herror.c'; fi`
-lib_a-getsrvbypt_r.obj: getsrvbypt_r.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getsrvbypt_r.obj `if test -f 'getsrvbypt_r.c'; then $(CYGPATH_W) 'getsrvbypt_r.c'; else $(CYGPATH_W) '$(srcdir)/getsrvbypt_r.c'; fi`
+lib_a-hesiod.o: hesiod.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-hesiod.o `test -f 'hesiod.c' || echo '$(srcdir)/'`hesiod.c
-lib_a-grp-lookup.o: grp-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-grp-lookup.o `test -f 'grp-lookup.c' || echo '$(srcdir)/'`grp-lookup.c
-
-lib_a-grp-lookup.obj: grp-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-grp-lookup.obj `if test -f 'grp-lookup.c'; then $(CYGPATH_W) 'grp-lookup.c'; else $(CYGPATH_W) '$(srcdir)/grp-lookup.c'; fi`
-
-lib_a-herrno.o: herrno.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-herrno.o `test -f 'herrno.c' || echo '$(srcdir)/'`herrno.c
-
-lib_a-herrno.obj: herrno.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-herrno.obj `if test -f 'herrno.c'; then $(CYGPATH_W) 'herrno.c'; else $(CYGPATH_W) '$(srcdir)/herrno.c'; fi`
-
-lib_a-hosts-lookup.o: hosts-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-hosts-lookup.o `test -f 'hosts-lookup.c' || echo '$(srcdir)/'`hosts-lookup.c
-
-lib_a-hosts-lookup.obj: hosts-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-hosts-lookup.obj `if test -f 'hosts-lookup.c'; then $(CYGPATH_W) 'hosts-lookup.c'; else $(CYGPATH_W) '$(srcdir)/hosts-lookup.c'; fi`
-
-lib_a-ifreq.o: ifreq.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifreq.o `test -f 'ifreq.c' || echo '$(srcdir)/'`ifreq.c
-
-lib_a-ifreq.obj: ifreq.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifreq.obj `if test -f 'ifreq.c'; then $(CYGPATH_W) 'ifreq.c'; else $(CYGPATH_W) '$(srcdir)/ifreq.c'; fi`
-
-lib_a-in6_addr.o: in6_addr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-in6_addr.o `test -f 'in6_addr.c' || echo '$(srcdir)/'`in6_addr.c
-
-lib_a-in6_addr.obj: in6_addr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-in6_addr.obj `if test -f 'in6_addr.c'; then $(CYGPATH_W) 'in6_addr.c'; else $(CYGPATH_W) '$(srcdir)/in6_addr.c'; fi`
-
-lib_a-inet6_option.o: inet6_option.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet6_option.o `test -f 'inet6_option.c' || echo '$(srcdir)/'`inet6_option.c
-
-lib_a-inet6_option.obj: inet6_option.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet6_option.obj `if test -f 'inet6_option.c'; then $(CYGPATH_W) 'inet6_option.c'; else $(CYGPATH_W) '$(srcdir)/inet6_option.c'; fi`
+lib_a-hesiod.obj: hesiod.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-hesiod.obj `if test -f 'hesiod.c'; then $(CYGPATH_W) 'hesiod.c'; else $(CYGPATH_W) '$(srcdir)/hesiod.c'; fi`
lib_a-inet_addr.o: inet_addr.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_addr.o `test -f 'inet_addr.c' || echo '$(srcdir)/'`inet_addr.c
@@ -813,23 +531,35 @@ lib_a-inet_addr.o: inet_addr.c
lib_a-inet_addr.obj: inet_addr.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_addr.obj `if test -f 'inet_addr.c'; then $(CYGPATH_W) 'inet_addr.c'; else $(CYGPATH_W) '$(srcdir)/inet_addr.c'; fi`
+lib_a-ifname.o: ifname.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifname.o `test -f 'ifname.c' || echo '$(srcdir)/'`ifname.c
+
+lib_a-ifname.obj: ifname.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifname.obj `if test -f 'ifname.c'; then $(CYGPATH_W) 'ifname.c'; else $(CYGPATH_W) '$(srcdir)/ifname.c'; fi`
+
lib_a-inet_lnaof.o: inet_lnaof.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_lnaof.o `test -f 'inet_lnaof.c' || echo '$(srcdir)/'`inet_lnaof.c
lib_a-inet_lnaof.obj: inet_lnaof.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_lnaof.obj `if test -f 'inet_lnaof.c'; then $(CYGPATH_W) 'inet_lnaof.c'; else $(CYGPATH_W) '$(srcdir)/inet_lnaof.c'; fi`
-lib_a-inet_mkadr.o: inet_mkadr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_mkadr.o `test -f 'inet_mkadr.c' || echo '$(srcdir)/'`inet_mkadr.c
+lib_a-inet_makeaddr.o: inet_makeaddr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_makeaddr.o `test -f 'inet_makeaddr.c' || echo '$(srcdir)/'`inet_makeaddr.c
-lib_a-inet_mkadr.obj: inet_mkadr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_mkadr.obj `if test -f 'inet_mkadr.c'; then $(CYGPATH_W) 'inet_mkadr.c'; else $(CYGPATH_W) '$(srcdir)/inet_mkadr.c'; fi`
+lib_a-inet_makeaddr.obj: inet_makeaddr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_makeaddr.obj `if test -f 'inet_makeaddr.c'; then $(CYGPATH_W) 'inet_makeaddr.c'; else $(CYGPATH_W) '$(srcdir)/inet_makeaddr.c'; fi`
-lib_a-inet_net.o: inet_net.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net.o `test -f 'inet_net.c' || echo '$(srcdir)/'`inet_net.c
+lib_a-inet_net_ntop.o: inet_net_ntop.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_ntop.o `test -f 'inet_net_ntop.c' || echo '$(srcdir)/'`inet_net_ntop.c
-lib_a-inet_net.obj: inet_net.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net.obj `if test -f 'inet_net.c'; then $(CYGPATH_W) 'inet_net.c'; else $(CYGPATH_W) '$(srcdir)/inet_net.c'; fi`
+lib_a-inet_net_ntop.obj: inet_net_ntop.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_ntop.obj `if test -f 'inet_net_ntop.c'; then $(CYGPATH_W) 'inet_net_ntop.c'; else $(CYGPATH_W) '$(srcdir)/inet_net_ntop.c'; fi`
+
+lib_a-inet_net_pton.o: inet_net_pton.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_pton.o `test -f 'inet_net_pton.c' || echo '$(srcdir)/'`inet_net_pton.c
+
+lib_a-inet_net_pton.obj: inet_net_pton.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_pton.obj `if test -f 'inet_net_pton.c'; then $(CYGPATH_W) 'inet_net_pton.c'; else $(CYGPATH_W) '$(srcdir)/inet_net_pton.c'; fi`
lib_a-inet_neta.o: inet_neta.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_neta.o `test -f 'inet_neta.c' || echo '$(srcdir)/'`inet_neta.c
@@ -843,17 +573,11 @@ lib_a-inet_netof.o: inet_netof.c
lib_a-inet_netof.obj: inet_netof.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_netof.obj `if test -f 'inet_netof.c'; then $(CYGPATH_W) 'inet_netof.c'; else $(CYGPATH_W) '$(srcdir)/inet_netof.c'; fi`
-lib_a-inet_net_ntop.o: inet_net_ntop.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_ntop.o `test -f 'inet_net_ntop.c' || echo '$(srcdir)/'`inet_net_ntop.c
+lib_a-inet_network.o: inet_network.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_network.o `test -f 'inet_network.c' || echo '$(srcdir)/'`inet_network.c
-lib_a-inet_net_ntop.obj: inet_net_ntop.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_ntop.obj `if test -f 'inet_net_ntop.c'; then $(CYGPATH_W) 'inet_net_ntop.c'; else $(CYGPATH_W) '$(srcdir)/inet_net_ntop.c'; fi`
-
-lib_a-inet_net_pton.o: inet_net_pton.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_pton.o `test -f 'inet_net_pton.c' || echo '$(srcdir)/'`inet_net_pton.c
-
-lib_a-inet_net_pton.obj: inet_net_pton.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_net_pton.obj `if test -f 'inet_net_pton.c'; then $(CYGPATH_W) 'inet_net_pton.c'; else $(CYGPATH_W) '$(srcdir)/inet_net_pton.c'; fi`
+lib_a-inet_network.obj: inet_network.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_network.obj `if test -f 'inet_network.c'; then $(CYGPATH_W) 'inet_network.c'; else $(CYGPATH_W) '$(srcdir)/inet_network.c'; fi`
lib_a-inet_ntoa.o: inet_ntoa.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_ntoa.o `test -f 'inet_ntoa.c' || echo '$(srcdir)/'`inet_ntoa.c
@@ -873,35 +597,47 @@ lib_a-inet_pton.o: inet_pton.c
lib_a-inet_pton.obj: inet_pton.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-inet_pton.obj `if test -f 'inet_pton.c'; then $(CYGPATH_W) 'inet_pton.c'; else $(CYGPATH_W) '$(srcdir)/inet_pton.c'; fi`
+lib_a-innetgr-stub.o: innetgr-stub.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-innetgr-stub.o `test -f 'innetgr-stub.c' || echo '$(srcdir)/'`innetgr-stub.c
+
+lib_a-innetgr-stub.obj: innetgr-stub.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-innetgr-stub.obj `if test -f 'innetgr-stub.c'; then $(CYGPATH_W) 'innetgr-stub.c'; else $(CYGPATH_W) '$(srcdir)/innetgr-stub.c'; fi`
+
+lib_a-ip6opt.o: ip6opt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ip6opt.o `test -f 'ip6opt.c' || echo '$(srcdir)/'`ip6opt.c
+
+lib_a-ip6opt.obj: ip6opt.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ip6opt.obj `if test -f 'ip6opt.c'; then $(CYGPATH_W) 'ip6opt.c'; else $(CYGPATH_W) '$(srcdir)/ip6opt.c'; fi`
+
lib_a-issetugid-stub.o: issetugid-stub.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-issetugid-stub.o `test -f 'issetugid-stub.c' || echo '$(srcdir)/'`issetugid-stub.c
lib_a-issetugid-stub.obj: issetugid-stub.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-issetugid-stub.obj `if test -f 'issetugid-stub.c'; then $(CYGPATH_W) 'issetugid-stub.c'; else $(CYGPATH_W) '$(srcdir)/issetugid-stub.c'; fi`
-lib_a-key-lookup.o: key-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-key-lookup.o `test -f 'key-lookup.c' || echo '$(srcdir)/'`key-lookup.c
+lib_a-linkaddr.o: linkaddr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linkaddr.o `test -f 'linkaddr.c' || echo '$(srcdir)/'`linkaddr.c
-lib_a-key-lookup.obj: key-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-key-lookup.obj `if test -f 'key-lookup.c'; then $(CYGPATH_W) 'key-lookup.c'; else $(CYGPATH_W) '$(srcdir)/key-lookup.c'; fi`
+lib_a-linkaddr.obj: linkaddr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-linkaddr.obj `if test -f 'linkaddr.c'; then $(CYGPATH_W) 'linkaddr.c'; else $(CYGPATH_W) '$(srcdir)/linkaddr.c'; fi`
-lib_a-netgrp-lookup.o: netgrp-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-netgrp-lookup.o `test -f 'netgrp-lookup.c' || echo '$(srcdir)/'`netgrp-lookup.c
+lib_a-map_v4v6.o: map_v4v6.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-map_v4v6.o `test -f 'map_v4v6.c' || echo '$(srcdir)/'`map_v4v6.c
-lib_a-netgrp-lookup.obj: netgrp-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-netgrp-lookup.obj `if test -f 'netgrp-lookup.c'; then $(CYGPATH_W) 'netgrp-lookup.c'; else $(CYGPATH_W) '$(srcdir)/netgrp-lookup.c'; fi`
+lib_a-map_v4v6.obj: map_v4v6.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-map_v4v6.obj `if test -f 'map_v4v6.c'; then $(CYGPATH_W) 'map_v4v6.c'; else $(CYGPATH_W) '$(srcdir)/map_v4v6.c'; fi`
-lib_a-network-lookup.o: network-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-network-lookup.o `test -f 'network-lookup.c' || echo '$(srcdir)/'`network-lookup.c
+lib_a-name6.o: name6.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-name6.o `test -f 'name6.c' || echo '$(srcdir)/'`name6.c
-lib_a-network-lookup.obj: network-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-network-lookup.obj `if test -f 'network-lookup.c'; then $(CYGPATH_W) 'network-lookup.c'; else $(CYGPATH_W) '$(srcdir)/network-lookup.c'; fi`
+lib_a-name6.obj: name6.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-name6.obj `if test -f 'name6.c'; then $(CYGPATH_W) 'name6.c'; else $(CYGPATH_W) '$(srcdir)/name6.c'; fi`
-lib_a-nsswitch.o: nsswitch.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsswitch.o `test -f 'nsswitch.c' || echo '$(srcdir)/'`nsswitch.c
+lib_a-ns_addr.o: ns_addr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_addr.o `test -f 'ns_addr.c' || echo '$(srcdir)/'`ns_addr.c
-lib_a-nsswitch.obj: nsswitch.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsswitch.obj `if test -f 'nsswitch.c'; then $(CYGPATH_W) 'nsswitch.c'; else $(CYGPATH_W) '$(srcdir)/nsswitch.c'; fi`
+lib_a-ns_addr.obj: ns_addr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_addr.obj `if test -f 'ns_addr.c'; then $(CYGPATH_W) 'ns_addr.c'; else $(CYGPATH_W) '$(srcdir)/ns_addr.c'; fi`
lib_a-ns_name.o: ns_name.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_name.o `test -f 'ns_name.c' || echo '$(srcdir)/'`ns_name.c
@@ -915,6 +651,12 @@ lib_a-ns_netint.o: ns_netint.c
lib_a-ns_netint.obj: ns_netint.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_netint.obj `if test -f 'ns_netint.c'; then $(CYGPATH_W) 'ns_netint.c'; else $(CYGPATH_W) '$(srcdir)/ns_netint.c'; fi`
+lib_a-ns_ntoa.o: ns_ntoa.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_ntoa.o `test -f 'ns_ntoa.c' || echo '$(srcdir)/'`ns_ntoa.c
+
+lib_a-ns_ntoa.obj: ns_ntoa.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_ntoa.obj `if test -f 'ns_ntoa.c'; then $(CYGPATH_W) 'ns_ntoa.c'; else $(CYGPATH_W) '$(srcdir)/ns_ntoa.c'; fi`
+
lib_a-ns_parse.o: ns_parse.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_parse.o `test -f 'ns_parse.c' || echo '$(srcdir)/'`ns_parse.c
@@ -927,47 +669,35 @@ lib_a-ns_print.o: ns_print.c
lib_a-ns_print.obj: ns_print.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_print.obj `if test -f 'ns_print.c'; then $(CYGPATH_W) 'ns_print.c'; else $(CYGPATH_W) '$(srcdir)/ns_print.c'; fi`
-lib_a-ns_samedomain.o: ns_samedomain.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_samedomain.o `test -f 'ns_samedomain.c' || echo '$(srcdir)/'`ns_samedomain.c
-
-lib_a-ns_samedomain.obj: ns_samedomain.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_samedomain.obj `if test -f 'ns_samedomain.c'; then $(CYGPATH_W) 'ns_samedomain.c'; else $(CYGPATH_W) '$(srcdir)/ns_samedomain.c'; fi`
-
lib_a-ns_ttl.o: ns_ttl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_ttl.o `test -f 'ns_ttl.c' || echo '$(srcdir)/'`ns_ttl.c
lib_a-ns_ttl.obj: ns_ttl.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ns_ttl.obj `if test -f 'ns_ttl.c'; then $(CYGPATH_W) 'ns_ttl.c'; else $(CYGPATH_W) '$(srcdir)/ns_ttl.c'; fi`
-lib_a-nsap_addr.o: nsap_addr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsap_addr.o `test -f 'nsap_addr.c' || echo '$(srcdir)/'`nsap_addr.c
-
-lib_a-nsap_addr.obj: nsap_addr.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsap_addr.obj `if test -f 'nsap_addr.c'; then $(CYGPATH_W) 'nsap_addr.c'; else $(CYGPATH_W) '$(srcdir)/nsap_addr.c'; fi`
-
-lib_a-proto-lookup.o: proto-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-proto-lookup.o `test -f 'proto-lookup.c' || echo '$(srcdir)/'`proto-lookup.c
+lib_a-nsdispatch.o: nsdispatch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsdispatch.o `test -f 'nsdispatch.c' || echo '$(srcdir)/'`nsdispatch.c
-lib_a-proto-lookup.obj: proto-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-proto-lookup.obj `if test -f 'proto-lookup.c'; then $(CYGPATH_W) 'proto-lookup.c'; else $(CYGPATH_W) '$(srcdir)/proto-lookup.c'; fi`
+lib_a-nsdispatch.obj: nsdispatch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsdispatch.obj `if test -f 'nsdispatch.c'; then $(CYGPATH_W) 'nsdispatch.c'; else $(CYGPATH_W) '$(srcdir)/nsdispatch.c'; fi`
-lib_a-opensock.o: opensock.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-opensock.o `test -f 'opensock.c' || echo '$(srcdir)/'`opensock.c
+lib_a-nslexer.o: nslexer.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nslexer.o `test -f 'nslexer.c' || echo '$(srcdir)/'`nslexer.c
-lib_a-opensock.obj: opensock.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-opensock.obj `if test -f 'opensock.c'; then $(CYGPATH_W) 'opensock.c'; else $(CYGPATH_W) '$(srcdir)/opensock.c'; fi`
+lib_a-nslexer.obj: nslexer.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nslexer.obj `if test -f 'nslexer.c'; then $(CYGPATH_W) 'nslexer.c'; else $(CYGPATH_W) '$(srcdir)/nslexer.c'; fi`
-lib_a-pwd-lookup.o: pwd-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pwd-lookup.o `test -f 'pwd-lookup.c' || echo '$(srcdir)/'`pwd-lookup.c
+lib_a-nsparser.o: nsparser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsparser.o `test -f 'nsparser.c' || echo '$(srcdir)/'`nsparser.c
-lib_a-pwd-lookup.obj: pwd-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-pwd-lookup.obj `if test -f 'pwd-lookup.c'; then $(CYGPATH_W) 'pwd-lookup.c'; else $(CYGPATH_W) '$(srcdir)/pwd-lookup.c'; fi`
+lib_a-nsparser.obj: nsparser.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsparser.obj `if test -f 'nsparser.c'; then $(CYGPATH_W) 'nsparser.c'; else $(CYGPATH_W) '$(srcdir)/nsparser.c'; fi`
-lib_a-recv.o: recv.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-recv.o `test -f 'recv.c' || echo '$(srcdir)/'`recv.c
+lib_a-nsap_addr.o: nsap_addr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsap_addr.o `test -f 'nsap_addr.c' || echo '$(srcdir)/'`nsap_addr.c
-lib_a-recv.obj: recv.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-recv.obj `if test -f 'recv.c'; then $(CYGPATH_W) 'recv.c'; else $(CYGPATH_W) '$(srcdir)/recv.c'; fi`
+lib_a-nsap_addr.obj: nsap_addr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-nsap_addr.obj `if test -f 'nsap_addr.c'; then $(CYGPATH_W) 'nsap_addr.c'; else $(CYGPATH_W) '$(srcdir)/nsap_addr.c'; fi`
lib_a-res_comp.o: res_comp.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_comp.o `test -f 'res_comp.c' || echo '$(srcdir)/'`res_comp.c
@@ -987,30 +717,24 @@ lib_a-res_debug.o: res_debug.c
lib_a-res_debug.obj: res_debug.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_debug.obj `if test -f 'res_debug.c'; then $(CYGPATH_W) 'res_debug.c'; else $(CYGPATH_W) '$(srcdir)/res_debug.c'; fi`
-lib_a-res_hconf.o: res_hconf.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_hconf.o `test -f 'res_hconf.c' || echo '$(srcdir)/'`res_hconf.c
-
-lib_a-res_hconf.obj: res_hconf.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_hconf.obj `if test -f 'res_hconf.c'; then $(CYGPATH_W) 'res_hconf.c'; else $(CYGPATH_W) '$(srcdir)/res_hconf.c'; fi`
-
lib_a-res_init.o: res_init.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_init.o `test -f 'res_init.c' || echo '$(srcdir)/'`res_init.c
lib_a-res_init.obj: res_init.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_init.obj `if test -f 'res_init.c'; then $(CYGPATH_W) 'res_init.c'; else $(CYGPATH_W) '$(srcdir)/res_init.c'; fi`
-lib_a-res_libc.o: res_libc.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_libc.o `test -f 'res_libc.c' || echo '$(srcdir)/'`res_libc.c
-
-lib_a-res_libc.obj: res_libc.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_libc.obj `if test -f 'res_libc.c'; then $(CYGPATH_W) 'res_libc.c'; else $(CYGPATH_W) '$(srcdir)/res_libc.c'; fi`
-
lib_a-res_mkquery.o: res_mkquery.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_mkquery.o `test -f 'res_mkquery.c' || echo '$(srcdir)/'`res_mkquery.c
lib_a-res_mkquery.obj: res_mkquery.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_mkquery.obj `if test -f 'res_mkquery.c'; then $(CYGPATH_W) 'res_mkquery.c'; else $(CYGPATH_W) '$(srcdir)/res_mkquery.c'; fi`
+lib_a-res_mkupdate.o: res_mkupdate.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_mkupdate.o `test -f 'res_mkupdate.c' || echo '$(srcdir)/'`res_mkupdate.c
+
+lib_a-res_mkupdate.obj: res_mkupdate.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_mkupdate.obj `if test -f 'res_mkupdate.c'; then $(CYGPATH_W) 'res_mkupdate.c'; else $(CYGPATH_W) '$(srcdir)/res_mkupdate.c'; fi`
+
lib_a-res_query.o: res_query.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_query.o `test -f 'res_query.c' || echo '$(srcdir)/'`res_query.c
@@ -1023,47 +747,23 @@ lib_a-res_send.o: res_send.c
lib_a-res_send.obj: res_send.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_send.obj `if test -f 'res_send.c'; then $(CYGPATH_W) 'res_send.c'; else $(CYGPATH_W) '$(srcdir)/res_send.c'; fi`
-lib_a-rexec.o: rexec.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rexec.o `test -f 'rexec.c' || echo '$(srcdir)/'`rexec.c
-
-lib_a-rexec.obj: rexec.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rexec.obj `if test -f 'rexec.c'; then $(CYGPATH_W) 'rexec.c'; else $(CYGPATH_W) '$(srcdir)/rexec.c'; fi`
-
-lib_a-rpc-lookup.o: rpc-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rpc-lookup.o `test -f 'rpc-lookup.c' || echo '$(srcdir)/'`rpc-lookup.c
-
-lib_a-rpc-lookup.obj: rpc-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rpc-lookup.obj `if test -f 'rpc-lookup.c'; then $(CYGPATH_W) 'rpc-lookup.c'; else $(CYGPATH_W) '$(srcdir)/rpc-lookup.c'; fi`
-
-lib_a-ruserpass.o: ruserpass.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ruserpass.o `test -f 'ruserpass.c' || echo '$(srcdir)/'`ruserpass.c
+lib_a-res_update.o: res_update.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_update.o `test -f 'res_update.c' || echo '$(srcdir)/'`res_update.c
-lib_a-ruserpass.obj: ruserpass.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ruserpass.obj `if test -f 'ruserpass.c'; then $(CYGPATH_W) 'ruserpass.c'; else $(CYGPATH_W) '$(srcdir)/ruserpass.c'; fi`
+lib_a-res_update.obj: res_update.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-res_update.obj `if test -f 'res_update.c'; then $(CYGPATH_W) 'res_update.c'; else $(CYGPATH_W) '$(srcdir)/res_update.c'; fi`
-lib_a-send.o: send.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-send.o `test -f 'send.c' || echo '$(srcdir)/'`send.c
+lib_a-rthdr.o: rthdr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rthdr.o `test -f 'rthdr.c' || echo '$(srcdir)/'`rthdr.c
-lib_a-send.obj: send.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-send.obj `if test -f 'send.c'; then $(CYGPATH_W) 'send.c'; else $(CYGPATH_W) '$(srcdir)/send.c'; fi`
+lib_a-rthdr.obj: rthdr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rthdr.obj `if test -f 'rthdr.c'; then $(CYGPATH_W) 'rthdr.c'; else $(CYGPATH_W) '$(srcdir)/rthdr.c'; fi`
-lib_a-service-lookup.o: service-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-service-lookup.o `test -f 'service-lookup.c' || echo '$(srcdir)/'`service-lookup.c
+lib_a-vars.o: vars.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vars.o `test -f 'vars.c' || echo '$(srcdir)/'`vars.c
-lib_a-service-lookup.obj: service-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-service-lookup.obj `if test -f 'service-lookup.c'; then $(CYGPATH_W) 'service-lookup.c'; else $(CYGPATH_W) '$(srcdir)/service-lookup.c'; fi`
-
-lib_a-spwd-lookup.o: spwd-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spwd-lookup.o `test -f 'spwd-lookup.c' || echo '$(srcdir)/'`spwd-lookup.c
-
-lib_a-spwd-lookup.obj: spwd-lookup.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-spwd-lookup.obj `if test -f 'spwd-lookup.c'; then $(CYGPATH_W) 'spwd-lookup.c'; else $(CYGPATH_W) '$(srcdir)/spwd-lookup.c'; fi`
-
-lib_a-ifname.o: ifname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifname.o `test -f 'ifname.c' || echo '$(srcdir)/'`ifname.c
-
-lib_a-ifname.obj: ifname.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ifname.obj `if test -f 'ifname.c'; then $(CYGPATH_W) 'ifname.c'; else $(CYGPATH_W) '$(srcdir)/ifname.c'; fi`
+lib_a-vars.obj: vars.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vars.obj `if test -f 'vars.c'; then $(CYGPATH_W) 'vars.c'; else $(CYGPATH_W) '$(srcdir)/vars.c'; fi`
libnet_la-addr2ascii.lo: addr2ascii.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-addr2ascii.lo `test -f 'addr2ascii.c' || echo '$(srcdir)/'`addr2ascii.c
@@ -1071,197 +771,89 @@ libnet_la-addr2ascii.lo: addr2ascii.c
libnet_la-ascii2addr.lo: ascii2addr.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ascii2addr.lo `test -f 'ascii2addr.c' || echo '$(srcdir)/'`ascii2addr.c
-libnet_la-alias-lookup.lo: alias-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-alias-lookup.lo `test -f 'alias-lookup.c' || echo '$(srcdir)/'`alias-lookup.c
-
libnet_la-base64.lo: base64.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-base64.lo `test -f 'base64.c' || echo '$(srcdir)/'`base64.c
-libnet_la-check_pf.lo: check_pf.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-check_pf.lo `test -f 'check_pf.c' || echo '$(srcdir)/'`check_pf.c
-
-libnet_la-digits_dots.lo: digits_dots.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-digits_dots.lo `test -f 'digits_dots.c' || echo '$(srcdir)/'`digits_dots.c
-
-libnet_la-ether_aton.lo: ether_aton.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_aton.lo `test -f 'ether_aton.c' || echo '$(srcdir)/'`ether_aton.c
-
-libnet_la-ether_aton_r.lo: ether_aton_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_aton_r.lo `test -f 'ether_aton_r.c' || echo '$(srcdir)/'`ether_aton_r.c
-
-libnet_la-ether_hton.lo: ether_hton.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_hton.lo `test -f 'ether_hton.c' || echo '$(srcdir)/'`ether_hton.c
+libnet_la-bindresvport.lo: bindresvport.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-bindresvport.lo `test -f 'bindresvport.c' || echo '$(srcdir)/'`bindresvport.c
-libnet_la-ether_line.lo: ether_line.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_line.lo `test -f 'ether_line.c' || echo '$(srcdir)/'`ether_line.c
-
-libnet_la-ether_ntoa.lo: ether_ntoa.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_ntoa.lo `test -f 'ether_ntoa.c' || echo '$(srcdir)/'`ether_ntoa.c
-
-libnet_la-ether_ntoa_r.lo: ether_ntoa_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_ntoa_r.lo `test -f 'ether_ntoa_r.c' || echo '$(srcdir)/'`ether_ntoa_r.c
-
-libnet_la-ether_ntoh.lo: ether_ntoh.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_ntoh.lo `test -f 'ether_ntoh.c' || echo '$(srcdir)/'`ether_ntoh.c
-
-libnet_la-ethers-lookup.lo: ethers-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ethers-lookup.lo `test -f 'ethers-lookup.c' || echo '$(srcdir)/'`ethers-lookup.c
+libnet_la-ether_addr.lo: ether_addr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ether_addr.lo `test -f 'ether_addr.c' || echo '$(srcdir)/'`ether_addr.c
libnet_la-getaddrinfo.lo: getaddrinfo.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaddrinfo.lo `test -f 'getaddrinfo.c' || echo '$(srcdir)/'`getaddrinfo.c
-libnet_la-getaliasent.lo: getaliasent.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasent.lo `test -f 'getaliasent.c' || echo '$(srcdir)/'`getaliasent.c
-
-libnet_la-getaliasent_r.lo: getaliasent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasent_r.lo `test -f 'getaliasent_r.c' || echo '$(srcdir)/'`getaliasent_r.c
-
-libnet_la-getaliasname.lo: getaliasname.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasname.lo `test -f 'getaliasname.c' || echo '$(srcdir)/'`getaliasname.c
-
-libnet_la-getaliasname_r.lo: getaliasname_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getaliasname_r.lo `test -f 'getaliasname_r.c' || echo '$(srcdir)/'`getaliasname_r.c
+libnet_la-gethostbydns.lo: gethostbydns.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethostbydns.lo `test -f 'gethostbydns.c' || echo '$(srcdir)/'`gethostbydns.c
-libnet_la-gethstbyad.lo: gethstbyad.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbyad.lo `test -f 'gethstbyad.c' || echo '$(srcdir)/'`gethstbyad.c
+libnet_la-gethostbyht.lo: gethostbyht.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethostbyht.lo `test -f 'gethostbyht.c' || echo '$(srcdir)/'`gethostbyht.c
-libnet_la-gethstbyad_r.lo: gethstbyad_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbyad_r.lo `test -f 'gethstbyad_r.c' || echo '$(srcdir)/'`gethstbyad_r.c
+libnet_la-gethostbynis.lo: gethostbynis.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethostbynis.lo `test -f 'gethostbynis.c' || echo '$(srcdir)/'`gethostbynis.c
-libnet_la-gethstbynm2.lo: gethstbynm2.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm2.lo `test -f 'gethstbynm2.c' || echo '$(srcdir)/'`gethstbynm2.c
+libnet_la-gethostnamadr.lo: gethostnamadr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethostnamadr.lo `test -f 'gethostnamadr.c' || echo '$(srcdir)/'`gethostnamadr.c
-libnet_la-gethstbynm2_r.lo: gethstbynm2_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm2_r.lo `test -f 'gethstbynm2_r.c' || echo '$(srcdir)/'`gethstbynm2_r.c
-
-libnet_la-gethstbynm.lo: gethstbynm.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm.lo `test -f 'gethstbynm.c' || echo '$(srcdir)/'`gethstbynm.c
-
-libnet_la-gethstbynm_r.lo: gethstbynm_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstbynm_r.lo `test -f 'gethstbynm_r.c' || echo '$(srcdir)/'`gethstbynm_r.c
-
-libnet_la-gethstent.lo: gethstent.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstent.lo `test -f 'gethstent.c' || echo '$(srcdir)/'`gethstent.c
-
-libnet_la-gethstent_r.lo: gethstent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-gethstent_r.lo `test -f 'gethstent_r.c' || echo '$(srcdir)/'`gethstent_r.c
+libnet_la-getifaddrs.lo: getifaddrs.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getifaddrs.lo `test -f 'getifaddrs.c' || echo '$(srcdir)/'`getifaddrs.c
libnet_la-getnameinfo.lo: getnameinfo.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnameinfo.lo `test -f 'getnameinfo.c' || echo '$(srcdir)/'`getnameinfo.c
-libnet_la-getnetbyad.lo: getnetbyad.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbyad.lo `test -f 'getnetbyad.c' || echo '$(srcdir)/'`getnetbyad.c
-
-libnet_la-getnetbyad_r.lo: getnetbyad_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbyad_r.lo `test -f 'getnetbyad_r.c' || echo '$(srcdir)/'`getnetbyad_r.c
-
-libnet_la-getnetbynm.lo: getnetbynm.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbynm.lo `test -f 'getnetbynm.c' || echo '$(srcdir)/'`getnetbynm.c
+libnet_la-getnetbydns.lo: getnetbydns.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbydns.lo `test -f 'getnetbydns.c' || echo '$(srcdir)/'`getnetbydns.c
-libnet_la-getnetbynm_r.lo: getnetbynm_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbynm_r.lo `test -f 'getnetbynm_r.c' || echo '$(srcdir)/'`getnetbynm_r.c
+libnet_la-getnetbyht.lo: getnetbyht.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbyht.lo `test -f 'getnetbyht.c' || echo '$(srcdir)/'`getnetbyht.c
-libnet_la-getnetent.lo: getnetent.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetent.lo `test -f 'getnetent.c' || echo '$(srcdir)/'`getnetent.c
+libnet_la-getnetbynis.lo: getnetbynis.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetbynis.lo `test -f 'getnetbynis.c' || echo '$(srcdir)/'`getnetbynis.c
-libnet_la-getnetent_r.lo: getnetent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetent_r.lo `test -f 'getnetent_r.c' || echo '$(srcdir)/'`getnetent_r.c
-
-libnet_la-getnetgrent.lo: getnetgrent.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetgrent.lo `test -f 'getnetgrent.c' || echo '$(srcdir)/'`getnetgrent.c
-
-libnet_la-getnetgrent_r.lo: getnetgrent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetgrent_r.lo `test -f 'getnetgrent_r.c' || echo '$(srcdir)/'`getnetgrent_r.c
-
-libnet_la-getnssent.lo: getnssent.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnssent.lo `test -f 'getnssent.c' || echo '$(srcdir)/'`getnssent.c
-
-libnet_la-getnssent_r.lo: getnssent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnssent_r.lo `test -f 'getnssent_r.c' || echo '$(srcdir)/'`getnssent_r.c
+libnet_la-getnetnamadr.lo: getnetnamadr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getnetnamadr.lo `test -f 'getnetnamadr.c' || echo '$(srcdir)/'`getnetnamadr.c
libnet_la-getproto.lo: getproto.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getproto.lo `test -f 'getproto.c' || echo '$(srcdir)/'`getproto.c
-libnet_la-getproto_r.lo: getproto_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getproto_r.lo `test -f 'getproto_r.c' || echo '$(srcdir)/'`getproto_r.c
-
-libnet_la-getprtent.lo: getprtent.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtent.lo `test -f 'getprtent.c' || echo '$(srcdir)/'`getprtent.c
-
-libnet_la-getprtent_r.lo: getprtent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtent_r.lo `test -f 'getprtent_r.c' || echo '$(srcdir)/'`getprtent_r.c
-
-libnet_la-getprtname.lo: getprtname.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtname.lo `test -f 'getprtname.c' || echo '$(srcdir)/'`getprtname.c
+libnet_la-getprotoent.lo: getprotoent.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprotoent.lo `test -f 'getprotoent.c' || echo '$(srcdir)/'`getprotoent.c
-libnet_la-getprtname_r.lo: getprtname_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprtname_r.lo `test -f 'getprtname_r.c' || echo '$(srcdir)/'`getprtname_r.c
+libnet_la-getprotoname.lo: getprotoname.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getprotoname.lo `test -f 'getprotoname.c' || echo '$(srcdir)/'`getprotoname.c
-libnet_la-getrpcbyname.lo: getrpcbyname.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbyname.lo `test -f 'getrpcbyname.c' || echo '$(srcdir)/'`getrpcbyname.c
+libnet_la-getservbyname.lo: getservbyname.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getservbyname.lo `test -f 'getservbyname.c' || echo '$(srcdir)/'`getservbyname.c
-libnet_la-getrpcbyname_r.lo: getrpcbyname_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbyname_r.lo `test -f 'getrpcbyname_r.c' || echo '$(srcdir)/'`getrpcbyname_r.c
-
-libnet_la-getrpcbynumber.lo: getrpcbynumber.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbynumber.lo `test -f 'getrpcbynumber.c' || echo '$(srcdir)/'`getrpcbynumber.c
-
-libnet_la-getrpcbynumber_r.lo: getrpcbynumber_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcbynumber_r.lo `test -f 'getrpcbynumber_r.c' || echo '$(srcdir)/'`getrpcbynumber_r.c
-
-libnet_la-getrpcent.lo: getrpcent.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcent.lo `test -f 'getrpcent.c' || echo '$(srcdir)/'`getrpcent.c
-
-libnet_la-getrpcent_r.lo: getrpcent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getrpcent_r.lo `test -f 'getrpcent_r.c' || echo '$(srcdir)/'`getrpcent_r.c
+libnet_la-getservbyport.lo: getservbyport.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getservbyport.lo `test -f 'getservbyport.c' || echo '$(srcdir)/'`getservbyport.c
libnet_la-getservent.lo: getservent.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getservent.lo `test -f 'getservent.c' || echo '$(srcdir)/'`getservent.c
-libnet_la-getservent_r.lo: getservent_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getservent_r.lo `test -f 'getservent_r.c' || echo '$(srcdir)/'`getservent_r.c
-
-libnet_la-getsrvbynm.lo: getsrvbynm.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbynm.lo `test -f 'getsrvbynm.c' || echo '$(srcdir)/'`getsrvbynm.c
-
-libnet_la-getsrvbynm_r.lo: getsrvbynm_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbynm_r.lo `test -f 'getsrvbynm_r.c' || echo '$(srcdir)/'`getsrvbynm_r.c
+libnet_la-herror.lo: herror.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-herror.lo `test -f 'herror.c' || echo '$(srcdir)/'`herror.c
-libnet_la-getsrvbypt.lo: getsrvbypt.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbypt.lo `test -f 'getsrvbypt.c' || echo '$(srcdir)/'`getsrvbypt.c
-
-libnet_la-getsrvbypt_r.lo: getsrvbypt_r.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-getsrvbypt_r.lo `test -f 'getsrvbypt_r.c' || echo '$(srcdir)/'`getsrvbypt_r.c
-
-libnet_la-grp-lookup.lo: grp-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-grp-lookup.lo `test -f 'grp-lookup.c' || echo '$(srcdir)/'`grp-lookup.c
-
-libnet_la-herrno.lo: herrno.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-herrno.lo `test -f 'herrno.c' || echo '$(srcdir)/'`herrno.c
-
-libnet_la-hosts-lookup.lo: hosts-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-hosts-lookup.lo `test -f 'hosts-lookup.c' || echo '$(srcdir)/'`hosts-lookup.c
-
-libnet_la-ifreq.lo: ifreq.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ifreq.lo `test -f 'ifreq.c' || echo '$(srcdir)/'`ifreq.c
-
-libnet_la-in6_addr.lo: in6_addr.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-in6_addr.lo `test -f 'in6_addr.c' || echo '$(srcdir)/'`in6_addr.c
-
-libnet_la-inet6_option.lo: inet6_option.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet6_option.lo `test -f 'inet6_option.c' || echo '$(srcdir)/'`inet6_option.c
+libnet_la-hesiod.lo: hesiod.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-hesiod.lo `test -f 'hesiod.c' || echo '$(srcdir)/'`hesiod.c
libnet_la-inet_addr.lo: inet_addr.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_addr.lo `test -f 'inet_addr.c' || echo '$(srcdir)/'`inet_addr.c
+libnet_la-ifname.lo: ifname.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ifname.lo `test -f 'ifname.c' || echo '$(srcdir)/'`ifname.c
+
libnet_la-inet_lnaof.lo: inet_lnaof.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_lnaof.lo `test -f 'inet_lnaof.c' || echo '$(srcdir)/'`inet_lnaof.c
-libnet_la-inet_mkadr.lo: inet_mkadr.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_mkadr.lo `test -f 'inet_mkadr.c' || echo '$(srcdir)/'`inet_mkadr.c
+libnet_la-inet_makeaddr.lo: inet_makeaddr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_makeaddr.lo `test -f 'inet_makeaddr.c' || echo '$(srcdir)/'`inet_makeaddr.c
-libnet_la-inet_net.lo: inet_net.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net.lo `test -f 'inet_net.c' || echo '$(srcdir)/'`inet_net.c
+libnet_la-inet_net_ntop.lo: inet_net_ntop.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net_ntop.lo `test -f 'inet_net_ntop.c' || echo '$(srcdir)/'`inet_net_ntop.c
+
+libnet_la-inet_net_pton.lo: inet_net_pton.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net_pton.lo `test -f 'inet_net_pton.c' || echo '$(srcdir)/'`inet_net_pton.c
libnet_la-inet_neta.lo: inet_neta.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_neta.lo `test -f 'inet_neta.c' || echo '$(srcdir)/'`inet_neta.c
@@ -1269,11 +861,8 @@ libnet_la-inet_neta.lo: inet_neta.c
libnet_la-inet_netof.lo: inet_netof.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_netof.lo `test -f 'inet_netof.c' || echo '$(srcdir)/'`inet_netof.c
-libnet_la-inet_net_ntop.lo: inet_net_ntop.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net_ntop.lo `test -f 'inet_net_ntop.c' || echo '$(srcdir)/'`inet_net_ntop.c
-
-libnet_la-inet_net_pton.lo: inet_net_pton.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_net_pton.lo `test -f 'inet_net_pton.c' || echo '$(srcdir)/'`inet_net_pton.c
+libnet_la-inet_network.lo: inet_network.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_network.lo `test -f 'inet_network.c' || echo '$(srcdir)/'`inet_network.c
libnet_la-inet_ntoa.lo: inet_ntoa.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_ntoa.lo `test -f 'inet_ntoa.c' || echo '$(srcdir)/'`inet_ntoa.c
@@ -1284,20 +873,26 @@ libnet_la-inet_ntop.lo: inet_ntop.c
libnet_la-inet_pton.lo: inet_pton.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-inet_pton.lo `test -f 'inet_pton.c' || echo '$(srcdir)/'`inet_pton.c
+libnet_la-innetgr-stub.lo: innetgr-stub.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-innetgr-stub.lo `test -f 'innetgr-stub.c' || echo '$(srcdir)/'`innetgr-stub.c
+
+libnet_la-ip6opt.lo: ip6opt.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ip6opt.lo `test -f 'ip6opt.c' || echo '$(srcdir)/'`ip6opt.c
+
libnet_la-issetugid-stub.lo: issetugid-stub.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-issetugid-stub.lo `test -f 'issetugid-stub.c' || echo '$(srcdir)/'`issetugid-stub.c
-libnet_la-key-lookup.lo: key-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-key-lookup.lo `test -f 'key-lookup.c' || echo '$(srcdir)/'`key-lookup.c
+libnet_la-linkaddr.lo: linkaddr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-linkaddr.lo `test -f 'linkaddr.c' || echo '$(srcdir)/'`linkaddr.c
-libnet_la-netgrp-lookup.lo: netgrp-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-netgrp-lookup.lo `test -f 'netgrp-lookup.c' || echo '$(srcdir)/'`netgrp-lookup.c
+libnet_la-map_v4v6.lo: map_v4v6.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-map_v4v6.lo `test -f 'map_v4v6.c' || echo '$(srcdir)/'`map_v4v6.c
-libnet_la-network-lookup.lo: network-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-network-lookup.lo `test -f 'network-lookup.c' || echo '$(srcdir)/'`network-lookup.c
+libnet_la-name6.lo: name6.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-name6.lo `test -f 'name6.c' || echo '$(srcdir)/'`name6.c
-libnet_la-nsswitch.lo: nsswitch.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nsswitch.lo `test -f 'nsswitch.c' || echo '$(srcdir)/'`nsswitch.c
+libnet_la-ns_addr.lo: ns_addr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_addr.lo `test -f 'ns_addr.c' || echo '$(srcdir)/'`ns_addr.c
libnet_la-ns_name.lo: ns_name.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_name.lo `test -f 'ns_name.c' || echo '$(srcdir)/'`ns_name.c
@@ -1305,32 +900,29 @@ libnet_la-ns_name.lo: ns_name.c
libnet_la-ns_netint.lo: ns_netint.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_netint.lo `test -f 'ns_netint.c' || echo '$(srcdir)/'`ns_netint.c
+libnet_la-ns_ntoa.lo: ns_ntoa.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_ntoa.lo `test -f 'ns_ntoa.c' || echo '$(srcdir)/'`ns_ntoa.c
+
libnet_la-ns_parse.lo: ns_parse.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_parse.lo `test -f 'ns_parse.c' || echo '$(srcdir)/'`ns_parse.c
libnet_la-ns_print.lo: ns_print.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_print.lo `test -f 'ns_print.c' || echo '$(srcdir)/'`ns_print.c
-libnet_la-ns_samedomain.lo: ns_samedomain.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_samedomain.lo `test -f 'ns_samedomain.c' || echo '$(srcdir)/'`ns_samedomain.c
-
libnet_la-ns_ttl.lo: ns_ttl.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ns_ttl.lo `test -f 'ns_ttl.c' || echo '$(srcdir)/'`ns_ttl.c
-libnet_la-nsap_addr.lo: nsap_addr.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nsap_addr.lo `test -f 'nsap_addr.c' || echo '$(srcdir)/'`nsap_addr.c
+libnet_la-nsdispatch.lo: nsdispatch.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nsdispatch.lo `test -f 'nsdispatch.c' || echo '$(srcdir)/'`nsdispatch.c
-libnet_la-proto-lookup.lo: proto-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-proto-lookup.lo `test -f 'proto-lookup.c' || echo '$(srcdir)/'`proto-lookup.c
+libnet_la-nslexer.lo: nslexer.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nslexer.lo `test -f 'nslexer.c' || echo '$(srcdir)/'`nslexer.c
-libnet_la-opensock.lo: opensock.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-opensock.lo `test -f 'opensock.c' || echo '$(srcdir)/'`opensock.c
+libnet_la-nsparser.lo: nsparser.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nsparser.lo `test -f 'nsparser.c' || echo '$(srcdir)/'`nsparser.c
-libnet_la-pwd-lookup.lo: pwd-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-pwd-lookup.lo `test -f 'pwd-lookup.c' || echo '$(srcdir)/'`pwd-lookup.c
-
-libnet_la-recv.lo: recv.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-recv.lo `test -f 'recv.c' || echo '$(srcdir)/'`recv.c
+libnet_la-nsap_addr.lo: nsap_addr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-nsap_addr.lo `test -f 'nsap_addr.c' || echo '$(srcdir)/'`nsap_addr.c
libnet_la-res_comp.lo: res_comp.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_comp.lo `test -f 'res_comp.c' || echo '$(srcdir)/'`res_comp.c
@@ -1341,44 +933,29 @@ libnet_la-res_data.lo: res_data.c
libnet_la-res_debug.lo: res_debug.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_debug.lo `test -f 'res_debug.c' || echo '$(srcdir)/'`res_debug.c
-libnet_la-res_hconf.lo: res_hconf.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_hconf.lo `test -f 'res_hconf.c' || echo '$(srcdir)/'`res_hconf.c
-
libnet_la-res_init.lo: res_init.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_init.lo `test -f 'res_init.c' || echo '$(srcdir)/'`res_init.c
-libnet_la-res_libc.lo: res_libc.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_libc.lo `test -f 'res_libc.c' || echo '$(srcdir)/'`res_libc.c
-
libnet_la-res_mkquery.lo: res_mkquery.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_mkquery.lo `test -f 'res_mkquery.c' || echo '$(srcdir)/'`res_mkquery.c
+libnet_la-res_mkupdate.lo: res_mkupdate.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_mkupdate.lo `test -f 'res_mkupdate.c' || echo '$(srcdir)/'`res_mkupdate.c
+
libnet_la-res_query.lo: res_query.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_query.lo `test -f 'res_query.c' || echo '$(srcdir)/'`res_query.c
libnet_la-res_send.lo: res_send.c
$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_send.lo `test -f 'res_send.c' || echo '$(srcdir)/'`res_send.c
-libnet_la-rexec.lo: rexec.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-rexec.lo `test -f 'rexec.c' || echo '$(srcdir)/'`rexec.c
+libnet_la-res_update.lo: res_update.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-res_update.lo `test -f 'res_update.c' || echo '$(srcdir)/'`res_update.c
-libnet_la-rpc-lookup.lo: rpc-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-rpc-lookup.lo `test -f 'rpc-lookup.c' || echo '$(srcdir)/'`rpc-lookup.c
+libnet_la-rthdr.lo: rthdr.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-rthdr.lo `test -f 'rthdr.c' || echo '$(srcdir)/'`rthdr.c
-libnet_la-ruserpass.lo: ruserpass.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ruserpass.lo `test -f 'ruserpass.c' || echo '$(srcdir)/'`ruserpass.c
-
-libnet_la-send.lo: send.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-send.lo `test -f 'send.c' || echo '$(srcdir)/'`send.c
-
-libnet_la-service-lookup.lo: service-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-service-lookup.lo `test -f 'service-lookup.c' || echo '$(srcdir)/'`service-lookup.c
-
-libnet_la-spwd-lookup.lo: spwd-lookup.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-spwd-lookup.lo `test -f 'spwd-lookup.c' || echo '$(srcdir)/'`spwd-lookup.c
-
-libnet_la-ifname.lo: ifname.c
- $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-ifname.lo `test -f 'ifname.c' || echo '$(srcdir)/'`ifname.c
+libnet_la-vars.lo: vars.c
+ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnet_la_CFLAGS) $(CFLAGS) -c -o libnet_la-vars.lo `test -f 'vars.c' || echo '$(srcdir)/'`vars.c
mostlyclean-libtool:
-rm -f *.lo
diff --git a/newlib/libc/sys/linux/net/XXX-lookup.c b/newlib/libc/sys/linux/net/XXX-lookup.c
deleted file mode 100644
index da0e6f451..000000000
--- a/newlib/libc/sys/linux/net/XXX-lookup.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include "nsswitch.h"
-
-/*******************************************************************\
-|* Here we assume one symbol to be defined: *|
-|* *|
-|* DATABASE_NAME - name of the database the function accesses *|
-|* (e.g., hosts, services, ...) *|
-|* *|
-|* One additional symbol may optionally be defined: *|
-|* *|
-|* ALTERNATE_NAME - name of another service which is examined in *|
-|* case DATABASE_NAME is not found *|
-|* *|
-|* DEFAULT_CONFIG - string for default conf (e.g. "dns files") *|
-|* *|
-\*******************************************************************/
-
-#define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
-#define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post)
-#define CONCAT3_2(Pre, Name, Post) Pre##Name##Post
-
-#define DATABASE_NAME_SYMBOL CONCAT3_1 (__nss_, DATABASE_NAME, _database)
-#define DATABASE_NAME_STRING STRINGIFY1 (DATABASE_NAME)
-#define STRINGIFY1(Name) STRINGIFY2 (Name)
-#define STRINGIFY2(Name) #Name
-
-#ifdef ALTERNATE_NAME
-#define ALTERNATE_NAME_STRING STRINGIFY1 (ALTERNATE_NAME)
-#else
-#define ALTERNATE_NAME_STRING NULL
-#endif
-
-#ifndef DEFAULT_CONFIG
-#define DEFAULT_CONFIG NULL
-#endif
-
-service_user *DATABASE_NAME_SYMBOL attribute_hidden;
-
-extern int DB_LOOKUP_FCT (service_user **ni, const char *fct_name,
- void **fctp) internal_function;
-libc_hidden_proto (DB_LOOKUP_FCT)
-
-int
-internal_function
-DB_LOOKUP_FCT (service_user **ni, const char *fct_name, void **fctp)
-{
- if (DATABASE_NAME_SYMBOL == NULL
- && __nss_database_lookup (DATABASE_NAME_STRING, ALTERNATE_NAME_STRING,
- DEFAULT_CONFIG, &DATABASE_NAME_SYMBOL) < 0)
- return -1;
-
- *ni = DATABASE_NAME_SYMBOL;
-
- return __nss_lookup (ni, fct_name, fctp);
-}
-libc_hidden_def (DB_LOOKUP_FCT)
diff --git a/newlib/libc/sys/linux/net/addr2ascii.3 b/newlib/libc/sys/linux/net/addr2ascii.3
new file mode 100644
index 000000000..10b1ac7f9
--- /dev/null
+++ b/newlib/libc/sys/linux/net/addr2ascii.3
@@ -0,0 +1,222 @@
+.\"
+.\" Copyright 1996 Massachusetts Institute of Technology
+.\"
+.\" Permission to use, copy, modify, and distribute this software and
+.\" its documentation for any purpose and without fee is hereby
+.\" granted, provided that both the above copyright notice and this
+.\" permission notice appear in all copies, that both the above
+.\" copyright notice and this permission notice appear in all
+.\" supporting documentation, and that the name of M.I.T. not be used
+.\" in advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission. M.I.T. makes
+.\" no representations about the suitability of this software for any
+.\" purpose. It is provided "as is" without express or implied
+.\" warranty.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
+.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
+.\" SHALL M.I.T. 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.
+.\"
+.\" $ANA: addr2ascii.3,v 1.1 1996/06/13 18:41:46 wollman Exp $
+.\" $FreeBSD: src/lib/libc/net/addr2ascii.3,v 1.12 2001/10/01 16:08:55 ru Exp $
+.\"
+.Dd June 13, 1996
+.Dt ADDR2ASCII 3
+.Os
+.Sh NAME
+.Nm addr2ascii ,
+.Nm ascii2addr
+.Nd Generic address formatting routines
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.In arpa/inet.h
+.Ft "char *"
+.Fn addr2ascii "int af" "const void *addrp" "int len" "char *buf"
+.Ft int
+.Fn ascii2addr "int af" "const char *ascii" "void *result"
+.Sh DESCRIPTION
+The routines
+.Fn addr2ascii
+and
+.Fn ascii2addr
+are used to convert network addresses between binary form and a
+printable form appropriate to the address family. Both functions take
+an
+.Fa af
+argument, specifying the address family to be used in the conversion
+process.
+(Currently, only the
+.Dv AF_INET
+and
+.Dv AF_LINK
+address families are supported.)
+.Pp
+The
+.Fn addr2ascii
+function
+is used to convert binary, network-format addresses into printable
+form. In addition to
+.Fa af ,
+there are three other arguments. The
+.Fa addrp
+argument is a pointer to the network address to be converted.
+The
+.Fa len
+argument is the length of the address. The
+.Fa buf
+argument is an optional pointer to a caller-allocated buffer to hold
+the result; if a null pointer is passed,
+.Fn addr2ascii
+uses a statically-allocated buffer.
+.Pp
+The
+.Fn ascii2addr
+function performs the inverse operation to
+.Fn addr2ascii .
+In addition to
+.Fa af ,
+it takes two parameters,
+.Fa ascii
+and
+.Fa result .
+The
+.Fa ascii
+parameter is a pointer to the string which is to be converted into
+binary. The
+.Fa result
+parameter is a pointer to an appropriate network address structure for
+the specified family.
+.Pp
+The following gives the appropriate structure to use for binary
+addresses in the specified family:
+.Pp
+.Bl -tag -width AF_INETxxxx -compact
+.It Dv AF_INET
+.Li struct in_addr
+(in
+.Aq Pa netinet/in.h )
+.It Dv AF_LINK
+.Li struct sockaddr_dl
+(in
+.Aq Pa net/if_dl.h )
+.\" .It Dv AF_INET6
+.\" .Li struct in6_addr
+.\" (in
+.\" .Aq Pa netinet6/in6.h )
+.El
+.Sh RETURN VALUES
+The
+.Fn addr2ascii
+function returns the address of the buffer it was passed, or a static
+buffer if the a null pointer was passed; on failure, it returns a null
+pointer.
+The
+.Fn ascii2addr
+function returns the length of the binary address in bytes, or -1 on
+failure.
+.Sh EXAMPLES
+The
+.Xr inet 3
+functions
+.Fn inet_ntoa
+and
+.Fn inet_aton
+could be implemented thusly:
+.Bd -literal -offset indent
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+char *
+inet_ntoa(struct in_addr addr)
+{
+ return addr2ascii(AF_INET, &addr, sizeof addr, 0);
+}
+
+int
+inet_aton(const char *ascii, struct in_addr *addr)
+{
+ return (ascii2addr(AF_INET, ascii, addr)
+ == sizeof(*addr));
+}
+.Ed
+.Pp
+In actuality, this cannot be done because
+.Fn addr2ascii
+and
+.Fn ascii2addr
+are implemented in terms of the
+.Xr inet 3
+functions, rather than the other way around.
+.Sh ERRORS
+When a failure is returned,
+.Li errno
+is set to one of the following values:
+.Bl -tag -width Er
+.It Bq Er ENAMETOOLONG
+The
+.Fn addr2ascii
+routine was passed a
+.Fa len
+parameter which was inappropriate for the address family given by
+.Fa af .
+.It Bq Er EPROTONOSUPPORT
+Either routine was passed an
+.Fa af
+parameter other than
+.Dv AF_INET
+or
+.Dv AF_LINK .
+.It Bq Er EINVAL
+The string passed to
+.Fn ascii2addr
+was improperly formatted for address family
+.Fa af .
+.El
+.Sh SEE ALSO
+.Xr inet 3 ,
+.Xr linkaddr 3 ,
+.Xr inet 4
+.Sh HISTORY
+An interface close to this one was originally suggested by Craig
+Partridge. This particular interface originally appeared in the
+.Tn INRIA
+.Tn IPv6
+implementation.
+.Sh AUTHORS
+Code and documentation by
+.An Garrett A. Wollman ,
+MIT Laboratory for Computer Science.
+.Sh BUGS
+The original implementations supported IPv6. This support should
+eventually be resurrected. The
+.Tn NRL
+implementation also included support for the
+.Dv AF_ISO
+and
+.Dv AF_NS
+address families.
+.Pp
+The genericity of this interface is somewhat questionable. A truly
+generic interface would provide a means for determining the length of
+the buffer to be used so that it could be dynamically allocated, and
+would always require a
+.Dq Li "struct sockaddr"
+to hold the binary address. Unfortunately, this is incompatible with existing
+practice. This limitation means that a routine for printing network
+addresses from arbitrary address families must still have internal
+knowledge of the maximum buffer length needed and the appropriate part
+of the address to use as the binary address.
diff --git a/newlib/libc/sys/linux/net/alias-lookup.c b/newlib/libc/sys/linux/net/alias-lookup.c
deleted file mode 100644
index 6aba466b3..000000000
--- a/newlib/libc/sys/linux/net/alias-lookup.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME aliases
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/aliases.h b/newlib/libc/sys/linux/net/aliases.h
deleted file mode 100644
index 58dd8f0fc..000000000
--- a/newlib/libc/sys/linux/net/aliases.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _ALIASES_H
-#define _ALIASES_H 1
-
-#include <features.h>
-
-#include <sys/types.h>
-
-
-__BEGIN_DECLS
-
-/* Structure to represent one entry of the alias data base. */
-struct aliasent
- {
- char *alias_name;
- size_t alias_members_len;
- char **alias_members;
- int alias_local;
- };
-
-
-/* Open alias data base files. */
-extern void setaliasent (void) __THROW;
-
-/* Close alias data base files. */
-extern void endaliasent (void) __THROW;
-
-/* Get the next entry from the alias data base. */
-extern struct aliasent *getaliasent (void) __THROW;
-
-/* Get the next entry from the alias data base and put it in RESULT_BUF. */
-extern int getaliasent_r (struct aliasent *__restrict __result_buf,
- char *__restrict __buffer, size_t __buflen,
- struct aliasent **__restrict __result) __THROW;
-
-/* Get alias entry corresponding to NAME. */
-extern struct aliasent *getaliasbyname (__const char *__name) __THROW;
-
-/* Get alias entry corresponding to NAME and put it in RESULT_BUF. */
-extern int getaliasbyname_r (__const char *__restrict __name,
- struct aliasent *__restrict __result_buf,
- char *__restrict __buffer, size_t __buflen,
- struct aliasent **__restrict __result) __THROW;
-
-__END_DECLS
-
-#endif /* aliases.h */
diff --git a/newlib/libc/sys/linux/net/base64.c b/newlib/libc/sys/linux/net/base64.c
index 76c966fc3..35f7d867b 100644
--- a/newlib/libc/sys/linux/net/base64.c
+++ b/newlib/libc/sys/linux/net/base64.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -40,11 +40,10 @@
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie Exp $";
-#endif /* not lint */
+#include <sys/cdefs.h>
#include <sys/types.h>
+#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
@@ -58,8 +57,6 @@ static const char rcsid[] = "$BINDId: base64.c,v 8.7 1999/10/13 16:39:33 vixie E
#include <stdlib.h>
#include <string.h>
-#include "libc-symbols.h"
-
#define Assert(Cond) if (!(Cond)) abort()
static const char Base64[] =
@@ -114,9 +111,9 @@ static const char Pad64 = '=';
end of the data is performed using the '=' character.
Since all base64 input is an integral number of octets, only the
- -------------------------------------------------
+ -------------------------------------------------
following cases can arise:
-
+
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters
@@ -158,14 +155,14 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
-
+
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
-
+
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
@@ -188,7 +185,6 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
target[datalength] = '\0'; /* Returned value doesn't count \0. */
return (datalength);
}
-libresolv_hidden_def (b64_ntop)
/* skips all whitespace anywhere.
converts characters, four at a time, starting at (or after)
@@ -209,7 +205,7 @@ b64_pton(src, target, targsize)
tarindex = 0;
while ((ch = *src++) != '\0') {
- if (isspace(ch)) /* Skip whitespace anywhere. */
+ if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */
continue;
if (ch == Pad64)
@@ -279,7 +275,7 @@ b64_pton(src, target, targsize)
case 2: /* Valid, means one byte of info */
/* Skip any number of spaces. */
for ((void)NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
+ if (!isspace((unsigned char)ch))
break;
/* Make sure there is another trailing = sign. */
if (ch != Pad64)
@@ -294,7 +290,7 @@ b64_pton(src, target, targsize)
* whitespace after it?
*/
for ((void)NULL; ch != '\0'; ch = *src++)
- if (!isspace(ch))
+ if (!isspace((unsigned char)ch))
return (-1);
/*
diff --git a/newlib/libc/sys/linux/net/bindresvport.c b/newlib/libc/sys/linux/net/bindresvport.c
new file mode 100644
index 000000000..7b595b4dc
--- /dev/null
+++ b/newlib/libc/sys/linux/net/bindresvport.c
@@ -0,0 +1,160 @@
+/* $NetBSD: bindresvport.c,v 1.19 2000/07/06 03:03:59 christos Exp $ */
+
+/*
+ * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+ * unrestricted use provided that this legend is included on all tape
+ * media and as a part of the software program in whole or part. Users
+ * may copy or modify Sun RPC without charge, but are not authorized
+ * to license or distribute it to anyone else except as part of a product or
+ * program developed by the user.
+ *
+ * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
+ * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
+ *
+ * Sun RPC is provided with no support and without any obligation on the
+ * part of Sun Microsystems, Inc. to assist in its use, correction,
+ * modification or enhancement.
+ *
+ * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
+ * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
+ * OR ANY PART THEREOF.
+ *
+ * In no event will Sun Microsystems, Inc. be liable for any lost revenue
+ * or profits or other special, indirect and consequential damages, even if
+ * Sun has been advised of the possibility of such damages.
+ *
+ * Sun Microsystems, Inc.
+ * 2550 Garcia Avenue
+ * Mountain View, California 94043
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+/*static char *sccsid = "from: @(#)bindresvport.c 1.8 88/02/08 SMI";*/
+/*static char *sccsid = "from: @(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC";*/
+/*from: OpenBSD: bindresvport.c,v 1.7 1996/07/30 16:25:47 downsj Exp */
+#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+/*
+ * Copyright (c) 1987 by Sun Microsystems, Inc.
+ *
+ * Portions Copyright(C) 1996, Jason Downs. All rights reserved.
+ */
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <rpc/rpc.h>
+
+#include <string.h>
+#include "un-namespace.h"
+
+/*
+ * Bind a socket to a privileged IP port
+ */
+int
+bindresvport(sd, sin)
+ int sd;
+ struct sockaddr_in *sin;
+{
+ return bindresvport_sa(sd, (struct sockaddr *)sin);
+}
+
+/*
+ * Bind a socket to a privileged IP port
+ */
+int
+bindresvport_sa(sd, sa)
+ int sd;
+ struct sockaddr *sa;
+{
+ int old, error, af;
+ struct sockaddr_storage myaddr;
+ struct sockaddr_in *sin;
+#ifdef INET6
+ struct sockaddr_in6 *sin6;
+#endif
+ int proto, portrange, portlow;
+ u_int16_t *portp;
+ socklen_t salen;
+
+ if (sa == NULL) {
+ salen = sizeof(myaddr);
+ sa = (struct sockaddr *)&myaddr;
+
+ if (getsockname(sd, sa, &salen) == -1)
+ return -1; /* errno is correctly set */
+
+ af = sa->sa_family;
+ memset(sa, 0, salen);
+ } else
+ af = sa->sa_family;
+
+ switch (af) {
+ case AF_INET:
+ proto = IPPROTO_IP;
+ portrange = IP_PORTRANGE;
+ portlow = IP_PORTRANGE_LOW;
+ sin = (struct sockaddr_in *)sa;
+ salen = sizeof(struct sockaddr_in);
+ portp = &sin->sin_port;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ proto = IPPROTO_IPV6;
+ portrange = IPV6_PORTRANGE;
+ portlow = IPV6_PORTRANGE_LOW;
+ sin6 = (struct sockaddr_in6 *)sa;
+ salen = sizeof(struct sockaddr_in6);
+ portp = &sin6->sin6_port;
+ break;
+#endif
+ default:
+ errno = EPFNOSUPPORT;
+ return (-1);
+ }
+ sa->sa_family = af;
+
+ if (*portp == 0) {
+ socklen_t oldlen = sizeof(old);
+
+ error = getsockopt(sd, proto, portrange, &old, &oldlen);
+ if (error < 0)
+ return (error);
+
+ error = setsockopt(sd, proto, portrange, &portlow,
+ sizeof(portlow));
+ if (error < 0)
+ return (error);
+ }
+
+ error = bind(sd, sa, salen);
+
+ if (*portp == 0) {
+ int saved_errno = errno;
+
+ if (error < 0) {
+ if (setsockopt(sd, proto, portrange, &old,
+ sizeof(old)) < 0)
+ errno = saved_errno;
+ return (error);
+ }
+
+ if (sa != (struct sockaddr *)&myaddr) {
+ /* Hmm, what did the kernel assign? */
+ if (getsockname(sd, sa, &salen) < 0)
+ errno = saved_errno;
+ return (error);
+ }
+ }
+ return (error);
+}
diff --git a/newlib/libc/sys/linux/net/byteorder.3 b/newlib/libc/sys/linux/net/byteorder.3
new file mode 100644
index 000000000..062ac9d70
--- /dev/null
+++ b/newlib/libc/sys/linux/net/byteorder.3
@@ -0,0 +1,84 @@
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" @(#)byteorder.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/byteorder.3,v 1.9 2001/12/08 19:06:23 ru Exp $
+.\"
+.Dd June 4, 1993
+.Dt BYTEORDER 3
+.Os
+.Sh NAME
+.Nm htonl ,
+.Nm htons ,
+.Nm ntohl ,
+.Nm ntohs
+.Nd convert values between host and network byte order
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In arpa/inet.h
+.Ft uint32_t
+.Fn htonl "uint32_t hostlong"
+.Ft uint16_t
+.Fn htons "uint16_t hostshort"
+.Ft uint32_t
+.Fn ntohl "uint32_t netlong"
+.Ft uint16_t
+.Fn ntohs "uint16_t netshort"
+.Sh DESCRIPTION
+These routines convert 16 and 32 bit quantities between network
+byte order and host byte order.
+On machines which have a byte order which is the same as the network
+order, routines are defined as null macros.
+.Pp
+These routines are most often used in conjunction with Internet
+addresses and ports as returned by
+.Xr gethostbyname 3
+and
+.Xr getservent 3 .
+.Sh SEE ALSO
+.Xr gethostbyname 3 ,
+.Xr getservent 3
+.Sh STANDARDS
+The
+.Nm byteorder
+functions are expected to conform with
+.St -p1003.1-2001 .
+.Sh HISTORY
+The
+.Nm byteorder
+functions appeared in
+.Bx 4.2 .
+.Sh BUGS
+On the
+.Tn VAX
+bytes are handled backwards from most everyone else in
+the world. This is not expected to be fixed in the near future.
diff --git a/newlib/libc/sys/linux/net/check_pf.c b/newlib/libc/sys/linux/net/check_pf.c
deleted file mode 100644
index 086879e4e..000000000
--- a/newlib/libc/sys/linux/net/check_pf.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* Determine protocol families for which interfaces exist. Linux version.
- Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdint.h>
-#include <ifaddrs.h>
-#include <netdb.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <sys/socket.h>
-
-#include <asm/types.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-
-#include <stdbool.h>
-#include <sys/uio.h>
-
-#include "config.h"
-#include "local.h"
-
-#define __ASSUME_NETLINK_SUPPORT 1
-
-static int
-make_request (int fd, pid_t pid, bool *seen_ipv4, bool *seen_ipv6)
-{
- struct
- {
- struct nlmsghdr nlh;
- struct rtgenmsg g;
- } req;
- struct sockaddr_nl nladdr;
-
- req.nlh.nlmsg_len = sizeof (req);
- req.nlh.nlmsg_type = RTM_GETADDR;
- req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
- req.nlh.nlmsg_pid = 0;
- req.nlh.nlmsg_seq = time (NULL);
- req.g.rtgen_family = AF_UNSPEC;
-
- memset (&nladdr, '\0', sizeof (nladdr));
- nladdr.nl_family = AF_NETLINK;
-
- if (TEMP_FAILURE_RETRY (sendto (fd, (void *) &req, sizeof (req), 0,
- (struct sockaddr *) &nladdr,
- sizeof (nladdr))) < 0)
- return -1;
-
- *seen_ipv4 = false;
- *seen_ipv6 = false;
-
- bool done = false;
- char buf[4096];
- struct iovec iov = { buf, sizeof (buf) };
-
- do
- {
- struct msghdr msg =
- {
- (void *) &nladdr, sizeof (nladdr),
- &iov, 1,
- NULL, 0,
- 0
- };
-
- ssize_t read_len = TEMP_FAILURE_RETRY (recvmsg (fd, &msg, 0));
- if (read_len < 0)
- return -1;
-
- if (msg.msg_flags & MSG_TRUNC)
- return -1;
-
- struct nlmsghdr *nlmh;
- for (nlmh = (struct nlmsghdr *) buf;
- NLMSG_OK (nlmh, (size_t) read_len);
- nlmh = (struct nlmsghdr *) NLMSG_NEXT (nlmh, read_len))
- {
- if (nladdr.nl_pid != 0 || (pid_t) nlmh->nlmsg_pid != pid
- || nlmh->nlmsg_seq != req.nlh.nlmsg_seq)
- continue;
-
- if (nlmh->nlmsg_type == RTM_NEWADDR)
- {
- struct ifaddrmsg *ifam = (struct ifaddrmsg *) NLMSG_DATA (nlmh);
-
- switch (ifam->ifa_family)
- {
- case AF_INET:
- *seen_ipv4 = true;
- break;
- case AF_INET6:
- *seen_ipv6 = true;
- break;
- default:
- /* Ignore. */
- break;
- }
- }
- else if (nlmh->nlmsg_type == NLMSG_DONE)
- /* We found the end, leave the loop. */
- done = true;
- else ;
- }
- }
- while (! done);
-
- close (fd);
-
- return 0;
-}
-
-
-/* We don't know if we have NETLINK support compiled in in our
- Kernel. */
-#if __ASSUME_NETLINK_SUPPORT == 0
-/* Define in ifaddrs.h. */
-extern int __no_netlink_support attribute_hidden;
-#else
-# define __no_netlink_support 0
-#endif
-
-
-void
-attribute_hidden
-__check_pf (bool *seen_ipv4, bool *seen_ipv6)
-{
- if (! __no_netlink_support)
- {
- int fd = socket (PF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
-
- struct sockaddr_nl nladdr;
- memset (&nladdr, '\0', sizeof (nladdr));
- nladdr.nl_family = AF_NETLINK;
-
- socklen_t addr_len = sizeof (nladdr);
-
- if (fd >= 0
- && bind (fd, (struct sockaddr *) &nladdr, sizeof (nladdr)) == 0
- && getsockname (fd, (struct sockaddr *) &nladdr, &addr_len) == 0
- && make_request (fd, nladdr.nl_pid, seen_ipv4, seen_ipv6) == 0)
- /* It worked. */
- return;
-
- if (fd >= 0)
- close (fd);
-
-#if __ASSUME_NETLINK_SUPPORT == 0
- /* Remember that there is no netlink support. */
- __no_netlink_support = 1;
-#else
- /* We cannot determine what interfaces are available. Be
- pessimistic. */
- *seen_ipv4 = true;
- *seen_ipv6 = true;
-#endif
- }
-
-#if __ASSUME_NETLINK_SUPPORT == 0
- /* No netlink. Get the interface list via getifaddrs. */
- struct ifaddrs *ifa = NULL;
- if (getifaddrs (&ifa) != 0)
- {
- /* We cannot determine what interfaces are available. Be
- pessimistic. */
- *seen_ipv4 = true;
- *seen_ipv6 = true;
- return;
- }
-
- *seen_ipv4 = false;
- *seen_ipv6 = false;
-
- struct ifaddrs *runp;
- for (runp = ifa; runp != NULL; runp = runp->ifa_next)
- if (runp->ifa_addr->sa_family == PF_INET)
- *seen_ipv4 = true;
- else if (runp->ifa_addr->sa_family == PF_INET6)
- *seen_ipv6 = true;
-
- (void) freeifaddrs (ifa);
-#endif
-}
diff --git a/newlib/libc/sys/linux/net/databases.def b/newlib/libc/sys/linux/net/databases.def
deleted file mode 100644
index 27c15fc04..000000000
--- a/newlib/libc/sys/linux/net/databases.def
+++ /dev/null
@@ -1,40 +0,0 @@
-/* List of all databases defined for the NSS in GNU C Library.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* This list must be kept sorted!!! */
-
-DEFINE_DATABASE (aliases)
-DEFINE_DATABASE (ethers)
-DEFINE_DATABASE (group)
-DEFINE_DATABASE (hosts)
-DEFINE_DATABASE (netgroup)
-DEFINE_DATABASE (networks)
-DEFINE_DATABASE (passwd)
-DEFINE_DATABASE (protocols)
-DEFINE_DATABASE (publickey)
-DEFINE_DATABASE (rpc)
-DEFINE_DATABASE (services)
-DEFINE_DATABASE (shadow)
-
-/*
- Local Variables:
- mode:C
- End:
- */
diff --git a/newlib/libc/sys/linux/net/digits_dots.c b/newlib/libc/sys/linux/net/digits_dots.c
deleted file mode 100644
index 9576dd53b..000000000
--- a/newlib/libc/sys/linux/net/digits_dots.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* Copyright (C) 1997, 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by H.J. Lu <hjl@gnu.ai.mit.edu>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <assert.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <wctype.h>
-#include <resolv.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include "nsswitch.h"
-
-#ifdef USE_NSCD
-# define inet_aton __inet_aton
-# include <nscd/nscd_proto.h>
-#endif
-
-int
-__nss_hostname_digits_dots (const char *name, struct hostent *resbuf,
- char **buffer, size_t *buffer_size,
- size_t buflen, struct hostent **result,
- enum nss_status *status, int af, int *h_errnop)
-{
- int save;
-
- /* We have to test for the use of IPv6 which can only be done by
- examining `_res'. */
- if (__res_maybe_init (&_res, 0) == -1)
- {
- if (h_errnop)
- *h_errnop = NETDB_INTERNAL;
- *result = NULL;
- return -1;
- }
-
- /*
- * disallow names consisting only of digits/dots, unless
- * they end in a dot.
- */
- if (isdigit (name[0]) || isxdigit (name[0]) || name[0] == ':')
- {
- const char *cp;
- char *hostname;
- typedef unsigned char host_addr_t[16];
- host_addr_t *host_addr;
- typedef char *host_addr_list_t[2];
- host_addr_list_t *h_addr_ptrs;
- char **h_alias_ptr;
- size_t size_needed;
- int addr_size;
-
- switch (af)
- {
- case AF_INET:
- addr_size = INADDRSZ;
- break;
-
- case AF_INET6:
- addr_size = IN6ADDRSZ;
- break;
-
- default:
- af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET;
- addr_size = af == AF_INET6 ? IN6ADDRSZ : INADDRSZ;
- break;
- }
-
- size_needed = (sizeof (*host_addr)
- + sizeof (*h_addr_ptrs) + strlen (name) + 1);
-
- if (buffer_size == NULL)
- {
- if (buflen < size_needed)
- {
- if (h_errnop != NULL)
- *h_errnop = TRY_AGAIN;
- __set_errno (ERANGE);
- goto done;
- }
- }
- else if (buffer_size != NULL && *buffer_size < size_needed)
- {
- char *new_buf;
- *buffer_size = size_needed;
- new_buf = (char *) realloc (*buffer, *buffer_size);
-
- if (new_buf == NULL)
- {
- save = errno;
- free (*buffer);
- *buffer = NULL;
- *buffer_size = 0;
- __set_errno (save);
- if (h_errnop != NULL)
- *h_errnop = TRY_AGAIN;
- *result = NULL;
- goto done;
- }
- *buffer = new_buf;
- }
-
- memset (*buffer, '\0', size_needed);
-
- host_addr = (host_addr_t *) *buffer;
- h_addr_ptrs = (host_addr_list_t *)
- ((char *) host_addr + sizeof (*host_addr));
- h_alias_ptr = (char **) ((char *) h_addr_ptrs + sizeof (*h_addr_ptrs));
- hostname = (char *) h_alias_ptr + sizeof (*h_alias_ptr);
-
- if (isdigit (name[0]))
- {
- for (cp = name;; ++cp)
- {
- if (*cp == '\0')
- {
- int ok;
-
- if (*--cp == '.')
- break;
-
- /* All-numeric, no dot at the end. Fake up a hostent as if
- we'd actually done a lookup. What if someone types
- 255.255.255.255? The test below will succeed
- spuriously... ??? */
- if (af == AF_INET)
- ok = __inet_aton (name, (struct in_addr *) host_addr);
- else
- {
- assert (af == AF_INET6);
- ok = inet_pton (af, name, host_addr) > 0;
- }
- if (! ok)
- {
- *h_errnop = HOST_NOT_FOUND;
- if (buffer_size)
- *result = NULL;
- goto done;
- }
-
- resbuf->h_name = strcpy (hostname, name);
- h_alias_ptr[0] = NULL;
- resbuf->h_aliases = h_alias_ptr;
- (*h_addr_ptrs)[0] = (char *) host_addr;
- (*h_addr_ptrs)[1] = NULL;
- resbuf->h_addr_list = *h_addr_ptrs;
- if (af == AF_INET && (_res.options & RES_USE_INET6))
- {
- /* We need to change the IP v4 address into the
- IP v6 address. */
- char tmp[INADDRSZ];
- char *p = (char *) host_addr;
- int i;
-
- /* Save a copy of the IP v4 address. */
- memcpy (tmp, host_addr, INADDRSZ);
- /* Mark this ipv6 addr as a mapped ipv4. */
- for (i = 0; i < 10; i++)
- *p++ = 0x00;
- *p++ = 0xff;
- *p++ = 0xff;
- /* Copy the IP v4 address. */
- memcpy (p, tmp, INADDRSZ);
- resbuf->h_addrtype = AF_INET6;
- resbuf->h_length = IN6ADDRSZ;
- }
- else
- {
- resbuf->h_addrtype = af;
- resbuf->h_length = addr_size;
- }
- if (h_errnop != NULL)
- *h_errnop = NETDB_SUCCESS;
- if (buffer_size == NULL)
- *status = NSS_STATUS_SUCCESS;
- else
- *result = resbuf;
- goto done;
- }
-
- if (!isdigit (*cp) && *cp != '.')
- break;
- }
- }
-
- if ((isxdigit (name[0]) && strchr (name, ':') != NULL) || name[0] == ':')
- {
- const char *cp;
- char *hostname;
- typedef unsigned char host_addr_t[16];
- host_addr_t *host_addr;
- typedef char *host_addr_list_t[2];
- host_addr_list_t *h_addr_ptrs;
- size_t size_needed;
- int addr_size;
-
- switch (af)
- {
- default:
- af = (_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET;
- if (af == AF_INET6)
- {
- addr_size = IN6ADDRSZ;
- break;
- }
- /* FALLTHROUGH */
-
- case AF_INET:
- /* This is not possible. We cannot represent an IPv6 address
- in an `struct in_addr' variable. */
- *h_errnop = HOST_NOT_FOUND;
- *result = NULL;
- goto done;
-
- case AF_INET6:
- addr_size = IN6ADDRSZ;
- break;
- }
-
- size_needed = (sizeof (*host_addr)
- + sizeof (*h_addr_ptrs) + strlen (name) + 1);
-
- if (buffer_size == NULL && buflen < size_needed)
- {
- if (h_errnop != NULL)
- *h_errnop = TRY_AGAIN;
- __set_errno (ERANGE);
- goto done;
- }
- else if (buffer_size != NULL && *buffer_size < size_needed)
- {
- char *new_buf;
- *buffer_size = size_needed;
- new_buf = realloc (*buffer, *buffer_size);
-
- if (new_buf == NULL)
- {
- save = errno;
- free (*buffer);
- __set_errno (save);
- *buffer = NULL;
- *buffer_size = 0;
- *result = NULL;
- goto done;
- }
- *buffer = new_buf;
- }
-
- memset (*buffer, '\0', size_needed);
-
- host_addr = (host_addr_t *) *buffer;
- h_addr_ptrs = (host_addr_list_t *)
- ((char *) host_addr + sizeof (*host_addr));
- hostname = (char *) h_addr_ptrs + sizeof (*h_addr_ptrs);
-
- for (cp = name;; ++cp)
- {
- if (!*cp)
- {
- if (*--cp == '.')
- break;
-
- /* All-IPv6-legal, no dot at the end. Fake up a
- hostent as if we'd actually done a lookup. */
- if (inet_pton (AF_INET6, name, host_addr) <= 0)
- {
- *h_errnop = HOST_NOT_FOUND;
- if (buffer_size)
- *result = NULL;
- goto done;
- }
-
- resbuf->h_name = strcpy (hostname, name);
- h_alias_ptr[0] = NULL;
- resbuf->h_aliases = h_alias_ptr;
- (*h_addr_ptrs)[0] = (char *) host_addr;
- (*h_addr_ptrs)[1] = (char *) 0;
- resbuf->h_addr_list = *h_addr_ptrs;
- resbuf->h_addrtype = AF_INET6;
- resbuf->h_length = addr_size;
- *h_errnop = NETDB_SUCCESS;
- if (buffer_size == NULL)
- *status = NSS_STATUS_SUCCESS;
- else
- *result = resbuf;
- goto done;
- }
-
- if (!isxdigit (*cp) && *cp != ':' && *cp != '.')
- break;
- }
- }
- }
-
- return 0;
-
-done:
- return 1;
-}
-libc_hidden_def (__nss_hostname_digits_dots)
diff --git a/newlib/libc/sys/linux/net/ether_addr.c b/newlib/libc/sys/linux/net/ether_addr.c
new file mode 100644
index 000000000..7d2b19f69
--- /dev/null
+++ b/newlib/libc/sys/linux/net/ether_addr.c
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 1995
+ * Bill Paul <wpaul@ctr.columbia.edu>. 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 Bill Paul.
+ * 4. Neither the name of the author nor the names of any co-contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Bill Paul 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.
+ *
+ * ethernet address conversion and lookup routines
+ *
+ * Written by Bill Paul <wpaul@ctr.columbia.edu>
+ * Center for Telecommunications Research
+ * Columbia University, New York City
+ */
+
+#include <sys/cdefs.h>
+
+#include <stdio.h>
+#include <paths.h>
+#include <sys/types.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <net/ethernet.h>
+#ifdef YP
+#include <rpc/rpc.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+#endif
+
+#ifndef _PATH_ETHERS
+#define _PATH_ETHERS "/etc/ethers"
+#endif
+
+/*
+ * Parse a string of text containing an ethernet address and hostname
+ * and separate it into its component parts.
+ */
+int
+ether_line(l, e, hostname)
+ const char *l;
+ struct ether_addr *e;
+ char *hostname;
+{
+ int i, o[6];
+
+ i = sscanf(l, "%x:%x:%x:%x:%x:%x %s", &o[0], &o[1], &o[2],
+ &o[3], &o[4], &o[5],
+ hostname);
+ if (i != 7)
+ return (i);
+
+ for (i=0; i<6; i++)
+ e->octet[i] = o[i];
+ return (0);
+}
+
+/*
+ * Convert an ASCII representation of an ethernet address to
+ * binary form.
+ */
+struct
+ether_addr *ether_aton(a)
+ const char *a;
+{
+ int i;
+ static struct ether_addr o;
+ unsigned int o0, o1, o2, o3, o4, o5;
+
+ i = sscanf(a, "%x:%x:%x:%x:%x:%x", &o0, &o1, &o2, &o3, &o4, &o5);
+
+ if (i != 6)
+ return (NULL);
+
+ o.octet[0]=o0;
+ o.octet[1]=o1;
+ o.octet[2]=o2;
+ o.octet[3]=o3;
+ o.octet[4]=o4;
+ o.octet[5]=o5;
+
+ return ((struct ether_addr *)&o);
+}
+
+/*
+ * Convert a binary representation of an ethernet address to
+ * an ASCII string.
+ */
+char
+*ether_ntoa(n)
+ const struct ether_addr *n;
+{
+ int i;
+ static char a[18];
+
+ i = sprintf(a, "%02x:%02x:%02x:%02x:%02x:%02x",
+ n->octet[0], n->octet[1], n->octet[2],
+ n->octet[3], n->octet[4], n->octet[5]);
+ if (i < 17)
+ return (NULL);
+ return ((char *)&a);
+}
+
+/*
+ * Map an ethernet address to a hostname. Use either /etc/ethers or
+ * NIS/YP.
+ */
+int
+ether_ntohost(hostname, e)
+ char *hostname;
+ const struct ether_addr *e;
+{
+ FILE *fp;
+ char buf[BUFSIZ + 2];
+ struct ether_addr local_ether;
+ char local_host[MAXHOSTNAMELEN];
+#ifdef YP
+ char *result;
+ int resultlen;
+ char *ether_a;
+ char *yp_domain;
+#endif
+ if ((fp = fopen(_PATH_ETHERS, "r")) == NULL)
+ return (1);
+
+ while (fgets(buf,BUFSIZ,fp)) {
+ if (buf[0] == '#')
+ continue;
+#ifdef YP
+ if (buf[0] == '+') {
+ if (yp_get_default_domain(&yp_domain))
+ continue;
+ ether_a = ether_ntoa(e);
+ if (yp_match(yp_domain, "ethers.byaddr", ether_a,
+ strlen(ether_a), &result, &resultlen)) {
+ continue;
+ }
+ strncpy(buf, result, resultlen);
+ buf[resultlen] = '\0';
+ free(result);
+ }
+#endif
+ if (!ether_line(buf, &local_ether, local_host)) {
+ if (!memcmp((char *)&local_ether.octet[0],
+ (char *)&e->octet[0], 6)) {
+ /* We have a match */
+ strcpy(hostname, local_host);
+ fclose(fp);
+ return(0);
+ }
+ }
+ }
+ fclose(fp);
+ return (1);
+}
+
+/*
+ * Map a hostname to an ethernet address using /etc/ethers or
+ * NIS/YP.
+ */
+int
+ether_hostton(hostname, e)
+ const char *hostname;
+ struct ether_addr *e;
+{
+ FILE *fp;
+ char buf[BUFSIZ + 2];
+ struct ether_addr local_ether;
+ char local_host[MAXHOSTNAMELEN];
+#ifdef YP
+ char *result;
+ int resultlen;
+ char *yp_domain;
+#endif
+ if ((fp = fopen(_PATH_ETHERS, "r")) == NULL)
+ return (1);
+
+ while (fgets(buf,BUFSIZ,fp)) {
+ if (buf[0] == '#')
+ continue;
+#ifdef YP
+ if (buf[0] == '+') {
+ if (yp_get_default_domain(&yp_domain))
+ continue;
+ if (yp_match(yp_domain, "ethers.byname", hostname,
+ strlen(hostname), &result, &resultlen)) {
+ continue;
+ }
+ strncpy(buf, result, resultlen);
+ buf[resultlen] = '\0';
+ free(result);
+ }
+#endif
+ if (!ether_line(buf, &local_ether, local_host)) {
+ if (!strcmp(hostname, local_host)) {
+ /* We have a match */
+ bcopy((char *)&local_ether.octet[0],
+ (char *)&e->octet[0], 6);
+ fclose(fp);
+ return(0);
+ }
+ }
+ }
+ fclose(fp);
+ return (1);
+}
diff --git a/newlib/libc/sys/linux/net/ether_aton.c b/newlib/libc/sys/linux/net/ether_aton.c
deleted file mode 100644
index 071f329a6..000000000
--- a/newlib/libc/sys/linux/net/ether_aton.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netinet/ether.h>
-
-
-struct ether_addr *
-ether_aton (const char *asc)
-{
- static struct ether_addr result;
-
- return ether_aton_r (asc, &result);
-}
diff --git a/newlib/libc/sys/linux/net/ether_aton_r.c b/newlib/libc/sys/linux/net/ether_aton_r.c
deleted file mode 100644
index 1e9f15a12..000000000
--- a/newlib/libc/sys/linux/net/ether_aton_r.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Copyright (C) 1996,97,98,99,2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <netinet/ether.h>
-#include <netinet/if_ether.h>
-
-
-struct ether_addr *
-ether_aton_r (const char *asc, struct ether_addr *addr)
-{
- size_t cnt;
-
- for (cnt = 0; cnt < 6; ++cnt)
- {
- unsigned int number;
- char ch;
-
- ch = _tolower (*asc++);
- if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
- return NULL;
- number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
-
- ch = _tolower (*asc);
- if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch)))
- {
- ++asc;
- if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
- return NULL;
- number <<= 4;
- number += isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
-
- ch = *asc;
- if (cnt < 5 && ch != ':')
- return NULL;
- }
-
- /* Store result. */
- addr->ether_addr_octet[cnt] = (unsigned char) number;
-
- /* Skip ':'. */
- ++asc;
- }
-
- return addr;
-}
-libc_hidden_def (ether_aton_r)
diff --git a/newlib/libc/sys/linux/net/ether_hton.c b/newlib/libc/sys/linux/net/ether_hton.c
deleted file mode 100644
index a226d9f5f..000000000
--- a/newlib/libc/sys/linux/net/ether_hton.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (C) 1996, 1999, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <netinet/ether.h>
-#include <netinet/if_ether.h>
-#include <string.h>
-#include "etherent.h"
-
-#include "nsswitch.h"
-
-/* Type of the lookup function we need here. */
-typedef int (*lookup_function) (const char *, struct etherent *, char *, int,
- int *);
-
-/* The lookup function for the first entry of this service. */
-extern int __nss_ethers_lookup (service_user **nip, const char *name,
- void **fctp) internal_function;
-
-
-int
-ether_hostton (const char *hostname, struct ether_addr *addr)
-{
- static service_user *startp;
- static lookup_function start_fct;
- service_user *nip;
- union
- {
- lookup_function f;
- void *ptr;
- } fct;
- int no_more;
- enum nss_status status = NSS_STATUS_UNAVAIL;
- struct etherent etherent;
-
- if (startp == NULL)
- {
- no_more = __nss_ethers_lookup (&nip, "gethostton_r", &fct.ptr);
- if (no_more)
- startp = (service_user *) -1;
- else
- {
- startp = nip;
- start_fct = fct.f;
- }
- }
- else
- {
- fct.f = start_fct;
- no_more = (nip = startp) == (service_user *) -1;
- }
-
- while (no_more == 0)
- {
- char buffer[1024];
-
- status = (*fct.f) (hostname, &etherent, buffer, sizeof buffer, &errno);
-
- no_more = __nss_next (&nip, "gethostton_r", &fct.ptr, status, 0);
- }
-
- if (status == NSS_STATUS_SUCCESS)
- memcpy (addr, etherent.e_addr.ether_addr_octet,
- sizeof (struct ether_addr));
-
- return status == NSS_STATUS_SUCCESS ? 0 : -1;
-}
diff --git a/newlib/libc/sys/linux/net/ether_line.c b/newlib/libc/sys/linux/net/ether_line.c
deleted file mode 100644
index 8be593ea9..000000000
--- a/newlib/libc/sys/linux/net/ether_line.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright (C) 1996, 1999, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netinet/ether.h>
-#include <netinet/if_ether.h>
-
-
-int
-ether_line (const char *line, struct ether_addr *addr, char *hostname)
-{
- size_t cnt;
- char *cp;
-
- for (cnt = 0; cnt < 6; ++cnt)
- {
- unsigned int number;
- char ch;
-
- ch = _tolower (*line++);
- if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
- return -1;
- number = isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
-
- ch = _tolower (*line);
- if ((cnt < 5 && ch != ':') || (cnt == 5 && ch != '\0' && !isspace (ch)))
- {
- ++line;
- if ((ch < '0' || ch > '9') && (ch < 'a' || ch > 'f'))
- return -1;
- number <<= 4;
- number += isdigit (ch) ? (ch - '0') : (ch - 'a' + 10);
-
- ch = *line;
- if (cnt < 5 && ch != ':')
- return -1;
- }
-
- /* Store result. */
- addr->ether_addr_octet[cnt] = (unsigned char) number;
-
- /* Skip ':'. */
- if (ch != '\0')
- ++line;
- }
-
- /* Remove trailing white space. */
- cp = strchr (line, '#');
- if (cp == NULL)
- cp = line + strlen (line);
- while (cp > line && isspace (cp[-1]))
- --cp;
-
- if (cp == line)
- /* No hostname. */
- return -1;
-
- /* XXX This can cause trouble because the hostname might be too long
- but we have no possibility to check it here. */
- memcpy (hostname, line, cp - line);
- hostname [cp - line] = '\0';
-
- return 0;
-}
diff --git a/newlib/libc/sys/linux/net/ether_ntoa.c b/newlib/libc/sys/linux/net/ether_ntoa.c
deleted file mode 100644
index 815aebe0f..000000000
--- a/newlib/libc/sys/linux/net/ether_ntoa.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netinet/ether.h>
-#include <netinet/if_ether.h>
-
-
-char *
-ether_ntoa (const struct ether_addr *addr)
-{
- static char asc[18];
-
- return ether_ntoa_r (addr, asc);
-}
diff --git a/newlib/libc/sys/linux/net/ether_ntoa_r.c b/newlib/libc/sys/linux/net/ether_ntoa_r.c
deleted file mode 100644
index c5f347c63..000000000
--- a/newlib/libc/sys/linux/net/ether_ntoa_r.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Copyright (C) 1996,97,2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <netinet/ether.h>
-#include <netinet/if_ether.h>
-
-
-char *
-ether_ntoa_r (const struct ether_addr *addr, char *buf)
-{
- sprintf (buf, "%x:%x:%x:%x:%x:%x",
- addr->ether_addr_octet[0], addr->ether_addr_octet[1],
- addr->ether_addr_octet[2], addr->ether_addr_octet[3],
- addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
- return buf;
-}
-libc_hidden_def (ether_ntoa_r)
diff --git a/newlib/libc/sys/linux/net/ether_ntoh.c b/newlib/libc/sys/linux/net/ether_ntoh.c
deleted file mode 100644
index de8c41ef7..000000000
--- a/newlib/libc/sys/linux/net/ether_ntoh.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2001, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <netinet/ether.h>
-#include <netinet/if_ether.h>
-#include <string.h>
-#include "etherent.h"
-
-#include "nsswitch.h"
-
-
-/* Type of the lookup function we need here. */
-typedef int (*lookup_function) (const struct ether_addr *, struct etherent *,
- char *, size_t, int *);
-
-/* The lookup function for the first entry of this service. */
-extern int __nss_ethers_lookup (service_user **nip, const char *name,
- void **fctp) internal_function;
-
-
-int
-ether_ntohost (char *hostname, const struct ether_addr *addr)
-{
- static service_user *startp;
- static lookup_function start_fct;
- service_user *nip;
- union
- {
- lookup_function f;
- void *ptr;
- } fct;
- int no_more;
- enum nss_status status = NSS_STATUS_UNAVAIL;
- struct etherent etherent;
-
- if (startp == NULL)
- {
- no_more = __nss_ethers_lookup (&nip, "getntohost_r", &fct.ptr);
- if (no_more)
- startp = (service_user *) -1;
- else
- {
- startp = nip;
- start_fct = fct.f;
- }
- }
- else
- {
- fct.f = start_fct;
- no_more = (nip = startp) == (service_user *) -1;
- }
-
- while (no_more == 0)
- {
- char buffer[1024];
-
- status = (*fct.f) (addr, &etherent, buffer, sizeof buffer, &errno);
-
- no_more = __nss_next (&nip, "getntohost_r", &fct.ptr, status, 0);
- }
-
- if (status == NSS_STATUS_SUCCESS)
- /* XXX This is a potential cause of trouble because the size of
- the HOSTNAME buffer is not known but the interface does not
- provide this information. */
- strcpy (hostname, etherent.e_name);
-
- return status == NSS_STATUS_SUCCESS ? 0 : -1;
-}
diff --git a/newlib/libc/sys/linux/net/etherent.h b/newlib/libc/sys/linux/net/etherent.h
deleted file mode 100644
index 95a58b48c..000000000
--- a/newlib/libc/sys/linux/net/etherent.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Because the `ethers' lookup does not fit so well in the scheme we
- define a dummy struct here which helps us to use the available
- functions. */
-struct etherent
-{
- const char *e_name;
- struct ether_addr e_addr;
-};
-
diff --git a/newlib/libc/sys/linux/net/ethers-lookup.c b/newlib/libc/sys/linux/net/ethers-lookup.c
deleted file mode 100644
index d31ea841a..000000000
--- a/newlib/libc/sys/linux/net/ethers-lookup.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME ethers
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/ethers.3 b/newlib/libc/sys/linux/net/ethers.3
new file mode 100644
index 000000000..7b7866fd9
--- /dev/null
+++ b/newlib/libc/sys/linux/net/ethers.3
@@ -0,0 +1,197 @@
+.\" Copyright (c) 1995
+.\" Bill Paul <wpaul@ctr.columbia.edu>. 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 Bill Paul.
+.\" 4. Neither the name of the author nor the names of any co-contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Bill Paul 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.
+.\"
+.\" $FreeBSD: src/lib/libc/net/ethers.3,v 1.19 2002/01/14 16:59:00 ru Exp $
+.\"
+.Dd April 12, 1995
+.Dt ETHERS 3
+.Os
+.Sh NAME
+.Nm ethers ,
+.Nm ether_line ,
+.Nm ether_aton ,
+.Nm ether_ntoa ,
+.Nm ether_ntohost ,
+.Nm ether_hostton
+.Nd Ethernet address conversion and lookup routines
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In net/ethernet.h
+.Ft int
+.Fn ether_line "const char *l" "struct ether_addr *e" "char *hostname"
+.Ft struct ether_addr *
+.Fn ether_aton "const char *a"
+.Ft char *
+.Fn ether_ntoa "const struct ether_addr *n"
+.Ft int
+.Fn ether_ntohost "char *hostname" "const struct ether_addr *e"
+.Ft int
+.Fn ether_hostton "const char *hostname" "struct ether_addr *e"
+.Sh DESCRIPTION
+These functions operate on ethernet addresses using an
+.Ar ether_addr
+structure, which is defined in the header file
+.Aq Pa netinet/if_ether.h :
+.Bd -literal -offset indent
+/*
+ * The number of bytes in an ethernet (MAC) address.
+ */
+#define ETHER_ADDR_LEN 6
+
+/*
+ * Structure of a 48-bit Ethernet address.
+ */
+struct ether_addr {
+ u_char octet[ETHER_ADDR_LEN];
+};
+.Ed
+.Pp
+The function
+.Fn ether_line
+scans
+.Ar l ,
+an
+.Tn ASCII
+string in
+.Xr ethers 5
+format and sets
+.Ar e
+to the ethernet address specified in the string and
+.Ar h
+to the hostname.
+This function is used to parse lines from
+.Pa /etc/ethers
+into their component parts.
+.Pp
+The
+.Fn ether_aton
+function converts an
+.Tn ASCII
+representation of an ethernet address into an
+.Ar ether_addr
+structure.
+Likewise,
+.Fn ether_ntoa
+converts an ethernet address specified as an
+.Ar ether_addr
+structure into an
+.Tn ASCII
+string.
+.Pp
+The
+.Fn ether_ntohost
+and
+.Fn ether_hostton
+functions map ethernet addresses to their corresponding hostnames
+as specified in the
+.Pa /etc/ethers
+database.
+.Fn ether_ntohost
+converts from ethernet address to hostname, and
+.Fn ether_hostton
+converts from hostname to ethernet address.
+.Sh RETURN VALUES
+.Fn ether_line
+returns zero on success and non-zero if it was unable to parse
+any part of the supplied line
+.Ar l .
+It returns the extracted ethernet address in the supplied
+.Ar ether_addr
+structure
+.Ar e
+and the hostname in the supplied string
+.Ar h .
+.Pp
+On success,
+.Fn ether_ntoa
+returns a pointer to a string containing an
+.Tn ASCII
+representation of an ethernet address.
+If it is unable to convert
+the supplied
+.Ar ether_addr
+structure, it returns a
+.Dv NULL
+pointer.
+Likewise,
+.Fn ether_aton
+returns a pointer to an
+.Ar ether_addr
+structure on success and a
+.Dv NULL
+pointer on failure.
+.Pp
+The
+.Fn ether_ntohost
+and
+.Fn ether_hostton
+functions both return zero on success or non-zero if they were
+unable to find a match in the
+.Pa /etc/ethers
+database.
+.Sh NOTES
+The user must insure that the hostname strings passed to the
+.Fn ether_line ,
+.Fn ether_ntohost
+and
+.Fn ether_hostton
+functions are large enough to contain the returned hostnames.
+.Sh NIS INTERACTION
+If the
+.Pa /etc/ethers
+contains a line with a single + in it, the
+.Fn ether_ntohost
+and
+.Fn ether_hostton
+functions will attempt to consult the NIS
+.Pa ethers.byname
+and
+.Pa ethers.byaddr
+maps in addition to the data in the
+.Pa /etc/ethers
+file.
+.Sh SEE ALSO
+.Xr ethers 5 ,
+.Xr yp 8
+.Sh BUGS
+The
+.Fn ether_aton
+and
+.Fn ether_ntoa
+functions returns values that are stored in static memory areas
+which may be overwritten the next time they are called.
+.Sh HISTORY
+This particular implementation of the
+.Nm
+library functions were written for and first appeared in
+.Fx 2.1 .
diff --git a/newlib/libc/sys/linux/net/function.def b/newlib/libc/sys/linux/net/function.def
deleted file mode 100644
index 59a06a2d3..000000000
--- a/newlib/libc/sys/linux/net/function.def
+++ /dev/null
@@ -1,78 +0,0 @@
-/* List of functions defined for static NSS in GNU C Library.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/*
- This is a minimal config. Only services `files' and `dns' are supported.
-*/
-
-/* aliases */
-DEFINE_ENT (files, alias)
-DEFINE_GETBY (files, alias, name)
-
-/* ethers */
-DEFINE_ENT (files, ether)
-
-/* group */
-DEFINE_ENT (files, gr)
-DEFINE_GET (files, grgid)
-DEFINE_GET (files, grnam)
-
-/* hosts */
-DEFINE_ENT (files, host)
-DEFINE_GETBY (files, host, addr)
-DEFINE_GETBY (files, host, name)
-DEFINE_GET (files, hostton)
-DEFINE_GET (files, ntohost)
-DEFINE_GETBY (dns, host, addr)
-DEFINE_GETBY (dns, host, name)
-DEFINE_GETBY (dns, host, name2)
-
-/* netgroup */
-DEFINE_ENT (files, netgr)
-
-/* networks */
-DEFINE_ENT (files, net)
-DEFINE_GETBY (files, net, name)
-DEFINE_GETBY (files, net, addr)
-DEFINE_GETBY (dns, net, name)
-DEFINE_GETBY (dns, net, addr)
-
-/* protocols */
-DEFINE_ENT (files, proto)
-DEFINE_GETBY (files, proto, name)
-DEFINE_GETBY (files, proto, number)
-
-/* passwd */
-DEFINE_ENT (files, pw)
-DEFINE_GET (files, pwnam)
-DEFINE_GET (files, pwuid)
-
-/* rpc */
-DEFINE_ENT (files, rpc)
-DEFINE_GETBY (files, rpc, name)
-DEFINE_GETBY (files, rpc, number)
-
-/* services */
-DEFINE_ENT (files, serv)
-DEFINE_GETBY (files, serv, name)
-DEFINE_GETBY (files, serv, port)
-
-/* shadow */
-DEFINE_ENT (files, sp)
-DEFINE_GET (files, spnam)
diff --git a/newlib/libc/sys/linux/net/getXXbyYY.c b/newlib/libc/sys/linux/net/getXXbyYY.c
deleted file mode 100644
index 4fa25fa14..000000000
--- a/newlib/libc/sys/linux/net/getXXbyYY.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Copyright (C) 1996-2001,2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <assert.h>
-#include <errno.h>
-#define _IO_MTSAFE_IO
-#include <bits/libc-lock.h>
-#include <stdlib.h>
-#include <resolv.h>
-
-#include "nsswitch.h"
-
-/*******************************************************************\
-|* Here we assume several symbols to be defined: *|
-|* *|
-|* LOOKUP_TYPE - the return type of the function *|
-|* *|
-|* FUNCTION_NAME - name of the non-reentrant function *|
-|* *|
-|* DATABASE_NAME - name of the database the function accesses *|
-|* (e.g., host, services, ...) *|
-|* *|
-|* ADD_PARAMS - additional parameter, can vary in number *|
-|* *|
-|* ADD_VARIABLES - names of additional parameter *|
-|* *|
-|* BUFLEN - length of buffer allocated for the non *|
-|* reentrant version *|
-|* *|
-|* Optionally the following vars can be defined: *|
-|* *|
-|* NEED_H_ERRNO - an extra parameter will be passed to point to *|
-|* the global `h_errno' variable. *|
-|* *|
-\*******************************************************************/
-
-/* To make the real sources a bit prettier. */
-#define REENTRANT_NAME APPEND_R (FUNCTION_NAME)
-#define APPEND_R(name) APPEND_R1 (name)
-#define APPEND_R1(name) name##_r
-#define INTERNAL(name) INTERNAL1 (name)
-#define INTERNAL1(name) __##name
-
-/* Sometimes we need to store error codes in the `h_errno' variable. */
-#ifdef NEED_H_ERRNO
-# define H_ERRNO_PARM , int *h_errnop
-# define H_ERRNO_VAR , &h_errno_tmp
-# define H_ERRNO_VAR_P &h_errno_tmp
-#else
-# define H_ERRNO_PARM
-# define H_ERRNO_VAR
-# define H_ERRNO_VAR_P NULL
-#endif
-
-#ifdef HAVE_AF
-# define AF_VAL af
-#else
-# define AF_VAL AF_INET
-#endif
-
-/* Prototype for reentrant version we use here. */
-extern int INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf,
- char *buffer, size_t buflen,
- LOOKUP_TYPE **result H_ERRNO_PARM);
-
-/* We need to protect the dynamic buffer handling. */
-__libc_lock_define_initialized (static, lock);
-
-/* This points to the static buffer used. */
-libc_freeres_ptr (static char *buffer);
-
-
-LOOKUP_TYPE *
-FUNCTION_NAME (ADD_PARAMS)
-{
- static size_t buffer_size;
- static LOOKUP_TYPE resbuf;
- LOOKUP_TYPE *result;
-#ifdef NEED_H_ERRNO
- int h_errno_tmp = 0;
-#endif
-
- /* Get lock. */
- __libc_lock_lock (lock);
-
- if (buffer == NULL)
- {
- buffer_size = BUFLEN;
- buffer = (char *) malloc (buffer_size);
- }
-
-#ifdef HANDLE_DIGITS_DOTS
- if (buffer != NULL)
- {
- if (__nss_hostname_digits_dots (name, &resbuf, &buffer,
- &buffer_size, 0, &result, NULL, AF_VAL,
- H_ERRNO_VAR_P))
- goto done;
- }
-#endif
-
- while (buffer != NULL
- && (INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, &resbuf, buffer,
- buffer_size, &result H_ERRNO_VAR)
- == ERANGE)
-#ifdef NEED_H_ERRNO
- && h_errno_tmp == NETDB_INTERNAL
-#endif
- )
- {
- char *new_buf;
- buffer_size *= 2;
- new_buf = (char *) realloc (buffer, buffer_size);
- if (new_buf == NULL)
- {
- /* We are out of memory. Free the current buffer so that the
- process gets a chance for a normal termination. */
- free (buffer);
- errno = (ENOMEM);
- }
- buffer = new_buf;
- }
-
- if (buffer == NULL)
- result = NULL;
-
-#ifdef HANDLE_DIGITS_DOTS
-done:
-#endif
- /* Release lock. */
- __libc_lock_unlock (lock);
-
-#ifdef NEED_H_ERRNO
- if (h_errno_tmp != 0)
- h_errno = (h_errno_tmp);
-#endif
-
- return result;
-}
-
-static_link_warning (FUNCTION_NAME)
diff --git a/newlib/libc/sys/linux/net/getXXbyYY_r.c b/newlib/libc/sys/linux/net/getXXbyYY_r.c
deleted file mode 100644
index 326df94b7..000000000
--- a/newlib/libc/sys/linux/net/getXXbyYY_r.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* Copyright (C) 1996-2002, 2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdbool.h>
-#include "nsswitch.h"
-#ifdef USE_NSCD
-# include <nscd/nscd_proto.h>
-#endif
-#ifdef NEED__RES_HCONF
-# include "res_hconf.h"
-#endif
-#ifdef NEED__RES
-# include <resolv.h>
-#endif
-/*******************************************************************\
-|* Here we assume several symbols to be defined: *|
-|* *|
-|* LOOKUP_TYPE - the return type of the function *|
-|* *|
-|* FUNCTION_NAME - name of the non-reentrant function *|
-|* *|
-|* DATABASE_NAME - name of the database the function accesses *|
-|* (e.g., host, services, ...) *|
-|* *|
-|* ADD_PARAMS - additional parameter, can vary in number *|
-|* *|
-|* ADD_VARIABLES - names of additional parameter *|
-|* *|
-|* Optionally the following vars can be defined: *|
-|* *|
-|* NEED_H_ERRNO - an extra parameter will be passed to point to *|
-|* the global `h_errno' variable. *|
-|* *|
-|* NEED__RES - the global _res variable might be used so we *|
-|* will have to initialize it if necessary *|
-|* *|
-|* PREPROCESS - code run before anything else *|
-|* *|
-|* POSTPROCESS - code run after the lookup *|
-|* *|
-\*******************************************************************/
-
-/* To make the real sources a bit prettier. */
-#define REENTRANT_NAME APPEND_R (FUNCTION_NAME)
-#define APPEND_R(name) APPEND_R1 (name)
-#define APPEND_R1(name) name##_r
-#define INTERNAL(name) INTERNAL1 (name)
-#define INTERNAL1(name) __##name
-#define NEW(name) NEW1 (name)
-#define NEW1(name) __new_##name
-
-#ifdef USE_NSCD
-# define NSCD_NAME ADD_NSCD (REENTRANT_NAME)
-# define ADD_NSCD(name) ADD_NSCD1 (name)
-# define ADD_NSCD1(name) __nscd_##name
-# define NOT_USENSCD_NAME ADD_NOT_NSCDUSE (DATABASE_NAME)
-# define ADD_NOT_NSCDUSE(name) ADD_NOT_NSCDUSE1 (name)
-# define ADD_NOT_NSCDUSE1(name) __nss_not_use_nscd_##name
-#endif
-
-#define FUNCTION_NAME_STRING STRINGIZE (FUNCTION_NAME)
-#define REENTRANT_NAME_STRING STRINGIZE (REENTRANT_NAME)
-#define DATABASE_NAME_STRING STRINGIZE (DATABASE_NAME)
-#define STRINGIZE(name) STRINGIZE1 (name)
-#define STRINGIZE1(name) #name
-
-#ifndef DB_LOOKUP_FCT
-# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
-# define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post)
-# define CONCAT3_2(Pre, Name, Post) Pre##Name##Post
-#endif
-
-/* Sometimes we need to store error codes in the `h_errno' variable. */
-#ifdef NEED_H_ERRNO
-# define H_ERRNO_PARM , int *h_errnop
-# define H_ERRNO_VAR , h_errnop
-# define H_ERRNO_VAR_P h_errnop
-#else
-# define H_ERRNO_PARM
-# define H_ERRNO_VAR
-# define H_ERRNO_VAR_P NULL
-#endif
-
-#ifdef HAVE_AF
-# define AF_VAL af
-#else
-# define AF_VAL AF_INET
-#endif
-
-/* Type of the lookup function we need here. */
-typedef enum nss_status (*lookup_function) (ADD_PARAMS, LOOKUP_TYPE *, char *,
- size_t, int * H_ERRNO_PARM);
-
-/* The lookup function for the first entry of this service. */
-extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp)
- internal_function;
-libc_hidden_proto (DB_LOOKUP_FCT)
-
-
-int
-INTERNAL (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
- size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM)
-{
- static service_user *startp;
- static lookup_function start_fct;
- service_user *nip;
- union
- {
- lookup_function l;
- void *ptr;
- } fct;
-
- int no_more;
- enum nss_status status = NSS_STATUS_UNAVAIL;
-#ifdef USE_NSCD
- int nscd_status;
-#endif
-#ifdef NEED_H_ERRNO
- bool any_service = false;
-#endif
-
-#ifdef PREPROCESS
- PREPROCESS;
-#endif
-
-#ifdef HANDLE_DIGITS_DOTS
- switch (__nss_hostname_digits_dots (name, resbuf, &buffer, NULL,
- buflen, result, &status, AF_VAL,
- H_ERRNO_VAR_P))
- {
- case -1:
- return errno;
- case 1:
- goto done;
- }
-#endif
-
-#ifdef USE_NSCD
- if (NOT_USENSCD_NAME > 0 && ++NOT_USENSCD_NAME > NSS_NSCD_RETRY)
- NOT_USENSCD_NAME = 0;
-
- if (!NOT_USENSCD_NAME)
- {
- nscd_status = NSCD_NAME (ADD_VARIABLES, resbuf, buffer, buflen, result
- H_ERRNO_VAR);
- if (nscd_status >= 0)
- return nscd_status;
- }
-#endif
-
- if (startp == NULL)
- {
- no_more = DB_LOOKUP_FCT (&nip, REENTRANT_NAME_STRING, &fct.ptr);
- if (no_more)
- startp = (service_user *) -1l;
- else
- {
- startp = nip;
- start_fct = fct.l;
-
-#ifdef NEED__RES
- /* The resolver code will really be used so we have to
- initialize it. */
- if (__res_maybe_init (&_res, 0) == -1)
- {
- *h_errnop = NETDB_INTERNAL;
- *result = NULL;
- return errno;
- }
-#endif /* need _res */
-#ifdef NEED__RES_HCONF
- if (!_res_hconf.initialized)
- _res_hconf_init ();
-#endif /* need _res_hconf */
- }
- }
- else
- {
- fct.l = start_fct;
- no_more = (nip = startp) == (service_user *) -1l;
- }
-
- while (no_more == 0)
- {
-#ifdef NEED_H_ERRNO
- any_service = true;
-#endif
-
- status = DL_CALL_FCT (fct.l, (ADD_VARIABLES, resbuf, buffer, buflen,
- &errno H_ERRNO_VAR));
-
- /* The status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
- provided buffer is too small. In this case we should give
- the user the possibility to enlarge the buffer and we should
- not simply go on with the next service (even if the TRYAGAIN
- action tells us so). */
- if (status == NSS_STATUS_TRYAGAIN
-#ifdef NEED_H_ERRNO
- && *h_errnop == NETDB_INTERNAL
-#endif
- && errno == ERANGE)
- break;
-
- no_more = __nss_next (&nip, REENTRANT_NAME_STRING,
- &fct.ptr, status, 0);
- }
-
-#ifdef HANDLE_DIGITS_DOTS
-done:
-#endif
- *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
-#ifdef NEED_H_ERRNO
- if (status != NSS_STATUS_SUCCESS && ! any_service)
- /* We were not able to use any service. */
- *h_errnop = NO_RECOVERY;
-#endif
-#ifdef POSTPROCESS
- POSTPROCESS;
-#endif
-
- int res;
- if (status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND)
- res = 0;
- /* Don't pass back ERANGE if this is not for a too-small buffer. */
- else if (errno == ERANGE && status != NSS_STATUS_TRYAGAIN)
- res = EINVAL;
-#ifdef NEED_H_ERRNO
- /* These functions only set errno if h_errno is NETDB_INTERNAL. */
- else if (status == NSS_STATUS_TRYAGAIN && *h_errnop != NETDB_INTERNAL)
- res = EAGAIN;
-#endif
- else
- return errno;
-
- __set_errno (res);
- return res;
-}
-
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2)
-#define OLD(name) OLD1 (name)
-#define OLD1(name) __old_##name
-
-int
-attribute_compat_text_section
-OLD (REENTRANT_NAME) (ADD_PARAMS, LOOKUP_TYPE *resbuf, char *buffer,
- size_t buflen, LOOKUP_TYPE **result H_ERRNO_PARM)
-{
- int ret = INTERNAL (REENTRANT_NAME) (ADD_VARIABLES, resbuf, buffer,
- buflen, result H_ERRNO_VAR);
-
- if (ret != 0 || result == NULL)
- ret = -1;
-
- return ret;
-}
-
-#define do_symbol_version(real, name, version) \
- compat_symbol (libc, real, name, version)
-do_symbol_version (OLD (REENTRANT_NAME), REENTRANT_NAME, GLIBC_2_0);
-#endif
-
-/* As INTERNAL (REENTRANT_NAME) may be hidden, we need an alias
- in between so that the REENTRANT_NAME@@GLIBC_2.1.2 is not
- hidden too. */
-strong_alias (INTERNAL (REENTRANT_NAME), NEW (REENTRANT_NAME));
-
-#define do_default_symbol_version(real, name, version) \
- versioned_symbol (libc, real, name, version)
-do_default_symbol_version (NEW (REENTRANT_NAME),
- REENTRANT_NAME, GLIBC_2_1_2);
-
-static_link_warning (REENTRANT_NAME)
diff --git a/newlib/libc/sys/linux/net/getXXent.c b/newlib/libc/sys/linux/net/getXXent.c
deleted file mode 100644
index a2d5f401b..000000000
--- a/newlib/libc/sys/linux/net/getXXent.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#define _IO_MTSAFE_IO
-#include <bits/libc-lock.h>
-#include <stdlib.h>
-
-#include "nsswitch.h"
-
-/*******************************************************************\
-|* Here we assume several symbols to be defined: *|
-|* *|
-|* LOOKUP_TYPE - the return type of the function *|
-|* *|
-|* GETFUNC_NAME - name of the non-reentrant getXXXent function *|
-|* *|
-|* BUFLEN - size of static buffer *|
-|* *|
-|* Optionally the following vars can be defined: *|
-|* *|
-|* NEED_H_ERRNO - an extra parameter will be passed to point to *|
-|* the global `h_errno' variable. *|
-|* *|
-\*******************************************************************/
-
-/* To make the real sources a bit prettier. */
-#define REENTRANT_GETNAME APPEND_R (GETFUNC_NAME)
-#define APPEND_R(name) APPEND_R1 (name)
-#define APPEND_R1(name) name##_r
-#define INTERNAL(name) INTERNAL1 (name)
-#define INTERNAL1(name) __##name
-
-/* Sometimes we need to store error codes in the `h_errno' variable. */
-#ifdef NEED_H_ERRNO
-# define H_ERRNO_PARM , int *h_errnop
-# define H_ERRNO_VAR &h_errno
-#else
-# define H_ERRNO_PARM
-# define H_ERRNO_VAR NULL
-#endif
-
-/* Prototype of the reentrant version. */
-extern int INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer,
- size_t buflen, LOOKUP_TYPE **result
- H_ERRNO_PARM);
-
-/* We need to protect the dynamic buffer handling. */
-__libc_lock_define_initialized (static, lock);
-
-/* This points to the static buffer used. */
-libc_freeres_ptr (static char *buffer);
-
-
-LOOKUP_TYPE *
-GETFUNC_NAME (void)
-{
- static size_t buffer_size;
- static union
- {
- LOOKUP_TYPE l;
- void *ptr;
- } resbuf;
- LOOKUP_TYPE *result;
- int save;
-
- /* Get lock. */
- __libc_lock_lock (lock);
-
- result = (LOOKUP_TYPE *)
- __nss_getent ((getent_r_function) INTERNAL (REENTRANT_GETNAME),
- &resbuf.ptr, &buffer, BUFLEN, &buffer_size,
- H_ERRNO_VAR);
-
- save = errno;
- __libc_lock_unlock (lock);
- __set_errno (save);
- return result;
-}
-
-static_link_warning (GETFUNC_NAME)
diff --git a/newlib/libc/sys/linux/net/getXXent_r.c b/newlib/libc/sys/linux/net/getXXent_r.c
deleted file mode 100644
index e0228e40e..000000000
--- a/newlib/libc/sys/linux/net/getXXent_r.c
+++ /dev/null
@@ -1,209 +0,0 @@
-/* Copyright (C) 1996,97,98,99,2000,2002,2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#define _IO_MTSAFE_IO
-#include <bits/libc-lock.h>
-
-#include "nsswitch.h"
-
-/*******************************************************************\
-|* Here we assume several symbols to be defined: *|
-|* *|
-|* LOOKUP_TYPE - the return type of the function *|
-|* *|
-|* SETFUNC_NAME - name of the non-reentrant setXXXent function *|
-|* *|
-|* GETFUNC_NAME - name of the non-reentrant getXXXent function *|
-|* *|
-|* ENDFUNC_NAME - name of the non-reentrant endXXXent function *|
-|* *|
-|* DATABASE_NAME - name of the database the function accesses *|
-|* (e.g., host, services, ...) *|
-|* *|
-|* Optionally the following vars can be defined: *|
-|* *|
-|* STAYOPEN - variable declaration for setXXXent function *|
-|* *|
-|* STAYOPEN_VAR - variable name for setXXXent function *|
-|* *|
-|* NEED_H_ERRNO - an extra parameter will be passed to point to *|
-|* the global `h_errno' variable. *|
-|* *|
-\*******************************************************************/
-
-/* To make the real sources a bit prettier. */
-#define REENTRANT_GETNAME APPEND_R (GETFUNC_NAME)
-#define APPEND_R(Name) CONCAT2_2 (Name, _r)
-#define INTERNAL(Name) CONCAT2_2 (__, Name)
-#define CONCAT2_1(Pre, Post) CONCAT2_2 (Pre, Post)
-#define CONCAT2_2(Pre, Post) Pre##Post
-#define NEW(name) NEW1 (name)
-#define NEW1(name) __new_##name
-
-#define SETFUNC_NAME_STRING STRINGIZE (SETFUNC_NAME)
-#define GETFUNC_NAME_STRING STRINGIZE (REENTRANT_GETNAME)
-#define ENDFUNC_NAME_STRING STRINGIZE (ENDFUNC_NAME)
-#define DATABASE_NAME_STRING STRINGIZE (DATABASE_NAME)
-#define STRINGIZE(Name) STRINGIZE1 (Name)
-#define STRINGIZE1(Name) #Name
-
-#ifndef DB_LOOKUP_FCT
-# define DB_LOOKUP_FCT CONCAT3_1 (__nss_, DATABASE_NAME, _lookup)
-# define CONCAT3_1(Pre, Name, Post) CONCAT3_2 (Pre, Name, Post)
-# define CONCAT3_2(Pre, Name, Post) Pre##Name##Post
-#endif
-
-/* Sometimes we need to store error codes in the `h_errno' variable. */
-#ifdef NEED_H_ERRNO
-# define H_ERRNO_PARM , int *h_errnop
-# define H_ERRNO_VAR , &h_errno
-# define H_ERRNO_VAR_P &h_errno
-#else
-# define H_ERRNO_PARM
-# define H_ERRNO_VAR
-# define H_ERRNO_VAR_P NULL
-#endif
-
-/* Some databases take the `stayopen' flag. */
-#ifdef STAYOPEN
-# define STAYOPEN_TMP CONCAT2_1 (STAYOPEN, _tmp)
-# define STAYOPEN_TMPVAR &CONCAT2_1 (STAYOPEN_VAR, _tmp)
-#else
-# define STAYOPEN void
-# define STAYOPEN_VAR 0
-# define STAYOPEN_TMPVAR NULL
-#endif
-
-#ifndef NEED__RES
-# define NEED__RES 0
-#endif
-
-/* This handle for the NSS data base is shared between all
- set/get/endXXXent functions. */
-static service_user *nip;
-/* Remember the last service used since the last call to `endXXent'. */
-static service_user *last_nip;
-/* Remember the first service_entry, it's always the same. */
-static service_user *startp;
-
-#ifdef STAYOPEN_TMP
-/* We need to remember the last `stayopen' flag given by the user
- since the `setent' function is only called for the first available
- service. */
-static STAYOPEN_TMP;
-#endif
-
-/* Protect above variable against multiple uses at the same time. */
-__libc_lock_define_initialized (static, lock)
-
-/* The lookup function for the first entry of this service. */
-extern int DB_LOOKUP_FCT (service_user **nip, const char *name, void **fctp)
- internal_function;
-libc_hidden_proto (DB_LOOKUP_FCT)
-
-void
-SETFUNC_NAME (STAYOPEN)
-{
- int save;
-
- __libc_lock_lock (lock);
- __nss_setent (SETFUNC_NAME_STRING, DB_LOOKUP_FCT, &nip, &startp,
- &last_nip, STAYOPEN_VAR, STAYOPEN_TMPVAR, NEED__RES);
-
- save = errno;
- __libc_lock_unlock (lock);
- __set_errno (save);
-}
-
-
-void
-ENDFUNC_NAME (void)
-{
- int save;
-
- /* If the service has not been used before do not do anything. */
- if (startp != NULL)
- {
- __libc_lock_lock (lock);
- __nss_endent (ENDFUNC_NAME_STRING, DB_LOOKUP_FCT, &nip, &startp,
- &last_nip, NEED__RES);
- save = errno;
- __libc_lock_unlock (lock);
- __set_errno (save);
- }
-}
-
-
-int
-INTERNAL (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
- LOOKUP_TYPE **result H_ERRNO_PARM)
-{
- int status;
- int save;
-
- __libc_lock_lock (lock);
- status = __nss_getent_r (GETFUNC_NAME_STRING, SETFUNC_NAME_STRING,
- DB_LOOKUP_FCT, &nip, &startp, &last_nip,
- STAYOPEN_TMPVAR, NEED__RES, resbuf, buffer,
- buflen, (void **) result, H_ERRNO_VAR_P);
- save = errno;
- __libc_lock_unlock (lock);
- __set_errno (save);
- return status;
-}
-
-
-#include <shlib-compat.h>
-#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1_2)
-#define OLD(name) OLD1 (name)
-#define OLD1(name) __old_##name
-
-int
-attribute_compat_text_section
-OLD (REENTRANT_GETNAME) (LOOKUP_TYPE *resbuf, char *buffer, size_t buflen,
- LOOKUP_TYPE **result H_ERRNO_PARM)
-{
- int ret = INTERNAL (REENTRANT_GETNAME) (resbuf, buffer, buflen,
- result H_ERRNO_VAR);
-
- if (ret != 0)
- ret = -1;
-
- return ret;
-}
-
-#define do_symbol_version(real, name, version) \
- compat_symbol (libc, real, name, version)
-do_symbol_version (OLD (REENTRANT_GETNAME), REENTRANT_GETNAME, GLIBC_2_0);
-#endif
-
-/* As INTERNAL (REENTRANT_GETNAME) may be hidden, we need an alias
- in between so that the REENTRANT_GETNAME@@GLIBC_2.1.2 is not
- hidden too. */
-strong_alias (INTERNAL (REENTRANT_GETNAME), NEW (REENTRANT_GETNAME));
-
-#define do_default_symbol_version(real, name, version) \
- versioned_symbol (libc, real, name, version)
-do_default_symbol_version (NEW (REENTRANT_GETNAME),
- REENTRANT_GETNAME, GLIBC_2_1_2);
-
-static_link_warning (SETFUNC_NAME)
-static_link_warning (ENDFUNC_NAME)
-static_link_warning (REENTRANT_GETNAME)
diff --git a/newlib/libc/sys/linux/net/getaddrinfo.3 b/newlib/libc/sys/linux/net/getaddrinfo.3
new file mode 100644
index 000000000..eca8b03b2
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getaddrinfo.3
@@ -0,0 +1,620 @@
+.\" $FreeBSD: src/lib/libc/net/getaddrinfo.3,v 1.18 2002/04/19 04:46:20 suz Exp $
+.\" $KAME: getaddrinfo.3,v 1.31 2001/08/05 18:19:38 itojun Exp $
+.\"
+.\" Copyright (c) 1983, 1987, 1991, 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.
+.\"
+.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
+.\"
+.Dd May 25, 1995
+.Dt GETADDRINFO 3
+.Os
+.\"
+.Sh NAME
+.Nm getaddrinfo ,
+.Nm freeaddrinfo ,
+.Nm gai_strerror
+.Nd nodename-to-address translation in protocol-independent manner
+.\"
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netdb.h
+.Ft int
+.Fn getaddrinfo "const char *nodename" "const char *servname" \
+"const struct addrinfo *hints" "struct addrinfo **res"
+.Ft void
+.Fn freeaddrinfo "struct addrinfo *ai"
+.Ft "char *"
+.Fn gai_strerror "int ecode"
+.\"
+.Sh DESCRIPTION
+The
+.Fn getaddrinfo
+function is defined for protocol-independent nodename-to-address translation.
+It performs the functionality of
+.Xr gethostbyname 3
+and
+.Xr getservbyname 3 ,
+but in a more sophisticated manner.
+.Pp
+The
+.Li addrinfo
+structure is defined as a result of including the
+.Aq Pa netdb.h
+header:
+.Bd -literal -offset
+struct addrinfo {
+ int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
+ int ai_family; /* PF_xxx */
+ int ai_socktype; /* SOCK_xxx */
+ int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
+ size_t ai_addrlen; /* length of ai_addr */
+ char *ai_canonname; /* canonical name for nodename */
+ struct sockaddr *ai_addr; /* binary address */
+ struct addrinfo *ai_next; /* next structure in linked list */
+};
+.Ed
+.Pp
+The
+.Fa nodename
+and
+.Fa servname
+arguments are pointers to null-terminated strings or
+.Dv NULL .
+One or both of these two arguments must be a
+.Pf non Dv -NULL
+pointer.
+In the normal client scenario, both the
+.Fa nodename
+and
+.Fa servname
+are specified.
+In the normal server scenario, only the
+.Fa servname
+is specified.
+A
+.Pf non Dv -NULL
+.Fa nodename
+string can be either a node name or a numeric host address string
+(i.e., a dotted-decimal IPv4 address or an IPv6 hex address).
+A
+.Pf non Dv -NULL
+.Fa servname
+string can be either a service name or a decimal port number.
+.Pp
+The caller can optionally pass an
+.Li addrinfo
+structure, pointed to by the third argument,
+to provide hints concerning the type of socket that the caller supports.
+In this
+.Fa hints
+structure all members other than
+.Fa ai_flags ,
+.Fa ai_family ,
+.Fa ai_socktype ,
+and
+.Fa ai_protocol
+must be zero or a
+.Dv NULL
+pointer.
+A value of
+.Dv PF_UNSPEC
+for
+.Fa ai_family
+means the caller will accept any protocol family.
+A value of 0 for
+.Fa ai_socktype
+means the caller will accept any socket type.
+A value of 0 for
+.Fa ai_protocol
+means the caller will accept any protocol.
+For example, if the caller handles only TCP and not UDP, then the
+.Fa ai_socktype
+member of the hints structure should be set to
+.Dv SOCK_STREAM
+when
+.Fn getaddrinfo
+is called.
+If the caller handles only IPv4 and not IPv6, then the
+.Fa ai_family
+member of the
+.Fa hints
+structure should be set to
+.Dv PF_INET
+when
+.Fn getaddrinfo
+is called.
+If the third argument to
+.Fn getaddrinfo
+is a
+.Dv NULL
+pointer, this is the same as if the caller had filled in an
+.Li addrinfo
+structure initialized to zero with
+.Fa ai_family
+set to
+.Dv PF_UNSPEC .
+.Pp
+Upon successful return a pointer to a linked list of one or more
+.Li addrinfo
+structures is returned through the final argument.
+The caller can process each
+.Li addrinfo
+structure in this list by following the
+.Fa ai_next
+pointer, until a
+.Dv NULL
+pointer is encountered.
+In each returned
+.Li addrinfo
+structure the three members
+.Fa ai_family ,
+.Fa ai_socktype ,
+and
+.Fa ai_protocol
+are the corresponding arguments for a call to the
+.Fn socket
+function.
+In each
+.Li addrinfo
+structure the
+.Fa ai_addr
+member points to a filled-in socket address structure whose length is
+specified by the
+.Fa ai_addrlen
+member.
+.Pp
+If the
+.Dv AI_PASSIVE
+bit is set in the
+.Fa ai_flags
+member of the
+.Fa hints
+structure, then the caller plans to use the returned socket address
+structure in a call to
+.Fn bind .
+In this case, if the
+.Fa nodename
+argument is a
+.Dv NULL
+pointer, then the IP address portion of the socket
+address structure will be set to
+.Dv INADDR_ANY
+for an IPv4 address or
+.Dv IN6ADDR_ANY_INIT
+for an IPv6 address.
+.Pp
+If the
+.Dv AI_PASSIVE
+bit is not set in the
+.Fa ai_flags
+member of the
+.Fa hints
+structure, then the returned socket address structure will be ready for a
+call to
+.Fn connect
+(for a connection-oriented protocol)
+or either
+.Fn connect ,
+.Fn sendto ,
+or
+.Fn sendmsg
+(for a connectionless protocol).
+In this case, if the
+.Fa nodename
+argument is a
+.Dv NULL
+pointer, then the IP address portion of the
+socket address structure will be set to the loopback address.
+.Pp
+If the
+.Dv AI_CANONNAME
+bit is set in the
+.Fa ai_flags
+member of the
+.Fa hints
+structure, then upon successful return the
+.Fa ai_canonname
+member of the first
+.Li addrinfo
+structure in the linked list will point to a null-terminated string
+containing the canonical name of the specified
+.Fa nodename .
+.Pp
+If the
+.Dv AI_NUMERICHOST
+bit is set in the
+.Fa ai_flags
+member of the
+.Fa hints
+structure, then a
+.Pf non Dv -NULL
+.Fa nodename
+string must be a numeric host address string.
+Otherwise an error of
+.Dv EAI_NONAME
+is returned.
+This flag prevents any type of name resolution service (e.g., the DNS)
+from being called.
+.Pp
+The arguments to
+.Fn getaddrinfo
+must be sufficiently consistent and unambiguous.
+Here are some problem cases you may encounter:
+.Bl -bullet
+.It
+.Fn getaddrinfo
+will fail if the members in the
+.Fa hints
+structure are not consistent.
+For example, for internet address families,
+.Fn getaddrinfo
+will fail if you specify
+.Dv SOCK_STREAM
+to
+.Fa ai_socktype
+while you specify
+.Dv IPPROTO_UDP
+to
+.Fa ai_protocol .
+.It
+If you specify a
+.Fa servname
+which is defined only for certain
+.Fa ai_socktype ,
+.Fn getaddrinfo
+will fail because the arguments are not consistent.
+For example,
+.Fn getaddrinfo
+will return an error if you ask for
+.Dq Li tftp
+service on
+.Dv SOCK_STREAM .
+.It
+For internet address families, if you specify
+.Fa servname
+while you set
+.Fa ai_socktype
+to
+.Dv SOCK_RAW ,
+.Fn getaddrinfo
+will fail, because service names are not defined for the internet
+.Dv SOCK_RAW
+space.
+.It
+If you specify numeric
+.Fa servname ,
+while leaving
+.Fa ai_socktype
+and
+.Fa ai_protocol
+unspecified,
+.Fn getaddrinfo
+will fail.
+This is because the numeric
+.Fa servname
+does not identify any socket type, and
+.Fn getaddrinfo
+is not allowed to glob the argument in such case.
+.El
+.Pp
+All of the information returned by
+.Fn getaddrinfo
+is dynamically allocated:
+the
+.Li addrinfo
+structures, the socket address structures, and canonical node name
+strings pointed to by the addrinfo structures.
+To return this information to the system the function
+.Fn freeaddrinfo
+is called.
+The
+.Fa addrinfo
+structure pointed to by the
+.Fa ai argument
+is freed, along with any dynamic storage pointed to by the structure.
+This operation is repeated until a
+.Dv NULL
+.Fa ai_next
+pointer is encountered.
+.Pp
+To aid applications in printing error messages based on the
+.Dv EAI_xxx
+codes returned by
+.Fn getaddrinfo ,
+.Fn gai_strerror
+is defined.
+The argument is one of the
+.Dv EAI_xxx
+values defined earlier and the return value points to a string describing
+the error.
+If the argument is not one of the
+.Dv EAI_xxx
+values, the function still returns a pointer to a string whose contents
+indicate an unknown error.
+.\"
+.Sh EXTENSIONS
+This implementation supports numeric IPv6 address notation with the
+experimental scope identifier.
+By appending a percent sign and scope identifier to the address, you
+can specify the value of the
+.Li sin6_scope_id
+field of the socket address.
+This makes management of scoped address easier,
+and allows cut-and-paste input of scoped addresses.
+.Pp
+At the moment the code supports only link-local addresses in this format.
+The scope identifier is hardcoded to name of hardware interface associated
+with the link,
+(such as
+.Li ne0 ) .
+For example,
+.Dq Li fe80::1%ne0 ,
+which means
+.Do
+.Li fe80::1
+on the link associated with the
+.Li ne0
+interface
+.Dc .
+.Pp
+This implementation is still very experimental and non-standard.
+The current implementation assumes a one-to-one relationship between
+interfaces and links, which is not necessarily true according to the
+specification.
+.\"
+.Sh EXAMPLES
+The following code tries to connect to
+.Dq Li www.kame.net
+service
+.Dq Li http .
+via stream socket.
+It loops through all the addresses available, regardless of the address family.
+If the destination resolves to an IPv4 address, it will use an
+.Dv AF_INET
+socket.
+Similarly, if it resolves to IPv6, an
+.Dv AF_INET6
+socket is used.
+Observe that there is no hardcoded reference to particular address family.
+The code works even if
+.Fn getaddrinfo
+returns addresses that are not IPv4/v6.
+.Bd -literal -offset indent
+struct addrinfo hints, *res, *res0;
+int error;
+int s;
+const char *cause = NULL;
+
+memset(&hints, 0, sizeof(hints));
+hints.ai_family = PF_UNSPEC;
+hints.ai_socktype = SOCK_STREAM;
+error = getaddrinfo("www.kame.net", "http", &hints, &res0);
+if (error) {
+ errx(1, "%s", gai_strerror(error));
+ /*NOTREACHED*/
+}
+s = -1;
+cause = "no addresses";
+errno = EADDRNOTAVAIL;
+for (res = res0; res; res = res->ai_next) {
+ s = socket(res->ai_family, res->ai_socktype,
+ res->ai_protocol);
+ if (s < 0) {
+ cause = "socket";
+ continue;
+ }
+
+ if (connect(s, res->ai_addr, res->ai_addrlen) < 0) {
+ cause = "connect";
+ close(s);
+ s = -1;
+ continue;
+ }
+
+ break; /* okay we got one */
+}
+if (s < 0) {
+ err(1, cause);
+ /*NOTREACHED*/
+}
+freeaddrinfo(res0);
+.Ed
+.Pp
+The following example tries to open a wildcard listening socket onto service
+.Dq Li http ,
+for all the address families available.
+.Bd -literal -offset indent
+struct addrinfo hints, *res, *res0;
+int error;
+int s[MAXSOCK];
+int nsock;
+const char *cause = NULL;
+
+memset(&hints, 0, sizeof(hints));
+hints.ai_family = PF_UNSPEC;
+hints.ai_socktype = SOCK_STREAM;
+hints.ai_flags = AI_PASSIVE;
+error = getaddrinfo(NULL, "http", &hints, &res0);
+if (error) {
+ errx(1, "%s", gai_strerror(error));
+ /*NOTREACHED*/
+}
+nsock = 0;
+for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) {
+ s[nsock] = socket(res->ai_family, res->ai_socktype,
+ res->ai_protocol);
+ if (s[nsock] < 0) {
+ cause = "socket";
+ continue;
+ }
+
+ if (bind(s[nsock], res->ai_addr, res->ai_addrlen) < 0) {
+ cause = "bind";
+ close(s[nsock]);
+ continue;
+ }
+
+ if (listen(s[nsock], SOMAXCONN) < 0) {
+ cause = "listen";
+ close(s[nsock]);
+ continue;
+ }
+
+ nsock++;
+}
+if (nsock == 0) {
+ err(1, cause);
+ /*NOTREACHED*/
+}
+freeaddrinfo(res0);
+.Ed
+.\"
+.Sh FILES
+.Bl -tag -width /etc/nsswitch.conf -compact
+.It Pa /etc/hosts
+.It Pa /etc/nsswitch.conf
+.It Pa /etc/resolv.conf
+.El
+.\"
+.Sh DIAGNOSTICS
+Error return status from
+.Fn getaddrinfo
+is zero on success and non-zero on errors.
+Non-zero error codes are defined in
+.Aq Pa netdb.h ,
+and as follows:
+.Pp
+.Bl -tag -width EAI_ADDRFAMILY -compact
+.It Dv EAI_ADDRFAMILY
+Address family for
+.Fa nodename
+not supported.
+.It Dv EAI_AGAIN
+Temporary failure in name resolution.
+.It Dv EAI_BADFLAGS
+Invalid value for
+.Fa ai_flags .
+.It Dv EAI_FAIL
+Non-recoverable failure in name resolution.
+.It Dv EAI_FAMILY
+.Fa ai_family
+not supported.
+.It Dv EAI_MEMORY
+Memory allocation failure.
+.It Dv EAI_NODATA
+No address associated with
+.Fa nodename .
+.It Dv EAI_NONAME
+.Fa nodename
+nor
+.Fa servname
+provided, or not known.
+.It Dv EAI_SERVICE
+.Fa servname
+not supported for
+.Fa ai_socktype .
+.It Dv EAI_SOCKTYPE
+.Fa ai_socktype
+not supported.
+.It Dv EAI_SYSTEM
+System error returned in
+.Va errno .
+.It Dv EAI_BADHINTS
+Invalid value for
+.Fa hints .
+.It Dv EAI_PROTOCOL
+Resolved protocol is unknown.
+.It Dv EAI_MAX
+Unknown error.
+.El
+.Pp
+If called with an appropriate argument,
+.Fn gai_strerror
+returns a pointer to a string describing the given error code.
+If the argument is not one of the
+.Dv EAI_xxx
+values, the function still returns a pointer to a string whose contents
+indicate an unknown error.
+.\"
+.Sh SEE ALSO
+.Xr gethostbyname 3 ,
+.Xr getnameinfo 3 ,
+.Xr getservbyname 3 ,
+.Xr hosts 5 ,
+.Xr resolv.conf 5 ,
+.Xr services 5 ,
+.Xr hostname 7 ,
+.Xr named 8
+.Pp
+.Rs
+.%A R. Gilligan
+.%A S. Thomson
+.%A J. Bound
+.%A W. Stevens
+.%T Basic Socket Interface Extensions for IPv6
+.%R RFC2553
+.%D March 1999
+.Re
+.Rs
+.%A Tatsuya Jinmei
+.%A Atsushi Onoe
+.%T "An Extension of Format for IPv6 Scoped Addresses"
+.%R internet draft
+.%N draft-ietf-ipngwg-scopedaddr-format-02.txt
+.%O work in progress material
+.Re
+.Rs
+.%A Craig Metz
+.%T Protocol Independence Using the Sockets API
+.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
+.%D June 2000
+.Re
+.\"
+.Sh HISTORY
+The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit.
+.\"
+.Sh STANDARDS
+The
+.Fn getaddrinfo
+function is defined in
+.St -p1003.1g-2000 ,
+and documented in
+.Dq Basic Socket Interface Extensions for IPv6
+(RFC2553).
+.\"
+.Sh BUGS
+The current implementation is not thread-safe.
+.Pp
+The text was shamelessly copied from RFC2553.
diff --git a/newlib/libc/sys/linux/net/getaddrinfo.c b/newlib/libc/sys/linux/net/getaddrinfo.c
index 742d46c8f..97ba36209 100644
--- a/newlib/libc/sys/linux/net/getaddrinfo.c
+++ b/newlib/libc/sys/linux/net/getaddrinfo.c
@@ -1,1699 +1,1979 @@
-/* The Inner Net License, Version 2.00
-
- The author(s) grant permission for redistribution and use in source and
-binary forms, with or without modification, of the software and documentation
-provided that the following conditions are met:
-
-0. If you receive a version of the software that is specifically labelled
- as not being for redistribution (check the version message and/or README),
- you are not permitted to redistribute that version of the software in any
- way or form.
-1. All terms of the all other applicable copyrights and licenses must be
- followed.
-2. Redistributions of source code must retain the authors' copyright
- notice(s), this list of conditions, and the following disclaimer.
-3. Redistributions in binary form must reproduce the authors' copyright
- notice(s), this list of conditions, and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-4. [The copyright holder has authorized the removal of this clause.]
-5. Neither the name(s) of the author(s) 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 ITS AUTHORS 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 AUTHORS 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.
-
- If these license terms cause you a real problem, contact the author. */
-
-/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */
-
-#include <alloca.h>
+/* $KAME: getaddrinfo.c,v 1.15 2000/07/09 04:37:24 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * "#ifdef FAITH" part is local hack for supporting IPv4-v6 translator.
+ *
+ * Issues to be discussed:
+ * - Thread safe-ness must be checked.
+ * - Return values. There are nonstandard return values defined and used
+ * in the source code. This is because RFC2553 is silent about which error
+ * code must be returned for which situation.
+ * - freeaddrinfo(NULL). RFC2553 is silent about it. XNET 5.2 says it is
+ * invalid.
+ * current code - SEGV on freeaddrinfo(NULL)
+ * Note:
+ * - We use getipnodebyname() just for thread-safeness. There's no intent
+ * to let it do PF_UNSPEC (actually we never pass PF_UNSPEC to
+ * getipnodebyname().
+ * - The code filters out AFs that are not supported by the kernel,
+ * when globbing NULL hostname (to loopback, or wildcard). Is it the right
+ * thing to do? What is the relationship with post-RFC2553 AI_ADDRCONFIG
+ * in ai_flags?
+ * - (post-2553) semantics of AI_ADDRCONFIG itself is too vague.
+ * (1) what should we do against numeric hostname (2) what should we do
+ * against NULL hostname (3) what is AI_ADDRCONFIG itself. AF not ready?
+ * non-loopback address configured? global address configured?
+ * - To avoid search order issue, we have a big amount of code duplicate
+ * from gethnamaddr.c and some other places. The issues that there's no
+ * lower layer function to lookup "IPv4 or IPv6" record. Calling
+ * gethostbyname2 from getaddrinfo will end up in wrong search order, as
+ * follows:
+ * - The code makes use of following calls when asked to resolver with
+ * ai_family = PF_UNSPEC:
+ * getipnodebyname(host, AF_INET6);
+ * getipnodebyname(host, AF_INET);
+ * This will result in the following queries if the node is configure to
+ * prefer /etc/hosts than DNS:
+ * lookup /etc/hosts for IPv6 address
+ * lookup DNS for IPv6 address
+ * lookup /etc/hosts for IPv4 address
+ * lookup DNS for IPv4 address
+ * which may not meet people's requirement.
+ * The right thing to happen is to have underlying layer which does
+ * PF_UNSPEC lookup (lookup both) and return chain of addrinfos.
+ * This would result in a bit of code duplicate with _dns_ghbyname() and
+ * friends.
+ */
+/*
+ * diffs with other KAME platforms:
+ * - other KAME platforms already nuked FAITH ($GAI), but as FreeBSD
+ * 4.0-RELEASE supplies it, we still have the code here.
+ * - AI_ADDRCONFIG support is supplied
+ * - some of FreeBSD style (#define tabify and others)
+ * - classful IPv4 numeric (127.1) is allowed.
+ */
+
+#include <sys/cdefs.h>
+#include <machine/endian.h>
+
+#include "namespace.h"
#include <sys/types.h>
-#include <assert.h>
-#include <errno.h>
-#include <ifaddrs.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
#include <netdb.h>
#include <resolv.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <ctype.h>
#include <unistd.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/un.h>
-#include <sys/utsname.h>
-#include <net/if.h>
-#include <nsswitch.h>
-#include <not-cancel.h>
-#include <nscd/nscd-client.h>
-#include <nscd/nscd_proto.h>
-#include "local.h"
-
-#ifdef HAVE_LIBIDN
-extern int __idna_to_ascii_lz (const char *input, char **output, int flags);
-extern int __idna_to_unicode_lzlz (const char *input, char **output,
- int flags);
-# include <libidn/idna.h>
+#include <stdio.h>
+#include <errno.h>
+#ifdef DEBUG
+#include <syslog.h>
#endif
-#define GAIH_OKIFUNSPEC 0x0100
-#define GAIH_EAI ~(GAIH_OKIFUNSPEC)
+#include <syslog.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+#include "un-namespace.h"
-#ifndef UNIX_PATH_MAX
-#define UNIX_PATH_MAX 108
+#if defined(__KAME__) && defined(INET6)
+# define FAITH
#endif
-struct gaih_service
- {
- const char *name;
- int num;
- };
-
-struct gaih_servtuple
- {
- struct gaih_servtuple *next;
- int socktype;
- int protocol;
- int port;
- };
-
-static const struct gaih_servtuple nullserv;
-
-struct gaih_addrtuple
- {
- struct gaih_addrtuple *next;
- char *name;
- int family;
- uint32_t addr[4];
- uint32_t scopeid;
- };
-
-struct gaih_typeproto
- {
- int socktype;
- int protocol;
- char name[4];
- int protoflag;
- };
-
-/* Values for `protoflag'. */
-#define GAI_PROTO_NOSERVICE 1
-#define GAI_PROTO_PROTOANY 2
-
-static const struct gaih_typeproto gaih_inet_typeproto[] =
-{
- { 0, 0, "", 0 },
- { SOCK_STREAM, IPPROTO_TCP, "tcp", 0 },
- { SOCK_DGRAM, IPPROTO_UDP, "udp", 0 },
- { SOCK_RAW, 0, "raw", GAI_PROTO_PROTOANY|GAI_PROTO_NOSERVICE },
- { 0, 0, "", 0 }
+#define SUCCESS 0
+#define ANY 0
+#define YES 1
+#define NO 0
+
+static const char in_addrany[] = { 0, 0, 0, 0 };
+static const char in6_addrany[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+static const char in_loopback[] = { 127, 0, 0, 1 };
+static const char in6_loopback[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
};
-struct gaih
- {
- int family;
- int (*gaih)(const char *name, const struct gaih_service *service,
- const struct addrinfo *req, struct addrinfo **pai);
- };
-
-static const struct addrinfo default_hints =
- {
- .ai_flags = AI_DEFAULT,
- .ai_family = PF_UNSPEC,
- .ai_socktype = 0,
- .ai_protocol = 0,
- .ai_addrlen = 0,
- .ai_addr = NULL,
- .ai_canonname = NULL,
- .ai_next = NULL
- };
-
-#define s6_addr32 __u6_addr.__u6_addr32
+static const struct afd {
+ int a_af;
+ int a_addrlen;
+ int a_socklen;
+ int a_off;
+ const char *a_addrany;
+ const char *a_loopback;
+ int a_scoped;
+} afdl [] = {
+#ifdef INET6
+#define N_INET6 0
+ {PF_INET6, sizeof(struct in6_addr),
+ sizeof(struct sockaddr_in6),
+ offsetof(struct sockaddr_in6, sin6_addr),
+ in6_addrany, in6_loopback, 1},
+#define N_INET 1
+#else
+#define N_INET 0
+#endif
+ {PF_INET, sizeof(struct in_addr),
+ sizeof(struct sockaddr_in),
+ offsetof(struct sockaddr_in, sin_addr),
+ in_addrany, in_loopback, 0},
+ {0, 0, 0, 0, NULL, NULL, 0},
+};
+
+struct explore {
+ int e_af;
+ int e_socktype;
+ int e_protocol;
+ const char *e_protostr;
+ int e_wild;
+#define WILD_AF(ex) ((ex)->e_wild & 0x01)
+#define WILD_SOCKTYPE(ex) ((ex)->e_wild & 0x02)
+#define WILD_PROTOCOL(ex) ((ex)->e_wild & 0x04)
+};
+static const struct explore explore[] = {
#if 0
-/* Using Unix sockets this way is a security risk. */
-static int
-gaih_local (const char *name, const struct gaih_service *service,
- const struct addrinfo *req, struct addrinfo **pai)
-{
- struct utsname utsname;
-
- if ((name != NULL) && (req->ai_flags & AI_NUMERICHOST))
- return GAIH_OKIFUNSPEC | -EAI_NONAME;
-
- if ((name != NULL) || (req->ai_flags & AI_CANONNAME))
- if (uname (&utsname) < 0)
- return -EAI_SYSTEM;
-
- if (name != NULL)
- {
- if (strcmp(name, "localhost") &&
- strcmp(name, "local") &&
- strcmp(name, "unix") &&
- strcmp(name, utsname.nodename))
- return GAIH_OKIFUNSPEC | -EAI_NONAME;
- }
-
- if (req->ai_protocol || req->ai_socktype)
- {
- const struct gaih_typeproto *tp = gaih_inet_typeproto + 1;
-
- while (tp->name[0]
- && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0
- || (req->ai_socktype != 0 && req->ai_socktype != tp->socktype)
- || (req->ai_protocol != 0
- && !(tp->protoflag & GAI_PROTO_PROTOANY)
- && req->ai_protocol != tp->protocol)))
- ++tp;
-
- if (! tp->name[0])
- {
- if (req->ai_socktype)
- return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);
- else
- return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
- }
- }
-
- *pai = malloc (sizeof (struct addrinfo) + sizeof (struct sockaddr_un)
- + ((req->ai_flags & AI_CANONNAME)
- ? (strlen(utsname.nodename) + 1): 0));
- if (*pai == NULL)
- return -EAI_MEMORY;
-
- (*pai)->ai_next = NULL;
- (*pai)->ai_flags = req->ai_flags;
- (*pai)->ai_family = AF_LOCAL;
- (*pai)->ai_socktype = req->ai_socktype ? req->ai_socktype : SOCK_STREAM;
- (*pai)->ai_protocol = req->ai_protocol;
- (*pai)->ai_addrlen = sizeof (struct sockaddr_un);
- (*pai)->ai_addr = (void *) (*pai) + sizeof (struct addrinfo);
-
-#if SALEN
- ((struct sockaddr_un *) (*pai)->ai_addr)->sun_len =
- sizeof (struct sockaddr_un);
-#endif /* SALEN */
-
- ((struct sockaddr_un *)(*pai)->ai_addr)->sun_family = AF_LOCAL;
- memset(((struct sockaddr_un *)(*pai)->ai_addr)->sun_path, 0, UNIX_PATH_MAX);
-
- if (service)
- {
- struct sockaddr_un *sunp = (struct sockaddr_un *) (*pai)->ai_addr;
-
- if (strchr (service->name, '/') != NULL)
- {
- if (strlen (service->name) >= sizeof (sunp->sun_path))
- return GAIH_OKIFUNSPEC | -EAI_SERVICE;
-
- strcpy (sunp->sun_path, service->name);
- }
- else
- {
- if (strlen (P_tmpdir "/") + 1 + strlen (service->name) >=
- sizeof (sunp->sun_path))
- return GAIH_OKIFUNSPEC | -EAI_SERVICE;
+ { PF_LOCAL, 0, ANY, ANY, NULL, 0x01 },
+#endif
+#ifdef INET6
+ { PF_INET6, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
+ { PF_INET6, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+ { PF_INET6, SOCK_RAW, ANY, NULL, 0x05 },
+#endif
+ { PF_INET, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
+ { PF_INET, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+ { PF_INET, SOCK_RAW, ANY, NULL, 0x05 },
+ { PF_UNSPEC, SOCK_DGRAM, IPPROTO_UDP, "udp", 0x07 },
+ { PF_UNSPEC, SOCK_STREAM, IPPROTO_TCP, "tcp", 0x07 },
+ { PF_UNSPEC, SOCK_RAW, ANY, NULL, 0x05 },
+ { -1, 0, 0, NULL, 0 },
+};
- __stpcpy (__stpcpy (sunp->sun_path, P_tmpdir "/"), service->name);
- }
- }
- else
- {
- /* This is a dangerous use of the interface since there is a time
- window between the test for the file and the actual creation
- (done by the caller) in which a file with the same name could
- be created. */
- char *buf = ((struct sockaddr_un *) (*pai)->ai_addr)->sun_path;
-
- if (__builtin_expect (__path_search (buf, L_tmpnam, NULL, NULL, 0),
- 0) != 0
- || __builtin_expect (__gen_tempname (buf, __GT_NOCREATE), 0) != 0)
- return -EAI_SYSTEM;
- }
-
- if (req->ai_flags & AI_CANONNAME)
- (*pai)->ai_canonname = strcpy ((char *) *pai + sizeof (struct addrinfo)
- + sizeof (struct sockaddr_un),
- utsname.nodename);
- else
- (*pai)->ai_canonname = NULL;
- return 0;
-}
-#endif /* 0 */
+#ifdef INET6
+#define PTON_MAX 16
+#else
+#define PTON_MAX 4
+#endif
-static int
-gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
- const struct addrinfo *req, struct gaih_servtuple *st)
-{
- struct servent *s;
- size_t tmpbuflen = 1024;
- struct servent ts;
- char *tmpbuf;
- int r;
-
- do
- {
- tmpbuf = alloca (tmpbuflen);
-
- r = __getservbyname_r (servicename, tp->name, &ts, tmpbuf, tmpbuflen,
- &s);
- if (r != 0 || s == NULL)
- {
- if (r == ERANGE)
- tmpbuflen *= 2;
- else
- return GAIH_OKIFUNSPEC | -EAI_SERVICE;
- }
- }
- while (r);
+static const ns_src default_dns_files[] = {
+ { NSSRC_FILES, NS_SUCCESS },
+ { NSSRC_DNS, NS_SUCCESS },
+ { 0 }
+};
+
+#if PACKETSZ > 1024
+#define MAXPACKET PACKETSZ
+#else
+#define MAXPACKET 1024
+#endif
+
+typedef union {
+ HEADER hdr;
+ u_char buf[MAXPACKET];
+} querybuf;
+
+struct res_target {
+ struct res_target *next;
+ const char *name; /* domain name */
+ int qclass, qtype; /* class and type of query */
+ u_char *answer; /* buffer to put answer */
+ int anslen; /* size of answer buffer */
+ int n; /* result length */
+};
- st->next = NULL;
- st->socktype = tp->socktype;
- st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
- ? req->ai_protocol : tp->protocol);
- st->port = s->s_port;
+static int str_isnumber(const char *);
+static int explore_fqdn(const struct addrinfo *, const char *,
+ const char *, struct addrinfo **);
+static int explore_null(const struct addrinfo *,
+ const char *, struct addrinfo **);
+static int explore_numeric(const struct addrinfo *, const char *,
+ const char *, struct addrinfo **);
+static int explore_numeric_scope(const struct addrinfo *, const char *,
+ const char *, struct addrinfo **);
+static int get_canonname(const struct addrinfo *,
+ struct addrinfo *, const char *);
+static struct addrinfo *get_ai(const struct addrinfo *,
+ const struct afd *, const char *);
+static int get_portmatch(const struct addrinfo *, const char *);
+static int get_port(struct addrinfo *, const char *, int);
+static const struct afd *find_afd(int);
+static int addrconfig(struct addrinfo *);
+#ifdef INET6
+static int ip6_str2scopeid(char *, struct sockaddr_in6 *);
+#endif
+
+static struct addrinfo *getanswer(const querybuf *, int, const char *, int,
+ const struct addrinfo *);
+static int _dns_getaddrinfo(void *, void *, va_list);
+static void _sethtent(void);
+static void _endhtent(void);
+static struct addrinfo *_gethtent(const char *, const struct addrinfo *);
+static int _files_getaddrinfo(void *, void *, va_list);
+#ifdef YP
+static struct addrinfo *_yphostent(char *, const struct addrinfo *);
+static int _yp_getaddrinfo(void *, void *, va_list);
+extern int _yp_check(char **);
+#endif
+
+u_int16_t _getshort(const u_char *src);
+
+static int res_queryN(const char *, struct res_target *);
+static int res_searchN(const char *, struct res_target *);
+static int res_querydomainN(const char *, const char *,
+ struct res_target *);
+
+static char *ai_errlist[] = {
+ "Success",
+ "Address family for hostname not supported", /* EAI_ADDRFAMILY */
+ "Temporary failure in name resolution", /* EAI_AGAIN */
+ "Invalid value for ai_flags", /* EAI_BADFLAGS */
+ "Non-recoverable failure in name resolution", /* EAI_FAIL */
+ "ai_family not supported", /* EAI_FAMILY */
+ "Memory allocation failure", /* EAI_MEMORY */
+ "No address associated with hostname", /* EAI_NODATA */
+ "hostname nor servname provided, or not known", /* EAI_NONAME */
+ "servname not supported for ai_socktype", /* EAI_SERVICE */
+ "ai_socktype not supported", /* EAI_SOCKTYPE */
+ "System error returned in errno", /* EAI_SYSTEM */
+ "Invalid value for hints", /* EAI_BADHINTS */
+ "Resolved protocol is unknown", /* EAI_PROTOCOL */
+ "Unknown error", /* EAI_MAX */
+};
- return 0;
+/* XXX macros that make external reference is BAD. */
+
+#define GET_AI(ai, afd, addr) \
+do { \
+ /* external reference: pai, error, and label free */ \
+ (ai) = get_ai(pai, (afd), (addr)); \
+ if ((ai) == NULL) { \
+ error = EAI_MEMORY; \
+ goto free; \
+ } \
+} while (/*CONSTCOND*/0)
+
+#define GET_PORT(ai, serv) \
+do { \
+ /* external reference: error and label free */ \
+ error = get_port((ai), (serv), 0); \
+ if (error != 0) \
+ goto free; \
+} while (/*CONSTCOND*/0)
+
+#define GET_CANONNAME(ai, str) \
+do { \
+ /* external reference: pai, error and label free */ \
+ error = get_canonname(pai, (ai), (str)); \
+ if (error != 0) \
+ goto free; \
+} while (/*CONSTCOND*/0)
+
+#define ERR(err) \
+do { \
+ /* external reference: error, and label bad */ \
+ error = (err); \
+ goto bad; \
+ /*NOTREACHED*/ \
+} while (/*CONSTCOND*/0)
+
+#define MATCH_FAMILY(x, y, w) \
+ ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == PF_UNSPEC || (y) == PF_UNSPEC)))
+#define MATCH(x, y, w) \
+ ((x) == (y) || (/*CONSTCOND*/(w) && ((x) == ANY || (y) == ANY)))
+
+char *
+gai_strerror(ecode)
+ int ecode;
+{
+ if (ecode < 0 || ecode > EAI_MAX)
+ ecode = EAI_MAX;
+ return ai_errlist[ecode];
}
-#define gethosts(_family, _type) \
- { \
- int i; \
- int herrno; \
- struct hostent th; \
- struct hostent *h; \
- char *localcanon = NULL; \
- no_data = 0; \
- while (1) { \
- rc = 0; \
- status = DL_CALL_FCT (fct, (name, _family, &th, tmpbuf, tmpbuflen, \
- &rc, &herrno, NULL, &localcanon)); \
- if (rc != ERANGE || herrno != NETDB_INTERNAL) \
- break; \
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); \
- } \
- if (status == NSS_STATUS_SUCCESS && rc == 0) \
- h = &th; \
- else \
- h = NULL; \
- if (rc != 0) \
- { \
- if (herrno == NETDB_INTERNAL) \
- { \
- h_errno = (herrno); \
- return -EAI_SYSTEM; \
- } \
- if (herrno == TRY_AGAIN) \
- no_data = EAI_AGAIN; \
- else \
- no_data = herrno == NO_DATA; \
- } \
- else if (h != NULL) \
- { \
- for (i = 0; h->h_addr_list[i]; i++) \
- { \
- if (*pat == NULL) \
- { \
- *pat = alloca (sizeof (struct gaih_addrtuple)); \
- (*pat)->scopeid = 0; \
- } \
- uint32_t *addr = (*pat)->addr; \
- (*pat)->next = NULL; \
- if (i == 0) \
- { \
- (*pat)->name = alloca (strlen (h->h_name) + 1); \
- strcpy ((*pat)->name, h->h_name); \
- } \
- else \
- (*pat)->name = NULL; \
- if (_family == AF_INET && req->ai_family == AF_INET6) \
- { \
- (*pat)->family = AF_INET6; \
- addr[3] = *(uint32_t *) h->h_addr_list[i]; \
- addr[2] = htonl (0xffff); \
- addr[1] = 0; \
- addr[0] = 0; \
- } \
- else \
- { \
- (*pat)->family = _family; \
- memcpy (addr, h->h_addr_list[i], sizeof(_type)); \
- } \
- pat = &((*pat)->next); \
- } \
- \
- if (localcanon != NULL && canon == NULL) \
- { \
- canon = alloca (strlen (localcanon) + 1); \
- strcpy (canon, localcanon); \
- } \
- \
- if (_family == AF_INET6 && i > 0) \
- got_ipv6 = true; \
- } \
- }
-
-
-typedef enum nss_status (*nss_gethostbyname3_r)
- (const char *name, int af, struct hostent *host,
- char *buffer, size_t buflen, int *errnop,
- int *h_errnop, int32_t *ttlp, char **canonp);
-typedef enum nss_status (*nss_getcanonname_r)
- (const char *name, char *buffer, size_t buflen, char **result,
- int *errnop, int *h_errnop);
-extern service_user *__nss_hosts_database attribute_hidden;
+void
+freeaddrinfo(ai)
+ struct addrinfo *ai;
+{
+ struct addrinfo *next;
+
+ do {
+ next = ai->ai_next;
+ if (ai->ai_canonname)
+ free(ai->ai_canonname);
+ /* no need to free(ai->ai_addr) */
+ free(ai);
+ ai = next;
+ } while (ai);
+}
static int
-gaih_inet (const char *name, const struct gaih_service *service,
- const struct addrinfo *req, struct addrinfo **pai)
+str_isnumber(p)
+ const char *p;
{
- const struct gaih_typeproto *tp = gaih_inet_typeproto;
- struct gaih_servtuple *st = (struct gaih_servtuple *) &nullserv;
- struct gaih_addrtuple *at = NULL;
- int rc;
- bool got_ipv6 = false;
- const char *canon = NULL;
- const char *orig_name = name;
-
- if (req->ai_protocol || req->ai_socktype)
- {
- ++tp;
-
- while (tp->name[0]
- && ((req->ai_socktype != 0 && req->ai_socktype != tp->socktype)
- || (req->ai_protocol != 0
- && !(tp->protoflag & GAI_PROTO_PROTOANY)
- && req->ai_protocol != tp->protocol)))
- ++tp;
-
- if (! tp->name[0])
- {
- if (req->ai_socktype)
- return (GAIH_OKIFUNSPEC | -EAI_SOCKTYPE);
- else
- return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
- }
- }
-
- if (service != NULL)
- {
- if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0)
- return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
-
- if (service->num < 0)
- {
- if (tp->name[0])
- {
- st = (struct gaih_servtuple *)
- alloca (sizeof (struct gaih_servtuple));
-
- if ((rc = gaih_inet_serv (service->name, tp, req, st)))
- return rc;
- }
- else
- {
- struct gaih_servtuple **pst = &st;
- for (tp++; tp->name[0]; tp++)
- {
- struct gaih_servtuple *newp;
-
- if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0)
- continue;
-
- if (req->ai_socktype != 0
- && req->ai_socktype != tp->socktype)
- continue;
- if (req->ai_protocol != 0
- && !(tp->protoflag & GAI_PROTO_PROTOANY)
- && req->ai_protocol != tp->protocol)
- continue;
-
- newp = (struct gaih_servtuple *)
- alloca (sizeof (struct gaih_servtuple));
-
- if ((rc = gaih_inet_serv (service->name, tp, req, newp)))
- {
- if (rc & GAIH_OKIFUNSPEC)
- continue;
- return rc;
- }
+ char *ep;
+
+ if (*p == '\0')
+ return NO;
+ ep = NULL;
+ (void)strtoul(p, &ep, 10);
+ if (ep && *ep == '\0')
+ return YES;
+ else
+ return NO;
+}
- *pst = newp;
- pst = &(newp->next);
+int
+getaddrinfo(hostname, servname, hints, res)
+ const char *hostname, *servname;
+ const struct addrinfo *hints;
+ struct addrinfo **res;
+{
+ struct addrinfo sentinel;
+ struct addrinfo *cur;
+ int error = 0;
+ struct addrinfo ai;
+ struct addrinfo ai0;
+ struct addrinfo *pai;
+ const struct explore *ex;
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+ pai = &ai;
+ pai->ai_flags = 0;
+ pai->ai_family = PF_UNSPEC;
+ pai->ai_socktype = ANY;
+ pai->ai_protocol = ANY;
+ pai->ai_addrlen = 0;
+ pai->ai_canonname = NULL;
+ pai->ai_addr = NULL;
+ pai->ai_next = NULL;
+
+ if (hostname == NULL && servname == NULL)
+ return EAI_NONAME;
+ if (hints) {
+ /* error check for hints */
+ if (hints->ai_addrlen || hints->ai_canonname ||
+ hints->ai_addr || hints->ai_next)
+ ERR(EAI_BADHINTS); /* xxx */
+ if (hints->ai_flags & ~AI_MASK)
+ ERR(EAI_BADFLAGS);
+ switch (hints->ai_family) {
+ case PF_UNSPEC:
+ case PF_INET:
+#ifdef INET6
+ case PF_INET6:
+#endif
+ break;
+ default:
+ ERR(EAI_FAMILY);
+ }
+ memcpy(pai, hints, sizeof(*pai));
+
+ /*
+ * if both socktype/protocol are specified, check if they
+ * are meaningful combination.
+ */
+ if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) {
+ for (ex = explore; ex->e_af >= 0; ex++) {
+ if (pai->ai_family != ex->e_af)
+ continue;
+ if (ex->e_socktype == ANY)
+ continue;
+ if (ex->e_protocol == ANY)
+ continue;
+ if (pai->ai_socktype == ex->e_socktype
+ && pai->ai_protocol != ex->e_protocol) {
+ ERR(EAI_BADHINTS);
+ }
+ }
}
- if (st == (struct gaih_servtuple *) &nullserv)
- return (GAIH_OKIFUNSPEC | -EAI_SERVICE);
- }
- }
- else
- {
- if (req->ai_socktype || req->ai_protocol)
- {
- st = alloca (sizeof (struct gaih_servtuple));
- st->next = NULL;
- st->socktype = tp->socktype;
- st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
- ? req->ai_protocol : tp->protocol);
- st->port = htons (service->num);
- }
- else
- {
- /* Neither socket type nor protocol is set. Return all
- socket types we know about. */
- struct gaih_servtuple **lastp = &st;
- for (tp = gaih_inet_typeproto + 1; tp->name[0]; ++tp)
- if ((tp->protoflag & GAI_PROTO_NOSERVICE) == 0)
- {
- struct gaih_servtuple *newp;
-
- newp = alloca (sizeof (struct gaih_servtuple));
- newp->next = NULL;
- newp->socktype = tp->socktype;
- newp->protocol = tp->protocol;
- newp->port = htons (service->num);
-
- *lastp = newp;
- lastp = &newp->next;
- }
- }
- }
- }
- else if (req->ai_socktype || req->ai_protocol)
- {
- st = alloca (sizeof (struct gaih_servtuple));
- st->next = NULL;
- st->socktype = tp->socktype;
- st->protocol = ((tp->protoflag & GAI_PROTO_PROTOANY)
- ? req->ai_protocol : tp->protocol);
- st->port = 0;
- }
- else
- {
- /* Neither socket type nor protocol is set. Return all socket types
- we know about. */
- struct gaih_servtuple **lastp = &st;
- for (++tp; tp->name[0]; ++tp)
- {
- struct gaih_servtuple *newp;
-
- newp = alloca (sizeof (struct gaih_servtuple));
- newp->next = NULL;
- newp->socktype = tp->socktype;
- newp->protocol = tp->protocol;
- newp->port = 0;
-
- *lastp = newp;
- lastp = &newp->next;
- }
- }
-
- if (name != NULL)
- {
- at = alloca (sizeof (struct gaih_addrtuple));
-
- at->family = AF_UNSPEC;
- at->scopeid = 0;
- at->next = NULL;
-
-#ifdef HAVE_LIBIDN
- if (req->ai_flags & AI_IDN)
- {
- int idn_flags = 0;
- if (req->ai_flags & AI_IDN_ALLOW_UNASSIGNED)
- idn_flags |= IDNA_ALLOW_UNASSIGNED;
- if (req->ai_flags & AI_IDN_USE_STD3_ASCII_RULES)
- idn_flags |= IDNA_USE_STD3_ASCII_RULES;
-
- char *p = NULL;
- rc = __idna_to_ascii_lz (name, &p, idn_flags);
- if (rc != IDNA_SUCCESS)
- {
- if (rc == IDNA_MALLOC_ERROR)
- return -EAI_MEMORY;
- if (rc == IDNA_DLOPEN_ERROR)
- return -EAI_SYSTEM;
- return -EAI_IDN_ENCODE;
- }
- /* In case the output string is the same as the input string
- no new string has been allocated. */
- if (p != name)
- {
- name = alloca (strlen (p) + 1);
- strcpy (name, p);
- free (p);
- }
}
-#endif
- if (inet_aton (name, (struct in_addr *) at->addr) != 0)
- {
- if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET)
- at->family = AF_INET;
- else if (req->ai_family == AF_INET6 && req->ai_flags & AI_V4MAPPED)
- {
- at->addr[3] = at->addr[0];
- at->addr[2] = htonl (0xffff);
- at->addr[1] = 0;
- at->addr[0] = 0;
- at->family = AF_INET6;
- }
- else
- return -EAI_ADDRFAMILY;
-
- dupname:
- if (req->ai_flags & AI_CANONNAME)
- {
- canon = strdup (name);
- if (canon == NULL)
- return -EAI_MEMORY;
- }
+ /*
+ * post-2553: AI_ALL and AI_V4MAPPED are effective only against
+ * AF_INET6 query. They needs to be ignored if specified in other
+ * occassions.
+ */
+ switch (pai->ai_flags & (AI_ALL | AI_V4MAPPED)) {
+ case AI_V4MAPPED:
+ case AI_ALL | AI_V4MAPPED:
+ if (pai->ai_family != AF_INET6)
+ pai->ai_flags &= ~(AI_ALL | AI_V4MAPPED);
+ break;
+ case AI_ALL:
+#if 1
+ /* illegal */
+ ERR(EAI_BADFLAGS);
+#else
+ pai->ai_flags &= ~(AI_ALL | AI_V4MAPPED);
+#endif
+ break;
}
- if (at->family == AF_UNSPEC)
- {
- char *scope_delim;
- char *namebuf = alloca (strlen (name) + 1);
- strcpy (namebuf, name);
-
- scope_delim = strchr (namebuf, SCOPE_DELIMITER);
- if (scope_delim != NULL)
- *scope_delim = '\0';
-
- if (inet_pton (AF_INET6, namebuf, at->addr) > 0)
- {
- if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6)
- at->family = AF_INET6;
- else if (req->ai_family == AF_INET
- && IN6_IS_ADDR_V4MAPPED ((struct in6_addr *)at->addr))
- {
- at->addr[0] = at->addr[3];
- at->family = AF_INET;
- }
- else
- return -EAI_ADDRFAMILY;
-
- if (scope_delim != NULL)
- {
- int try_numericscope = 0;
- if (IN6_IS_ADDR_LINKLOCAL ((struct in6_addr *)at->addr)
- || IN6_IS_ADDR_MC_LINKLOCAL ((struct in6_addr *)at->addr))
- {
- at->scopeid = if_nametoindex (scope_delim + 1);
- if (at->scopeid == 0)
- try_numericscope = 1;
- }
- else
- try_numericscope = 1;
-
- if (try_numericscope != 0)
- {
- char *end;
- assert (sizeof (uint32_t) <= sizeof (unsigned long));
- at->scopeid = (uint32_t) strtoul (scope_delim + 1, &end,
- 10);
- if (*end != '\0')
- return GAIH_OKIFUNSPEC | -EAI_NONAME;
- }
+ /*
+ * check for special cases. (1) numeric servname is disallowed if
+ * socktype/protocol are left unspecified. (2) servname is disallowed
+ * for raw and other inet{,6} sockets.
+ */
+ if (MATCH_FAMILY(pai->ai_family, PF_INET, 1)
+#ifdef PF_INET6
+ || MATCH_FAMILY(pai->ai_family, PF_INET6, 1)
+#endif
+ ) {
+ ai0 = *pai; /* backup *pai */
+
+ if (pai->ai_family == PF_UNSPEC) {
+#ifdef PF_INET6
+ pai->ai_family = PF_INET6;
+#else
+ pai->ai_family = PF_INET;
+#endif
}
+ error = get_portmatch(pai, servname);
+ if (error)
+ ERR(error);
- goto dupname;
- }
+ *pai = ai0;
}
- if (at->family == AF_UNSPEC && (req->ai_flags & AI_NUMERICHOST) == 0)
- {
- struct gaih_addrtuple **pat = &at;
- int no_data = 0;
- int no_inet6_data = 0;
- service_user *nip = NULL;
- enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
- enum nss_status status = NSS_STATUS_UNAVAIL;
- int no_more;
- int old_res_options;
-
- /* If we do not have to look for IPv4 and IPv6 together, use
- the simple, old functions. */
- if (req->ai_family == AF_INET || req->ai_family == AF_INET6)
- {
- int family = req->ai_family;
- size_t tmpbuflen = 512;
- char *tmpbuf = alloca (tmpbuflen);
- int rc;
- struct hostent th;
- struct hostent *h;
- int herrno;
-
- simple_again:
- while (1)
- {
- rc = __gethostbyname2_r (name, family, &th, tmpbuf,
- tmpbuflen, &h, &herrno);
- if (rc != ERANGE || herrno != NETDB_INTERNAL)
- break;
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
- }
-
- if (rc == 0)
- {
- if (h == NULL)
- {
- if (req->ai_family == AF_INET6
- && (req->ai_flags & AI_V4MAPPED)
- && family == AF_INET6)
- {
- /* Try again, this time looking for IPv4
- addresses. */
- family = AF_INET;
- goto simple_again;
- }
- }
- else
- {
- /* We found data, now convert it into the list. */
- int i = 0;
- for (i = 0; h->h_addr_list[i]; ++i)
- {
- if (*pat == NULL)
- {
- *pat = alloca (sizeof (struct gaih_addrtuple));
- (*pat)->scopeid = 0;
- }
- (*pat)->next = NULL;
- (*pat)->family = req->ai_family;
- if (family == req->ai_family)
- memcpy ((*pat)->addr, h->h_addr_list[i],
- h->h_length);
- else
- {
- int32_t *addr = (uint32_t *) (*pat)->addr;
- addr[3] = *(uint32_t *) h->h_addr_list[i];
- addr[2] = htonl (0xffff);
- addr[1] = 0;
- addr[0] = 0;
- }
- pat = &((*pat)->next);
- }
- }
- }
- else
- {
- if (herrno == NETDB_INTERNAL)
- {
- h_errno = (herrno);
- return -EAI_SYSTEM;
- }
- if (herrno == TRY_AGAIN)
- {
- return -EAI_AGAIN;
- }
- /* We made requests but they turned out no data.
- The name is known, though. */
- return (GAIH_OKIFUNSPEC | -EAI_NODATA);
- }
+ ai0 = *pai;
- goto process_list;
- }
-
-#ifdef USE_NSCD
- if (__nss_not_use_nscd_hosts > 0
- && ++__nss_not_use_nscd_hosts > NSS_NSCD_RETRY)
- __nss_not_use_nscd_hosts = 0;
-
- if (!__nss_not_use_nscd_hosts)
- {
- /* Try to use nscd. */
- struct nscd_ai_result *air = NULL;
- int herrno;
- int err = __nscd_getai (name, &air, &herrno);
- if (air != NULL)
- {
- /* Transform into gaih_addrtuple list. */
- bool added_canon = (req->ai_flags & AI_CANONNAME) == 0;
- char *addrs = air->addrs;
-
- for (int i = 0; i < air->naddrs; ++i)
- {
- socklen_t size = (air->family[i] == AF_INET
- ? INADDRSZ : IN6ADDRSZ);
- if (*pat == NULL)
- {
- *pat = alloca (sizeof (struct gaih_addrtuple));
- (*pat)->scopeid = 0;
- }
- uint32_t *pataddr = (*pat)->addr;
- (*pat)->next = NULL;
- if (added_canon || air->canon == NULL)
- (*pat)->name = NULL;
- else {
- canon = (*pat)->name = alloca (strlen (air->canon) + 1);
- strcpy (canon, air->canon);
- }
-
- if (air->family[i] == AF_INET
- && req->ai_family == AF_INET6
- && (req->ai_flags & AI_V4MAPPED))
- {
- (*pat)->family = AF_INET6;
- pataddr[3] = *(uint32_t *) addrs;
- pataddr[2] = htonl (0xffff);
- pataddr[1] = 0;
- pataddr[0] = 0;
- pat = &((*pat)->next);
- added_canon = true;
- }
- else if (req->ai_family == AF_UNSPEC
- || air->family[i] == req->ai_family)
- {
- (*pat)->family = air->family[i];
- memcpy (pataddr, addrs, size);
- pat = &((*pat)->next);
- added_canon = true;
- if (air->family[i] == AF_INET6)
- got_ipv6 = true;
- }
- addrs += size;
- }
+ /* NULL hostname, or numeric hostname */
+ for (ex = explore; ex->e_af >= 0; ex++) {
+ *pai = ai0;
- free (air);
+ /* PF_UNSPEC entries are prepared for DNS queries only */
+ if (ex->e_af == PF_UNSPEC)
+ continue;
- if (at->family == AF_UNSPEC)
- return (GAIH_OKIFUNSPEC | -EAI_NONAME);
+ if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex)))
+ continue;
+ if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex)))
+ continue;
+ if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex)))
+ continue;
- goto process_list;
- }
- else if (err != 0 && __nss_not_use_nscd_hosts == 0)
- {
- if (herrno == NETDB_INTERNAL && errno == ENOMEM)
- return -EAI_MEMORY;
- if (herrno == TRY_AGAIN)
- return -EAI_AGAIN;
- return -EAI_SYSTEM;
- }
- }
-#endif
+ if (pai->ai_family == PF_UNSPEC)
+ pai->ai_family = ex->e_af;
+ if (pai->ai_socktype == ANY && ex->e_socktype != ANY)
+ pai->ai_socktype = ex->e_socktype;
+ if (pai->ai_protocol == ANY && ex->e_protocol != ANY)
+ pai->ai_protocol = ex->e_protocol;
- if (__nss_hosts_database != NULL)
- {
- no_more = 0;
- nip = __nss_hosts_database;
- }
- else
- no_more = __nss_database_lookup ("hosts", NULL,
- "dns [!UNAVAIL=return] files",
- &nip);
-
- if (__res_maybe_init (&_res, 0) == -1)
- no_more = 1;
-
- /* If we are looking for both IPv4 and IPv6 address we don't
- want the lookup functions to automatically promote IPv4
- addresses to IPv6 addresses. Currently this is decided
- by setting the RES_USE_INET6 bit in _res.options. */
- old_res_options = _res.options;
- _res.options &= ~RES_USE_INET6;
-
- size_t tmpbuflen = 512;
- char *tmpbuf = alloca (tmpbuflen);
-
- while (!no_more)
- {
- nss_gethostbyname3_r fct = NULL;
- if (req->ai_flags & AI_CANONNAME)
- /* No need to use this function if we do not look for
- the canonical name. The function does not exist in
- all NSS modules and therefore the lookup would
- often fail. */
- fct = __nss_lookup_function (nip, "gethostbyname3_r");
- if (fct == NULL)
- /* We are cheating here. The gethostbyname2_r function does
- not have the same interface as gethostbyname3_r but the
- extra arguments the latter takes are added at the end.
- So the gethostbyname2_r code will just ignore them. */
- fct = __nss_lookup_function (nip, "gethostbyname2_r");
-
- if (fct != NULL)
- {
- if (req->ai_family == AF_INET6
- || req->ai_family == AF_UNSPEC)
- {
- gethosts (AF_INET6, struct in6_addr);
- no_inet6_data = no_data;
- inet6_status = status;
- }
- if (req->ai_family == AF_INET
- || req->ai_family == AF_UNSPEC
- || (req->ai_family == AF_INET6
- && (req->ai_flags & AI_V4MAPPED)
- /* Avoid generating the mapped addresses if we
- know we are not going to need them. */
- && ((req->ai_flags & AI_ALL) || !got_ipv6)))
- {
- gethosts (AF_INET, struct in_addr);
-
- if (req->ai_family == AF_INET)
- {
- no_inet6_data = no_data;
- inet6_status = status;
- }
- }
-
- /* If we found one address for AF_INET or AF_INET6,
- don't continue the search. */
- if (inet6_status == NSS_STATUS_SUCCESS
- || status == NSS_STATUS_SUCCESS)
- {
- if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
- {
- /* If we need the canonical name, get it
- from the same service as the result. */
- nss_getcanonname_r cfct;
- int herrno;
-
- cfct = __nss_lookup_function (nip, "getcanonname_r");
- if (cfct != NULL)
- {
- const size_t max_fqdn_len = 256;
- char *buf = alloca (max_fqdn_len);
- char *s;
-
- if (DL_CALL_FCT (cfct, (at->name ?: name, buf,
- max_fqdn_len, &s, &rc,
- &herrno))
- == NSS_STATUS_SUCCESS)
- canon = s;
- else
- /* Set to name now to avoid using
- gethostbyaddr. */
- canon = name;
- }
- }
+ if (hostname == NULL)
+ error = explore_null(pai, servname, &cur->ai_next);
+ else
+ error = explore_numeric_scope(pai, hostname, servname, &cur->ai_next);
- break;
- }
+ if (error)
+ goto free;
- /* We can have different states for AF_INET and
- AF_INET6. Try to find a useful one for both. */
- if (inet6_status == NSS_STATUS_TRYAGAIN)
- status = NSS_STATUS_TRYAGAIN;
- else if (status == NSS_STATUS_UNAVAIL &&
- inet6_status != NSS_STATUS_UNAVAIL)
- status = inet6_status;
- }
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ }
- if (nss_next_action (nip, status) == NSS_ACTION_RETURN)
- break;
+ /*
+ * XXX
+ * If numreic representation of AF1 can be interpreted as FQDN
+ * representation of AF2, we need to think again about the code below.
+ */
+ if (sentinel.ai_next)
+ goto good;
+
+ if (pai->ai_flags & AI_NUMERICHOST)
+ ERR(EAI_NONAME);
+ if (hostname == NULL)
+ ERR(EAI_NODATA);
+
+ if ((pai->ai_flags & AI_ADDRCONFIG) != 0 && !addrconfig(&ai0))
+ ERR(EAI_FAIL);
+
+ /*
+ * hostname as alphabetical name.
+ * we would like to prefer AF_INET6 than AF_INET, so we'll make a
+ * outer loop by AFs.
+ */
+ for (ex = explore; ex->e_af >= 0; ex++) {
+ *pai = ai0;
+
+ /* require exact match for family field */
+ if (pai->ai_family != ex->e_af)
+ continue;
- if (nip->next == NULL)
- no_more = -1;
- else
- nip = nip->next;
- }
+ if (!MATCH(pai->ai_socktype, ex->e_socktype,
+ WILD_SOCKTYPE(ex))) {
+ continue;
+ }
+ if (!MATCH(pai->ai_protocol, ex->e_protocol,
+ WILD_PROTOCOL(ex))) {
+ continue;
+ }
- _res.options = old_res_options;
+ if (pai->ai_socktype == ANY && ex->e_socktype != ANY)
+ pai->ai_socktype = ex->e_socktype;
+ if (pai->ai_protocol == ANY && ex->e_protocol != ANY)
+ pai->ai_protocol = ex->e_protocol;
- if (no_data != 0 && no_inet6_data != 0)
- {
- /* If both requests timed out report this. */
- if (no_data == EAI_AGAIN && no_inet6_data == EAI_AGAIN)
- return -EAI_AGAIN;
+ error = explore_fqdn(pai, hostname, servname,
+ &cur->ai_next);
- /* We made requests but they turned out no data. The name
- is known, though. */
- return (GAIH_OKIFUNSPEC | -EAI_NODATA);
- }
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
}
- process_list:
- if (at->family == AF_UNSPEC)
- return (GAIH_OKIFUNSPEC | -EAI_NONAME);
- }
- else
- {
- struct gaih_addrtuple *atr;
- atr = at = alloca (sizeof (struct gaih_addrtuple));
- memset (at, '\0', sizeof (struct gaih_addrtuple));
-
- if (req->ai_family == AF_UNSPEC)
- {
- at->next = alloca (sizeof (struct gaih_addrtuple));
- memset (at->next, '\0', sizeof (struct gaih_addrtuple));
+ /* XXX */
+ if (sentinel.ai_next)
+ error = 0;
+
+ if (error)
+ goto free;
+ if (error == 0) {
+ if (sentinel.ai_next) {
+ good:
+ *res = sentinel.ai_next;
+ return SUCCESS;
+ } else
+ error = EAI_FAIL;
}
+ free:
+ bad:
+ if (sentinel.ai_next)
+ freeaddrinfo(sentinel.ai_next);
+ *res = NULL;
+ return error;
+}
- if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET6)
- {
- at->family = AF_INET6;
- if ((req->ai_flags & AI_PASSIVE) == 0)
- memcpy (at->addr, &in6addr_loopback, sizeof (struct in6_addr));
- atr = at->next;
+/*
+ * FQDN hostname, DNS lookup
+ */
+static int
+explore_fqdn(pai, hostname, servname, res)
+ const struct addrinfo *pai;
+ const char *hostname;
+ const char *servname;
+ struct addrinfo **res;
+{
+ struct addrinfo *result;
+ struct addrinfo *cur;
+ int error = 0;
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_files_getaddrinfo, NULL)
+ { NSSRC_DNS, _dns_getaddrinfo, NULL }, /* force -DHESIOD */
+ NS_NIS_CB(_yp_getaddrinfo, NULL)
+ { 0 }
+ };
+
+ result = NULL;
+
+ /*
+ * if the servname does not match socktype/protocol, ignore it.
+ */
+ if (get_portmatch(pai, servname) != 0)
+ return 0;
+
+ switch (nsdispatch(&result, dtab, NSDB_HOSTS, "getaddrinfo",
+ default_dns_files, hostname, pai)) {
+ case NS_TRYAGAIN:
+ error = EAI_AGAIN;
+ goto free;
+ case NS_UNAVAIL:
+ error = EAI_FAIL;
+ goto free;
+ case NS_NOTFOUND:
+ error = EAI_NODATA;
+ goto free;
+ case NS_SUCCESS:
+ error = 0;
+ for (cur = result; cur; cur = cur->ai_next) {
+ GET_PORT(cur, servname);
+ /* canonname should be filled already */
+ }
+ break;
}
- if (req->ai_family == AF_UNSPEC || req->ai_family == AF_INET)
- {
- atr->family = AF_INET;
- if ((req->ai_flags & AI_PASSIVE) == 0)
- atr->addr[0] = htonl (INADDR_LOOPBACK);
- }
- }
-
- if (pai == NULL)
- return 0;
-
- {
- struct gaih_servtuple *st2;
- struct gaih_addrtuple *at2 = at;
- size_t socklen;
- sa_family_t family;
-
- /*
- buffer is the size of an unformatted IPv6 address in printable format.
- */
- while (at2 != NULL)
- {
- /* Only the first entry gets the canonical name. */
- if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0)
- {
- if (canon == NULL)
- {
- struct hostent *h = NULL;
- int herrno;
- struct hostent th;
- size_t tmpbuflen = 512;
- char *tmpbuf = NULL;
-
- do
- {
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2);
- rc = __gethostbyaddr_r (at2->addr,
- ((at2->family == AF_INET6)
- ? sizeof (struct in6_addr)
- : sizeof (struct in_addr)),
- at2->family, &th, tmpbuf,
- tmpbuflen, &h, &herrno);
- }
- while (rc == ERANGE && herrno == NETDB_INTERNAL);
-
- if (rc != 0 && herrno == NETDB_INTERNAL)
- {
- h_errno = (herrno);
- return -EAI_SYSTEM;
- }
-
- if (h != NULL)
- canon = h->h_name;
- else
- {
- assert (orig_name != NULL);
- /* If the canonical name cannot be determined, use
- the passed in string. */
- canon = orig_name;
- }
- }
-
-#ifdef HAVE_LIBIDN
- if (req->ai_flags & AI_CANONIDN)
- {
- int idn_flags = 0;
- if (req->ai_flags & AI_IDN_ALLOW_UNASSIGNED)
- idn_flags |= IDNA_ALLOW_UNASSIGNED;
- if (req->ai_flags & AI_IDN_USE_STD3_ASCII_RULES)
- idn_flags |= IDNA_USE_STD3_ASCII_RULES;
-
- char *out;
- int rc = __idna_to_unicode_lzlz (canon, &out, idn_flags);
- if (rc != IDNA_SUCCESS)
- {
- if (rc == IDNA_MALLOC_ERROR)
- return -EAI_MEMORY;
- if (rc == IDNA_DLOPEN_ERROR)
- return -EAI_SYSTEM;
- return -EAI_IDN_ENCODE;
- }
- /* In case the output string is the same as the input
- string no new string has been allocated. Otherwise
- make a copy. */
- if (out == canon)
- goto make_copy;
- }
- else
-#endif
- {
-#ifdef HAVE_LIBIDN
- make_copy:
-#endif
- canon = strdup (canon);
- if (canon == NULL)
- return -EAI_MEMORY;
- }
- }
-
- if (at2->family == AF_INET6)
- {
- family = AF_INET6;
- socklen = sizeof (struct sockaddr_in6);
-
- /* If we looked up IPv4 mapped address discard them here if
- the caller isn't interested in all address and we have
- found at least one IPv6 address. */
- if (got_ipv6
- && (req->ai_flags & (AI_V4MAPPED|AI_ALL)) == AI_V4MAPPED
- && IN6_IS_ADDR_V4MAPPED ((struct in6_addr *)at2->addr))
- goto ignore;
- }
- else
- {
- family = AF_INET;
- socklen = sizeof (struct sockaddr_in);
- }
-
- for (st2 = st; st2 != NULL; st2 = st2->next)
- {
- struct addrinfo *ai;
- ai = *pai = malloc (sizeof (struct addrinfo) + socklen);
- if (ai == NULL)
- return -EAI_MEMORY;
-
- ai->ai_flags = req->ai_flags;
- ai->ai_family = family;
- ai->ai_socktype = st2->socktype;
- ai->ai_protocol = st2->protocol;
- ai->ai_addrlen = socklen;
- ai->ai_addr = (void *) (ai + 1);
-
- /* We only add the canonical name once. */
- ai->ai_canonname = (char *) canon;
- canon = NULL;
-
-#if SALEN
- ai->ai_addr->sa_len = socklen;
-#endif /* SALEN */
- ai->ai_addr->sa_family = family;
-
- if (family == AF_INET6)
- {
- struct sockaddr_in6 *sin6p =
- (struct sockaddr_in6 *) ai->ai_addr;
-
- sin6p->sin6_port = st2->port;
- sin6p->sin6_flowinfo = 0;
- memcpy (&sin6p->sin6_addr,
- at2->addr, sizeof (struct in6_addr));
- sin6p->sin6_scope_id = at2->scopeid;
- }
- else
- {
- struct sockaddr_in *sinp =
- (struct sockaddr_in *) ai->ai_addr;
- sinp->sin_port = st2->port;
- memcpy (&sinp->sin_addr,
- at2->addr, sizeof (struct in_addr));
- memset (sinp->sin_zero, '\0', sizeof (sinp->sin_zero));
- }
-
- pai = &(ai->ai_next);
- }
- *pai = NULL;
-
- ignore:
- at2 = at2->next;
- }
- }
- return 0;
-}
+ *res = result;
-static struct gaih gaih[] =
- {
- { PF_INET6, gaih_inet },
- { PF_INET, gaih_inet },
-#if 0
- { PF_LOCAL, gaih_local },
-#endif
- { PF_UNSPEC, NULL }
- };
+ return 0;
+
+free:
+ if (result)
+ freeaddrinfo(result);
+ return error;
+}
-struct sort_result
+/*
+ * hostname == NULL.
+ * passive socket -> anyaddr (0.0.0.0 or ::)
+ * non-passive socket -> localhost (127.0.0.1 or ::1)
+ */
+static int
+explore_null(pai, servname, res)
+ const struct addrinfo *pai;
+ const char *servname;
+ struct addrinfo **res;
{
- struct addrinfo *dest_addr;
- struct sockaddr_storage source_addr;
- uint8_t source_addr_len;
- bool got_source_addr;
-};
+ int s;
+ const struct afd *afd;
+ struct addrinfo *cur;
+ struct addrinfo sentinel;
+ int error;
+
+ *res = NULL;
+ sentinel.ai_next = NULL;
+ cur = &sentinel;
+
+ /*
+ * filter out AFs that are not supported by the kernel
+ * XXX errno?
+ */
+ s = socket(pai->ai_family, SOCK_DGRAM, 0);
+ if (s < 0) {
+ if (errno != EMFILE)
+ return 0;
+ } else
+ close(s);
+
+ /*
+ * if the servname does not match socktype/protocol, ignore it.
+ */
+ if (get_portmatch(pai, servname) != 0)
+ return 0;
+
+ afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
+
+ if (pai->ai_flags & AI_PASSIVE) {
+ GET_AI(cur->ai_next, afd, afd->a_addrany);
+ /* xxx meaningless?
+ * GET_CANONNAME(cur->ai_next, "anyaddr");
+ */
+ GET_PORT(cur->ai_next, servname);
+ } else {
+ GET_AI(cur->ai_next, afd, afd->a_loopback);
+ /* xxx meaningless?
+ * GET_CANONNAME(cur->ai_next, "localhost");
+ */
+ GET_PORT(cur->ai_next, servname);
+ }
+ cur = cur->ai_next;
+
+ *res = sentinel.ai_next;
+ return 0;
+free:
+ if (sentinel.ai_next)
+ freeaddrinfo(sentinel.ai_next);
+ return error;
+}
+/*
+ * numeric hostname
+ */
static int
-get_scope (const struct sockaddr_storage *ss)
+explore_numeric(pai, hostname, servname, res)
+ const struct addrinfo *pai;
+ const char *hostname;
+ const char *servname;
+ struct addrinfo **res;
{
- int scope;
- if (ss->ss_family == PF_INET6)
- {
- const struct sockaddr_in6 *in6 = (const struct sockaddr_in6 *) ss;
-
- if (! IN6_IS_ADDR_MULTICAST (&in6->sin6_addr))
- {
- if (IN6_IS_ADDR_LINKLOCAL (&in6->sin6_addr))
- scope = 2;
- else if (IN6_IS_ADDR_SITELOCAL (&in6->sin6_addr))
- scope = 5;
- else
- /* XXX Is this the correct default behavior? */
- scope = 14;
+ const struct afd *afd;
+ struct addrinfo *cur;
+ struct addrinfo sentinel;
+ int error;
+ char pton[PTON_MAX];
+
+ *res = NULL;
+ sentinel.ai_next = NULL;
+ cur = &sentinel;
+
+ /*
+ * if the servname does not match socktype/protocol, ignore it.
+ */
+ if (get_portmatch(pai, servname) != 0)
+ return 0;
+
+ afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
+
+ switch (afd->a_af) {
+#if 1 /*X/Open spec*/
+ case AF_INET:
+ if (inet_aton(hostname, (struct in_addr *)pton) == 1) {
+ if (pai->ai_family == afd->a_af ||
+ pai->ai_family == PF_UNSPEC /*?*/) {
+ GET_AI(cur->ai_next, afd, pton);
+ GET_PORT(cur->ai_next, servname);
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ } else
+ ERR(EAI_FAMILY); /*xxx*/
+ }
+ break;
+#endif
+ default:
+ if (inet_pton(afd->a_af, hostname, pton) == 1) {
+ if (pai->ai_family == afd->a_af ||
+ pai->ai_family == PF_UNSPEC /*?*/) {
+ GET_AI(cur->ai_next, afd, pton);
+ GET_PORT(cur->ai_next, servname);
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ } else
+ ERR(EAI_FAMILY); /*xxx*/
+ }
+ break;
}
- else
- scope = in6->sin6_addr.s6_addr[1] & 0xf;
- }
- else if (ss->ss_family == PF_INET)
- {
- const struct sockaddr_in *in = (const struct sockaddr_in *) ss;
- const uint8_t *addr = (const uint8_t *) &in->sin_addr;
-
- /* RFC 3484 specifies how to map IPv6 addresses to scopes.
- 169.254/16 and 127/8 are link-local. */
- if ((addr[0] == 169 && addr[1] == 254) || addr[0] == 127)
- scope = 2;
- else if (addr[0] == 10 || (addr[0] == 172 && addr[1] == 16)
- || (addr[0] == 192 && addr[1] == 168))
- scope = 5;
- else
- scope = 14;
- }
- else
- /* XXX What is a good default? */
- scope = 15;
-
- return scope;
-}
+ *res = sentinel.ai_next;
+ return 0;
-/* XXX The system administrator should be able to install other
- tables. We need to make this configurable. The problem is that
- the kernel is also involved since it needs the same table. */
-static const struct prefixlist
+free:
+bad:
+ if (sentinel.ai_next)
+ freeaddrinfo(sentinel.ai_next);
+ return error;
+}
+
+/*
+ * numeric hostname with scope
+ */
+static int
+explore_numeric_scope(pai, hostname, servname, res)
+ const struct addrinfo *pai;
+ const char *hostname;
+ const char *servname;
+ struct addrinfo **res;
{
- struct in6_addr prefix;
- unsigned int bits;
- int val;
-} default_labels[] =
- {
- /* See RFC 3484 for the details. */
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0001 } } },
- 128, 0 },
- { { .__u6_addr = { .__u6_addr16 = { 0x2002, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000 } } },
- 16, 2 },
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000 } } },
- 96, 3 },
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0xffff, 0x0000, 0x0000 } } },
- 96, 4 },
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000 } } },
- 0, 1 }
- };
-
-
-static const struct prefixlist default_precedence[] =
- {
- /* See RFC 3484 for the details. */
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0001 } } },
- 128, 50 },
- { { .__u6_addr = { .__u6_addr16 = { 0x2002, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000 } } },
- 16, 30 },
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000 } } },
- 96, 20 },
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0xffff, 0x0000, 0x0000 } } },
- 96, 10 },
- { { .__u6_addr = { .__u6_addr16 = { 0x0000, 0x0000, 0x0000, 0x0000,
- 0x0000, 0x0000, 0x0000, 0x0000 } } },
- 0, 40 }
- };
+#if !defined(SCOPE_DELIMITER) || !defined(INET6)
+ return explore_numeric(pai, hostname, servname, res);
+#else
+ const struct afd *afd;
+ struct addrinfo *cur;
+ int error;
+ char *cp, *hostname2 = NULL, *scope, *addr;
+ struct sockaddr_in6 *sin6;
+
+ /*
+ * if the servname does not match socktype/protocol, ignore it.
+ */
+ if (get_portmatch(pai, servname) != 0)
+ return 0;
+
+ afd = find_afd(pai->ai_family);
+ if (afd == NULL)
+ return 0;
+
+ if (!afd->a_scoped)
+ return explore_numeric(pai, hostname, servname, res);
+
+ cp = strchr(hostname, SCOPE_DELIMITER);
+ if (cp == NULL)
+ return explore_numeric(pai, hostname, servname, res);
+
+ /*
+ * Handle special case of <scoped_address><delimiter><scope id>
+ */
+ hostname2 = strdup(hostname);
+ if (hostname2 == NULL)
+ return EAI_MEMORY;
+ /* terminate at the delimiter */
+ hostname2[cp - hostname] = '\0';
+ addr = hostname2;
+ scope = cp + 1;
+
+ error = explore_numeric(pai, addr, servname, res);
+ if (error == 0) {
+ int scopeid;
+
+ for (cur = *res; cur; cur = cur->ai_next) {
+ if (cur->ai_family != AF_INET6)
+ continue;
+ sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr;
+ if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) {
+ free(hostname2);
+ return(EAI_NODATA); /* XXX: is return OK? */
+ }
+ sin6->sin6_scope_id = scopeid;
+ }
+ }
+ free(hostname2);
+
+ return error;
+#endif
+}
static int
-match_prefix (const struct sockaddr_storage *ss, const struct prefixlist *list,
- int default_val)
+get_canonname(pai, ai, str)
+ const struct addrinfo *pai;
+ struct addrinfo *ai;
+ const char *str;
{
- int idx;
- struct sockaddr_in6 in6_mem;
- const struct sockaddr_in6 *in6;
-
- if (ss->ss_family == PF_INET6)
- in6 = (const struct sockaddr_in6 *) ss;
- else if (ss->ss_family == PF_INET)
- {
- const struct sockaddr_in *in = (const struct sockaddr_in *) ss;
-
- /* Convert to IPv6 address. */
- in6_mem.sin6_family = PF_INET6;
- in6_mem.sin6_port = in->sin_port;
- in6_mem.sin6_flowinfo = 0;
- if (in->sin_addr.s_addr == htonl (0x7f000001))
- in6_mem.sin6_addr = (struct in6_addr) IN6ADDR_LOOPBACK_INIT;
- else
- {
- /* Construct a V4-to-6 mapped address. */
- memset (&in6_mem.sin6_addr, '\0', sizeof (in6_mem.sin6_addr));
- in6_mem.sin6_addr.__u6_addr.__u6_addr16[5] = 0xffff;
- in6_mem.sin6_addr.__u6_addr.__u6_addr32[3] = in->sin_addr.s_addr;
- in6_mem.sin6_scope_id = 0;
+ if ((pai->ai_flags & AI_CANONNAME) != 0) {
+ ai->ai_canonname = (char *)malloc(strlen(str) + 1);
+ if (ai->ai_canonname == NULL)
+ return EAI_MEMORY;
+ strcpy(ai->ai_canonname, str);
}
+ return 0;
+}
- in6 = &in6_mem;
- }
- else
- return default_val;
-
- for (idx = 0; ; ++idx)
- {
- unsigned int bits = list[idx].bits;
- uint8_t *mask = list[idx].prefix.s6_addr;
- uint8_t *val = in6->sin6_addr.s6_addr;
-
- while (bits > 8)
- {
- if (*mask != *val)
- break;
-
- ++mask;
- ++val;
- bits -= 8;
- }
+static struct addrinfo *
+get_ai(pai, afd, addr)
+ const struct addrinfo *pai;
+ const struct afd *afd;
+ const char *addr;
+{
+ char *p;
+ struct addrinfo *ai;
+#ifdef FAITH
+ struct in6_addr faith_prefix;
+ char *fp_str;
+ int translate = 0;
+#endif
- if (bits < 8)
- {
- if ((*mask & (0xff00 >> bits)) == (*val & (0xff00 >> bits)))
- /* Match! */
- break;
+#ifdef FAITH
+ /*
+ * Transfrom an IPv4 addr into a special IPv6 addr format for
+ * IPv6->IPv4 translation gateway. (only TCP is supported now)
+ *
+ * +-----------------------------------+------------+
+ * | faith prefix part (12 bytes) | embedded |
+ * | | IPv4 addr part (4 bytes)
+ * +-----------------------------------+------------+
+ *
+ * faith prefix part is specified as ascii IPv6 addr format
+ * in environmental variable GAI.
+ * For FAITH to work correctly, routing to faith prefix must be
+ * setup toward a machine where a FAITH daemon operates.
+ * Also, the machine must enable some mechanizm
+ * (e.g. faith interface hack) to divert those packet with
+ * faith prefixed destination addr to user-land FAITH daemon.
+ */
+ fp_str = getenv("GAI");
+ if (fp_str && inet_pton(AF_INET6, fp_str, &faith_prefix) == 1 &&
+ afd->a_af == AF_INET && pai->ai_socktype == SOCK_STREAM) {
+ u_int32_t v4a;
+ u_int8_t v4a_top;
+
+ memcpy(&v4a, addr, sizeof v4a);
+ v4a_top = v4a >> IN_CLASSA_NSHIFT;
+ if (!IN_MULTICAST(v4a) && !IN_EXPERIMENTAL(v4a) &&
+ v4a_top != 0 && v4a != IN_LOOPBACKNET) {
+ afd = &afdl[N_INET6];
+ memcpy(&faith_prefix.s6_addr[12], addr,
+ sizeof(struct in_addr));
+ translate = 1;
+ }
}
- }
+#endif
- return list[idx].val;
+ ai = (struct addrinfo *)malloc(sizeof(struct addrinfo)
+ + (afd->a_socklen));
+ if (ai == NULL)
+ return NULL;
+
+ memcpy(ai, pai, sizeof(struct addrinfo));
+ ai->ai_addr = (struct sockaddr *)(void *)(ai + 1);
+ memset(ai->ai_addr, 0, (size_t)afd->a_socklen);
+ ai->ai_addrlen = afd->a_socklen;
+ ai->ai_addr->sa_family = ai->ai_family = afd->a_af;
+ p = (char *)(void *)(ai->ai_addr);
+#ifdef FAITH
+ if (translate == 1)
+ memcpy(p + afd->a_off, &faith_prefix, (size_t)afd->a_addrlen);
+ else
+#endif
+ memcpy(p + afd->a_off, addr, (size_t)afd->a_addrlen);
+ return ai;
}
-
static int
-get_label (const struct sockaddr_storage *ss)
+get_portmatch(ai, servname)
+ const struct addrinfo *ai;
+ const char *servname;
{
- /* XXX What is a good default value? */
- return match_prefix (ss, default_labels, INT_MAX);
-}
+ /* get_port does not touch first argument. when matchonly == 1. */
+ /* LINTED const cast */
+ return get_port((struct addrinfo *)ai, servname, 1);
+}
static int
-get_precedence (const struct sockaddr_storage *ss)
+get_port(ai, servname, matchonly)
+ struct addrinfo *ai;
+ const char *servname;
+ int matchonly;
{
- /* XXX What is a good default value? */
- return match_prefix (ss, default_precedence, 0);
-}
+ const char *proto;
+ struct servent *sp;
+ int port;
+ int allownumeric;
+
+ if (servname == NULL)
+ return 0;
+ switch (ai->ai_family) {
+ case AF_INET:
+#ifdef AF_INET6
+ case AF_INET6:
+#endif
+ break;
+ default:
+ return 0;
+ }
+ switch (ai->ai_socktype) {
+ case SOCK_RAW:
+ return EAI_SERVICE;
+ case SOCK_DGRAM:
+ case SOCK_STREAM:
+ allownumeric = 1;
+ break;
+ case ANY:
+ allownumeric = 0;
+ break;
+ default:
+ return EAI_SOCKTYPE;
+ }
-static int
-rfc3484_sort (const void *p1, const void *p2)
-{
- const struct sort_result *a1 = (const struct sort_result *) p1;
- const struct sort_result *a2 = (const struct sort_result *) p2;
+ if (str_isnumber(servname)) {
+ if (!allownumeric)
+ return EAI_SERVICE;
+ port = htons(atoi(servname));
+ if (port < 0 || port > 65535)
+ return EAI_SERVICE;
+ } else {
+ switch (ai->ai_socktype) {
+ case SOCK_DGRAM:
+ proto = "udp";
+ break;
+ case SOCK_STREAM:
+ proto = "tcp";
+ break;
+ default:
+ proto = NULL;
+ break;
+ }
- /* Rule 1: Avoid unusable destinations.
- We have the got_source_addr flag set if the destination is reachable. */
- if (a1->got_source_addr && ! a2->got_source_addr)
- return -1;
- if (! a1->got_source_addr && a2->got_source_addr)
- return 1;
+ if ((sp = getservbyname(servname, proto)) == NULL)
+ return EAI_SERVICE;
+ port = sp->s_port;
+ }
+ if (!matchonly) {
+ switch (ai->ai_family) {
+ case AF_INET:
+ ((struct sockaddr_in *)(void *)
+ ai->ai_addr)->sin_port = port;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ ((struct sockaddr_in6 *)(void *)
+ ai->ai_addr)->sin6_port = port;
+ break;
+#endif
+ }
+ }
- /* Rule 2: Prefer matching scope. Only interesting if both
- destination addresses are IPv6. */
- int a1_dst_scope
- = get_scope ((struct sockaddr_storage *) a1->dest_addr->ai_addr);
+ return 0;
+}
- int a2_dst_scope
- = get_scope ((struct sockaddr_storage *) a2->dest_addr->ai_addr);
+static const struct afd *
+find_afd(af)
+ int af;
+{
+ const struct afd *afd;
- if (a1->got_source_addr)
- {
- int a1_src_scope = get_scope (&a1->source_addr);
- int a2_src_scope = get_scope (&a2->source_addr);
+ if (af == PF_UNSPEC)
+ return NULL;
+ for (afd = afdl; afd->a_af; afd++) {
+ if (afd->a_af == af)
+ return afd;
+ }
+ return NULL;
+}
- if (a1_dst_scope == a1_src_scope && a2_dst_scope != a2_src_scope)
- return -1;
- if (a1_dst_scope != a1_src_scope && a2_dst_scope == a2_src_scope)
+/*
+ * post-2553: AI_ADDRCONFIG check. if we use getipnodeby* as backend, backend
+ * will take care of it.
+ * the semantics of AI_ADDRCONFIG is not defined well. we are not sure
+ * if the code is right or not.
+ *
+ * XXX PF_UNSPEC -> PF_INET6 + PF_INET mapping needs to be in sync with
+ * _dns_getaddrinfo.
+ */
+static int
+addrconfig(pai)
+ struct addrinfo *pai;
+{
+ int s, af;
+
+ /*
+ * TODO:
+ * Note that implementation dependent test for address
+ * configuration should be done everytime called
+ * (or apropriate interval),
+ * because addresses will be dynamically assigned or deleted.
+ */
+ af = pai->ai_family;
+ if (af == AF_UNSPEC) {
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ af = AF_INET;
+ else {
+ close(s);
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ af = AF_INET6;
+ else
+ close(s);
+ }
+ }
+ if (af != AF_UNSPEC) {
+ if ((s = socket(af, SOCK_DGRAM, 0)) < 0)
+ return 0;
+ close(s);
+ }
+ pai->ai_family = af;
return 1;
- }
+}
+#ifdef INET6
+/* convert a string to a scope identifier. XXX: IPv6 specific */
+static int
+ip6_str2scopeid(scope, sin6)
+ char *scope;
+ struct sockaddr_in6 *sin6;
+{
+ int scopeid;
+ struct in6_addr *a6 = &sin6->sin6_addr;
+ char *ep;
+
+ /* empty scopeid portion is invalid */
+ if (*scope == '\0')
+ return -1;
+
+ if (IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) {
+ /*
+ * We currently assume a one-to-one mapping between links
+ * and interfaces, so we simply use interface indices for
+ * like-local scopes.
+ */
+ scopeid = if_nametoindex(scope);
+ if (scopeid == 0)
+ goto trynumeric;
+ return(scopeid);
+ }
- /* Rule 3: Avoid deprecated addresses.
- That's something only the kernel could decide. */
+ /* still unclear about literal, allow numeric only - placeholder */
+ if (IN6_IS_ADDR_SITELOCAL(a6) || IN6_IS_ADDR_MC_SITELOCAL(a6))
+ goto trynumeric;
+ if (IN6_IS_ADDR_MC_ORGLOCAL(a6))
+ goto trynumeric;
+ else
+ goto trynumeric; /* global */
- /* Rule 4: Prefer home addresses.
- Another thing only the kernel can decide. */
+ /* try to convert to a numeric id as a last resort */
+ trynumeric:
+ scopeid = (int)strtoul(scope, &ep, 10);
+ if (*ep == '\0')
+ return scopeid;
+ else
+ return -1;
+}
+#endif
- /* Rule 5: Prefer matching label. */
- if (a1->got_source_addr)
- {
- int a1_dst_label
- = get_label ((struct sockaddr_storage *) a1->dest_addr->ai_addr);
- int a1_src_label = get_label (&a1->source_addr);
+#ifdef DEBUG
+static const char AskedForGot[] =
+ "gethostby*.getanswer: asked for \"%s\", got \"%s\"";
+#endif
+static FILE *hostf = NULL;
+
+static struct addrinfo *
+getanswer(answer, anslen, qname, qtype, pai)
+ const querybuf *answer;
+ int anslen;
+ const char *qname;
+ int qtype;
+ const struct addrinfo *pai;
+{
+ struct addrinfo sentinel, *cur;
+ struct addrinfo ai;
+ const struct afd *afd;
+ char *canonname;
+ const HEADER *hp;
+ const u_char *cp;
+ int n;
+ const u_char *eom;
+ char *bp;
+ int type, class, buflen, ancount, qdcount;
+ int haveanswer, had_error;
+ char tbuf[MAXDNAME];
+ int (*name_ok)(const char *);
+ char hostbuf[8*1024];
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ canonname = NULL;
+ eom = answer->buf + anslen;
+ switch (qtype) {
+ case T_A:
+ case T_AAAA:
+ case T_ANY: /*use T_ANY only for T_A/T_AAAA lookup*/
+ name_ok = res_hnok;
+ break;
+ default:
+ return (NULL); /* XXX should be abort(); */
+ }
+ /*
+ * find first satisfactory answer
+ */
+ hp = &answer->hdr;
+ ancount = ntohs(hp->ancount);
+ qdcount = ntohs(hp->qdcount);
+ bp = hostbuf;
+ buflen = sizeof hostbuf;
+ cp = answer->buf + HFIXEDSZ;
+ if (qdcount != 1) {
+ h_errno = NO_RECOVERY;
+ return (NULL);
+ }
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !(*name_ok)(bp)) {
+ h_errno = NO_RECOVERY;
+ return (NULL);
+ }
+ cp += n + QFIXEDSZ;
+ if (qtype == T_A || qtype == T_AAAA || qtype == T_ANY) {
+ /* res_send() has already verified that the query name is the
+ * same as the one we sent; this just gets the expanded name
+ * (i.e., with the succeeding search-domain tacked on).
+ */
+ n = strlen(bp) + 1; /* for the \0 */
+ if (n >= MAXHOSTNAMELEN) {
+ h_errno = NO_RECOVERY;
+ return (NULL);
+ }
+ canonname = bp;
+ bp += n;
+ buflen -= n;
+ /* The qname can be abbreviated, but h_name is now absolute. */
+ qname = canonname;
+ }
+ haveanswer = 0;
+ had_error = 0;
+ while (ancount-- > 0 && cp < eom && !had_error) {
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !(*name_ok)(bp)) {
+ had_error++;
+ continue;
+ }
+ cp += n; /* name */
+ type = _getshort(cp);
+ cp += INT16SZ; /* type */
+ class = _getshort(cp);
+ cp += INT16SZ + INT32SZ; /* class, TTL */
+ n = _getshort(cp);
+ cp += INT16SZ; /* len */
+ if (class != C_IN) {
+ /* XXX - debug? syslog? */
+ cp += n;
+ continue; /* XXX - had_error++ ? */
+ }
+ if ((qtype == T_A || qtype == T_AAAA || qtype == T_ANY) &&
+ type == T_CNAME) {
+ n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
+ if ((n < 0) || !(*name_ok)(tbuf)) {
+ had_error++;
+ continue;
+ }
+ cp += n;
+ /* Get canonical name. */
+ n = strlen(tbuf) + 1; /* for the \0 */
+ if (n > buflen || n >= MAXHOSTNAMELEN) {
+ had_error++;
+ continue;
+ }
+ strcpy(bp, tbuf);
+ canonname = bp;
+ bp += n;
+ buflen -= n;
+ continue;
+ }
+ if (qtype == T_ANY) {
+ if (!(type == T_A || type == T_AAAA)) {
+ cp += n;
+ continue;
+ }
+ } else if (type != qtype) {
+#ifdef DEBUG
+ if (type != T_KEY && type != T_SIG)
+ syslog(LOG_NOTICE|LOG_AUTH,
+ "gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
+ qname, p_class(C_IN), p_type(qtype),
+ p_type(type));
+#endif
+ cp += n;
+ continue; /* XXX - had_error++ ? */
+ }
+ switch (type) {
+ case T_A:
+ case T_AAAA:
+ if (strcasecmp(canonname, bp) != 0) {
+#ifdef DEBUG
+ syslog(LOG_NOTICE|LOG_AUTH,
+ AskedForGot, canonname, bp);
+#endif
+ cp += n;
+ continue; /* XXX - had_error++ ? */
+ }
+ if (type == T_A && n != INADDRSZ) {
+ cp += n;
+ continue;
+ }
+ if (type == T_AAAA && n != IN6ADDRSZ) {
+ cp += n;
+ continue;
+ }
+#ifdef FILTER_V4MAPPED
+ if (type == T_AAAA) {
+ struct in6_addr in6;
+ memcpy(&in6, cp, sizeof(in6));
+ if (IN6_IS_ADDR_V4MAPPED(&in6)) {
+ cp += n;
+ continue;
+ }
+ }
+#endif
+ if (!haveanswer) {
+ int nn;
- int a2_dst_label
- = get_label ((struct sockaddr_storage *) a2->dest_addr->ai_addr);
- int a2_src_label = get_label (&a2->source_addr);
+ canonname = bp;
+ nn = strlen(bp) + 1; /* for the \0 */
+ bp += nn;
+ buflen -= nn;
+ }
- if (a1_dst_label == a1_src_label && a2_dst_label != a2_src_label)
- return -1;
- if (a1_dst_label != a1_src_label && a2_dst_label == a2_src_label)
- return 1;
- }
+ /* don't overwrite pai */
+ ai = *pai;
+ ai.ai_family = (type == T_A) ? AF_INET : AF_INET6;
+ afd = find_afd(ai.ai_family);
+ if (afd == NULL) {
+ cp += n;
+ continue;
+ }
+ cur->ai_next = get_ai(&ai, afd, (const char *)cp);
+ if (cur->ai_next == NULL)
+ had_error++;
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ cp += n;
+ break;
+ default:
+ abort();
+ }
+ if (!had_error)
+ haveanswer++;
+ }
+ if (haveanswer) {
+ if (!canonname)
+ (void)get_canonname(pai, sentinel.ai_next, qname);
+ else
+ (void)get_canonname(pai, sentinel.ai_next, canonname);
+ h_errno = NETDB_SUCCESS;
+ return sentinel.ai_next;
+ }
+ h_errno = NO_RECOVERY;
+ return NULL;
+}
- /* Rule 6: Prefer higher precedence. */
- int a1_prec
- = get_precedence ((struct sockaddr_storage *) a1->dest_addr->ai_addr);
- int a2_prec
- = get_precedence ((struct sockaddr_storage *) a2->dest_addr->ai_addr);
+/*ARGSUSED*/
+static int
+_dns_getaddrinfo(rv, cb_data, ap)
+ void *rv;
+ void *cb_data;
+ va_list ap;
+{
+ struct addrinfo *ai;
+ querybuf buf, buf2;
+ const char *name;
+ const struct addrinfo *pai;
+ struct addrinfo sentinel, *cur;
+ struct res_target q, q2;
+
+ name = va_arg(ap, char *);
+ pai = va_arg(ap, const struct addrinfo *);
+
+ memset(&q, 0, sizeof(q2));
+ memset(&q2, 0, sizeof(q2));
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ switch (pai->ai_family) {
+ case AF_UNSPEC:
+ /* prefer IPv6 */
+ q.qclass = C_IN;
+ q.qtype = T_AAAA;
+ q.answer = buf.buf;
+ q.anslen = sizeof(buf);
+ q.next = &q2;
+ q2.qclass = C_IN;
+ q2.qtype = T_A;
+ q2.answer = buf2.buf;
+ q2.anslen = sizeof(buf2);
+ break;
+ case AF_INET:
+ q.qclass = C_IN;
+ q.qtype = T_A;
+ q.answer = buf.buf;
+ q.anslen = sizeof(buf);
+ break;
+ case AF_INET6:
+ q.qclass = C_IN;
+ q.qtype = T_AAAA;
+ q.answer = buf.buf;
+ q.anslen = sizeof(buf);
+ break;
+ default:
+ return NS_UNAVAIL;
+ }
+ if (res_searchN(name, &q) < 0)
+ return NS_NOTFOUND;
+ ai = getanswer(&buf, q.n, q.name, q.qtype, pai);
+ if (ai) {
+ cur->ai_next = ai;
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ }
+ if (q.next) {
+ ai = getanswer(&buf2, q2.n, q2.name, q2.qtype, pai);
+ if (ai)
+ cur->ai_next = ai;
+ }
+ if (sentinel.ai_next == NULL)
+ switch (h_errno) {
+ case HOST_NOT_FOUND:
+ return NS_NOTFOUND;
+ case TRY_AGAIN:
+ return NS_TRYAGAIN;
+ default:
+ return NS_UNAVAIL;
+ }
+ *((struct addrinfo **)rv) = sentinel.ai_next;
+ return NS_SUCCESS;
+}
- if (a1_prec > a2_prec)
- return -1;
- if (a1_prec < a2_prec)
- return 1;
+static void
+_sethtent()
+{
+ if (!hostf)
+ hostf = fopen(_PATH_HOSTS, "r" );
+ else
+ rewind(hostf);
+}
+static void
+_endhtent()
+{
+ if (hostf) {
+ (void) fclose(hostf);
+ hostf = NULL;
+ }
+}
- /* Rule 7: Prefer native transport.
- XXX How to recognize tunnels? */
+static struct addrinfo *
+_gethtent(name, pai)
+ const char *name;
+ const struct addrinfo *pai;
+{
+ char *p;
+ char *cp, *tname, *cname;
+ struct addrinfo hints, *res0, *res;
+ int error;
+ const char *addr;
+ char hostbuf[8*1024];
+
+ if (!hostf && !(hostf = fopen(_PATH_HOSTS, "r" )))
+ return (NULL);
+ again:
+ if (!(p = fgets(hostbuf, sizeof hostbuf, hostf)))
+ return (NULL);
+ if (*p == '#')
+ goto again;
+ if (!(cp = strpbrk(p, "#\n")))
+ goto again;
+ *cp = '\0';
+ if (!(cp = strpbrk(p, " \t")))
+ goto again;
+ *cp++ = '\0';
+ addr = p;
+ cname = NULL;
+ /* if this is not something we're looking for, skip it. */
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ tname = cp;
+ if (cname == NULL)
+ cname = cp;
+ if ((cp = strpbrk(cp, " \t")) != NULL)
+ *cp++ = '\0';
+ if (strcasecmp(name, tname) == 0)
+ goto found;
+ }
+ goto again;
+
+found:
+ hints = *pai;
+ hints.ai_flags = AI_NUMERICHOST;
+ error = getaddrinfo(addr, NULL, &hints, &res0);
+ if (error)
+ goto again;
+#ifdef FILTER_V4MAPPED
+ /* XXX should check all items in the chain */
+ if (res0->ai_family == AF_INET6 &&
+ IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)res0->ai_addr)->sin6_addr)) {
+ freeaddrinfo(res0);
+ goto again;
+ }
+#endif
+ for (res = res0; res; res = res->ai_next) {
+ /* cover it up */
+ res->ai_flags = pai->ai_flags;
+
+ if (pai->ai_flags & AI_CANONNAME) {
+ if (get_canonname(pai, res, cname) != 0) {
+ freeaddrinfo(res0);
+ goto again;
+ }
+ }
+ }
+ return res0;
+}
+/*ARGSUSED*/
+static int
+_files_getaddrinfo(rv, cb_data, ap)
+ void *rv;
+ void *cb_data;
+ va_list ap;
+{
+ const char *name;
+ const struct addrinfo *pai;
+ struct addrinfo sentinel, *cur;
+ struct addrinfo *p;
+
+ name = va_arg(ap, char *);
+ pai = va_arg(ap, struct addrinfo *);
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ _sethtent();
+ while ((p = _gethtent(name, pai)) != NULL) {
+ cur->ai_next = p;
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ }
+ _endhtent();
- /* Rule 8: Prefer smaller scope. */
- if (a1_dst_scope < a2_dst_scope)
- return -1;
- if (a1_dst_scope > a2_dst_scope)
- return 1;
+ *((struct addrinfo **)rv) = sentinel.ai_next;
+ if (sentinel.ai_next == NULL)
+ return NS_NOTFOUND;
+ return NS_SUCCESS;
+}
+#ifdef YP
+static char *__ypdomain;
- /* Rule 9: Use longest matching prefix. */
- if (a1->got_source_addr
- && a1->dest_addr->ai_family == a2->dest_addr->ai_family)
- {
- int bit1 = 0;
- int bit2 = 0;
+/*ARGSUSED*/
+static struct addrinfo *
+_yphostent(line, pai)
+ char *line;
+ const struct addrinfo *pai;
+{
+ struct addrinfo sentinel, *cur;
+ struct addrinfo hints, *res, *res0;
+ int error;
+ char *p = line;
+ const char *addr, *canonname;
+ char *nextline;
+ char *cp;
+
+ addr = canonname = NULL;
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+nextline:
+ /* terminate line */
+ cp = strchr(p, '\n');
+ if (cp) {
+ *cp++ = '\0';
+ nextline = cp;
+ } else
+ nextline = NULL;
+
+ cp = strpbrk(p, " \t");
+ if (cp == NULL) {
+ if (canonname == NULL)
+ return (NULL);
+ else
+ goto done;
+ }
+ *cp++ = '\0';
- if (a1->dest_addr->ai_family == PF_INET)
- {
- assert (a1->source_addr.ss_family == PF_INET);
- assert (a2->source_addr.ss_family == PF_INET);
+ addr = p;
- struct sockaddr_in *in1_dst;
- struct sockaddr_in *in1_src;
- struct sockaddr_in *in2_dst;
- struct sockaddr_in *in2_src;
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (!canonname)
+ canonname = cp;
+ if ((cp = strpbrk(cp, " \t")) != NULL)
+ *cp++ = '\0';
+ }
- in1_dst = (struct sockaddr_in *) a1->dest_addr->ai_addr;
- in1_src = (struct sockaddr_in *) &a1->source_addr;
- in2_dst = (struct sockaddr_in *) a2->dest_addr->ai_addr;
- in2_src = (struct sockaddr_in *) &a2->source_addr;
+ hints = *pai;
+ hints.ai_flags = AI_NUMERICHOST;
+ error = getaddrinfo(addr, NULL, &hints, &res0);
+ if (error == 0) {
+ for (res = res0; res; res = res->ai_next) {
+ /* cover it up */
+ res->ai_flags = pai->ai_flags;
- bit1 = ffs (in1_dst->sin_addr.s_addr ^ in1_src->sin_addr.s_addr);
- bit2 = ffs (in2_dst->sin_addr.s_addr ^ in2_src->sin_addr.s_addr);
+ if (pai->ai_flags & AI_CANONNAME)
+ (void)get_canonname(pai, res, canonname);
+ }
+ } else
+ res0 = NULL;
+ if (res0) {
+ cur->ai_next = res0;
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
}
- else if (a1->dest_addr->ai_family == PF_INET6)
- {
- assert (a1->source_addr.ss_family == PF_INET6);
- assert (a2->source_addr.ss_family == PF_INET6);
-
- struct sockaddr_in6 *in1_dst;
- struct sockaddr_in6 *in1_src;
- struct sockaddr_in6 *in2_dst;
- struct sockaddr_in6 *in2_src;
-
- in1_dst = (struct sockaddr_in6 *) a1->dest_addr->ai_addr;
- in1_src = (struct sockaddr_in6 *) &a1->source_addr;
- in2_dst = (struct sockaddr_in6 *) a2->dest_addr->ai_addr;
- in2_src = (struct sockaddr_in6 *) &a2->source_addr;
-
- int i;
- for (i = 0; i < 4; ++i)
- if (in1_dst->sin6_addr.s6_addr32[i]
- != in1_src->sin6_addr.s6_addr32[i]
- || (in2_dst->sin6_addr.s6_addr32[i]
- != in2_src->sin6_addr.s6_addr32[i]))
- break;
-
- if (i < 4)
- {
- bit1 = ffs (in1_dst->sin6_addr.s6_addr32[i]
- ^ in1_src->sin6_addr.s6_addr32[i]);
- bit2 = ffs (in2_dst->sin6_addr.s6_addr32[i]
- ^ in2_src->sin6_addr.s6_addr32[i]);
- }
+
+ if (nextline) {
+ p = nextline;
+ goto nextline;
}
- if (bit1 > bit2)
- return -1;
- if (bit1 < bit2)
- return 1;
- }
+done:
+ return sentinel.ai_next;
+}
+
+/*ARGSUSED*/
+static int
+_yp_getaddrinfo(rv, cb_data, ap)
+ void *rv;
+ void *cb_data;
+ va_list ap;
+{
+ struct addrinfo sentinel, *cur;
+ struct addrinfo *ai = NULL;
+ static char *__ypcurrent;
+ int __ypcurrentlen, r;
+ const char *name;
+ const struct addrinfo *pai;
+
+ name = va_arg(ap, char *);
+ pai = va_arg(ap, const struct addrinfo *);
+
+ memset(&sentinel, 0, sizeof(sentinel));
+ cur = &sentinel;
+
+ if (!__ypdomain) {
+ if (_yp_check(&__ypdomain) == 0)
+ return NS_UNAVAIL;
+ }
+ if (__ypcurrent)
+ free(__ypcurrent);
+ __ypcurrent = NULL;
+
+ /* hosts.byname is only for IPv4 (Solaris8) */
+ if (pai->ai_family == PF_UNSPEC || pai->ai_family == PF_INET) {
+ r = yp_match(__ypdomain, "hosts.byname", name,
+ (int)strlen(name), &__ypcurrent, &__ypcurrentlen);
+ if (r == 0) {
+ struct addrinfo ai4;
+
+ ai4 = *pai;
+ ai4.ai_family = AF_INET;
+ ai = _yphostent(__ypcurrent, &ai4);
+ if (ai) {
+ cur->ai_next = ai;
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ }
+ }
+ }
+ /* ipnodes.byname can hold both IPv4/v6 */
+ r = yp_match(__ypdomain, "ipnodes.byname", name,
+ (int)strlen(name), &__ypcurrent, &__ypcurrentlen);
+ if (r == 0) {
+ ai = _yphostent(__ypcurrent, pai);
+ if (ai) {
+ cur->ai_next = ai;
+ while (cur && cur->ai_next)
+ cur = cur->ai_next;
+ }
+ }
- /* Rule 10: Otherwise, leave the order unchanged. */
- return 0;
+ if (sentinel.ai_next == NULL) {
+ h_errno = HOST_NOT_FOUND;
+ return NS_NOTFOUND;
+ }
+ *((struct addrinfo **)rv) = sentinel.ai_next;
+ return NS_SUCCESS;
}
+#endif
-
-int
-getaddrinfo (const char *name, const char *service,
- const struct addrinfo *hints, struct addrinfo **pai)
+/* resolver logic */
+
+extern const char *__hostalias(const char *);
+extern int h_errno;
+
+/*
+ * Formulate a normal query, send, and await answer.
+ * Returned answer is placed in supplied buffer "answer".
+ * Perform preliminary check of answer, returning success only
+ * if no error is indicated and the answer count is nonzero.
+ * Return the size of the response on success, -1 on error.
+ * Error number is left in h_errno.
+ *
+ * Caller must parse answer and determine whether it answers the question.
+ */
+static int
+res_queryN(name, target)
+ const char *name; /* domain name */
+ struct res_target *target;
{
- int i = 0, j = 0, last_i = 0;
- int nresults = 0;
- struct addrinfo *p = NULL, **end;
- struct gaih *g = gaih, *pg = NULL;
- struct gaih_service gaih_service, *pservice;
- struct addrinfo local_hints;
-
- if (name != NULL && name[0] == '*' && name[1] == 0)
- name = NULL;
-
- if (service != NULL && service[0] == '*' && service[1] == 0)
- service = NULL;
-
- if (name == NULL && service == NULL)
- return EAI_NONAME;
-
- if (hints == NULL)
- hints = &default_hints;
-
- if (hints->ai_flags
- & ~(AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST|AI_ADDRCONFIG|AI_V4MAPPED
-#ifdef HAVE_LIBIDN
- |AI_IDN|AI_CANONIDN|AI_IDN_ALLOW_UNASSIGNED
- |AI_IDN_USE_STD3_ASCII_RULES
-#endif
- |AI_NUMERICSERV|AI_ALL))
- return EAI_BADFLAGS;
-
- if ((hints->ai_flags & AI_CANONNAME) && name == NULL)
- return EAI_BADFLAGS;
-
- if (hints->ai_flags & AI_ADDRCONFIG)
- {
- /* Determine whether we have IPv4 or IPv6 interfaces or both.
- We cannot cache the results since new interfaces could be
- added at any time. */
- bool seen_ipv4;
- bool seen_ipv6;
- __check_pf (&seen_ipv4, &seen_ipv6);
-
- /* Now make a decision on what we return, if anything. */
- if (hints->ai_family == PF_UNSPEC && (seen_ipv4 || seen_ipv6))
- {
- /* If we haven't seen both IPv4 and IPv6 interfaces we can
- narrow down the search. */
- if (! seen_ipv4 || ! seen_ipv6)
- {
- local_hints = *hints;
- local_hints.ai_family = seen_ipv4 ? PF_INET : PF_INET6;
- hints = &local_hints;
- }
- }
- else if ((hints->ai_family == PF_INET && ! seen_ipv4)
- || (hints->ai_family == PF_INET6 && ! seen_ipv6))
- /* We cannot possibly return a valid answer. */
- return EAI_NONAME;
- }
-
- if (service && service[0])
- {
- char *c;
- gaih_service.name = service;
- gaih_service.num = strtoul (gaih_service.name, &c, 10);
- if (*c != '\0')
- {
- if (hints->ai_flags & AI_NUMERICSERV)
- return EAI_NONAME;
-
- gaih_service.num = -1;
+ u_char buf[MAXPACKET];
+ HEADER *hp;
+ int n;
+ struct res_target *t;
+ int rcode;
+ int ancount;
+
+ rcode = NOERROR;
+ ancount = 0;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
}
- pservice = &gaih_service;
- }
- else
- pservice = NULL;
-
- if (pai)
- end = &p;
- else
- end = NULL;
-
- while (g->gaih)
- {
- if (hints->ai_family == g->family || hints->ai_family == AF_UNSPEC)
- {
- j++;
- if (pg == NULL || pg->gaih != g->gaih)
- {
- pg = g;
- i = g->gaih (name, pservice, hints, end);
- if (i != 0)
- {
- /* EAI_NODATA is a more specific result as it says that
- we found a result but it is not usable. */
- if (last_i != (GAIH_OKIFUNSPEC | -EAI_NODATA))
- last_i = i;
-
- if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC))
- {
- ++g;
- continue;
- }
-
- freeaddrinfo (p);
-
- return -(i & GAIH_EAI);
+ for (t = target; t; t = t->next) {
+ int class, type;
+ u_char *answer;
+ int anslen;
+
+ hp = (HEADER *)(void *)t->answer;
+ hp->rcode = NOERROR; /* default */
+
+ /* make it easier... */
+ class = t->qclass;
+ type = t->qtype;
+ answer = t->answer;
+ anslen = t->anslen;
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf(";; res_query(%s, %d, %d)\n", name, class, type);
+#endif
+
+ n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL,
+ buf, sizeof(buf));
+ if (n > 0 && (_res.options & RES_USE_EDNS0) != 0)
+ n = res_opt(n, buf, sizeof(buf), anslen);
+ if (n <= 0) {
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf(";; res_query: mkquery failed\n");
+#endif
+ h_errno = NO_RECOVERY;
+ return (n);
+ }
+ n = res_send(buf, n, answer, anslen);
+#if 0
+ if (n < 0) {
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf(";; res_query: send error\n");
+#endif
+ h_errno = TRY_AGAIN;
+ return (n);
+ }
+#endif
+
+ if (n < 0 || hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
+ rcode = hp->rcode; /* record most recent error */
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf(";; rcode = %d, ancount=%d\n", hp->rcode,
+ ntohs(hp->ancount));
+#endif
+ continue;
}
- if (end)
- while (*end)
- {
- end = &((*end)->ai_next);
- ++nresults;
- }
- }
+
+ ancount += ntohs(hp->ancount);
+
+ t->n = n;
}
- ++g;
- }
-
- if (j == 0)
- return EAI_FAMILY;
-
- if (nresults > 1)
- {
- /* Sort results according to RFC 3484. */
- struct sort_result results[nresults];
- struct addrinfo *q;
- struct addrinfo *last = NULL;
- char *canonname = NULL;
-
- for (i = 0, q = p; q != NULL; ++i, last = q, q = q->ai_next)
- {
- results[i].dest_addr = q;
- results[i].got_source_addr = false;
-
- /* If we just looked up the address for a different
- protocol, reuse the result. */
- if (last != NULL && last->ai_addrlen == q->ai_addrlen
- && memcmp (last->ai_addr, q->ai_addr, q->ai_addrlen) == 0)
- {
- memcpy (&results[i].source_addr, &results[i - 1].source_addr,
- results[i - 1].source_addr_len);
- results[i].source_addr_len = results[i - 1].source_addr_len;
- results[i].got_source_addr = results[i - 1].got_source_addr;
- }
- else
- {
- /* We overwrite the type with SOCK_DGRAM since we do not
- want connect() to connect to the other side. If we
- cannot determine the source address remember this
- fact. */
- int fd = socket (q->ai_family, SOCK_DGRAM, IPPROTO_IP);
- socklen_t sl = sizeof (results[i].source_addr);
- if (fd != -1
- && connect (fd, q->ai_addr, q->ai_addrlen) == 0
- && getsockname (fd,
- (struct sockaddr *) &results[i].source_addr,
- &sl) == 0)
- {
- results[i].source_addr_len = sl;
- results[i].got_source_addr = true;
+
+ if (ancount == 0) {
+ switch (rcode) {
+ case NXDOMAIN:
+ h_errno = HOST_NOT_FOUND;
+ break;
+ case SERVFAIL:
+ h_errno = TRY_AGAIN;
+ break;
+ case NOERROR:
+ h_errno = NO_DATA;
+ break;
+ case FORMERR:
+ case NOTIMP:
+ case REFUSED:
+ default:
+ h_errno = NO_RECOVERY;
+ break;
}
- else
- /* Just make sure that if we have to process the same
- address again we do not copy any memory. */
- results[i].source_addr_len = 0;
-
- if (fd != -1)
- close_not_cancel_no_status (fd);
- }
-
- /* Remember the canonical name. */
- if (q->ai_canonname != NULL)
- {
- assert (canonname == NULL);
- canonname = q->ai_canonname;
- q->ai_canonname = NULL;
- }
+ return (-1);
}
+ return (ancount);
+}
- /* We got all the source addresses we can get, now sort using
- the information. */
- qsort (results, nresults, sizeof (results[0]), rfc3484_sort);
+/*
+ * Formulate a normal query, send, and retrieve answer in supplied buffer.
+ * Return the size of the response on success, -1 on error.
+ * If enabled, implement search rules until answer or unrecoverable failure
+ * is detected. Error code, if any, is left in h_errno.
+ */
+static int
+res_searchN(name, target)
+ const char *name; /* domain name */
+ struct res_target *target;
+{
+ const char *cp, * const *domain;
+ HEADER *hp = (HEADER *)(void *)target->answer; /*XXX*/
+ u_int dots;
+ int trailing_dot, ret, saved_herrno;
+ int got_nodata = 0, got_servfail = 0, tried_as_is = 0;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
- /* Queue the results up as they come out of sorting. */
- q = p = results[0].dest_addr;
- for (i = 1; i < nresults; ++i)
- q = q->ai_next = results[i].dest_addr;
- q->ai_next = NULL;
+ errno = 0;
+ h_errno = HOST_NOT_FOUND; /* default, if we never query */
+ dots = 0;
+ for (cp = name; *cp; cp++)
+ dots += (*cp == '.');
+ trailing_dot = 0;
+ if (cp > name && *--cp == '.')
+ trailing_dot++;
+
+ /*
+ * if there aren't any dots, it could be a user-level alias
+ */
+ if (!dots && (cp = __hostalias(name)) != NULL)
+ return (res_queryN(cp, target));
+
+ /*
+ * If there are dots in the name already, let's just give it a try
+ * 'as is'. The threshold can be set with the "ndots" option.
+ */
+ saved_herrno = -1;
+ if (dots >= _res.ndots) {
+ ret = res_querydomainN(name, NULL, target);
+ if (ret > 0)
+ return (ret);
+ saved_herrno = h_errno;
+ tried_as_is++;
+ }
- /* Fill in the canonical name into the new first entry. */
- p->ai_canonname = canonname;
- }
+ /*
+ * We do at least one level of search if
+ * - there is no dot and RES_DEFNAME is set, or
+ * - there is at least one dot, there is no trailing dot,
+ * and RES_DNSRCH is set.
+ */
+ if ((!dots && (_res.options & RES_DEFNAMES)) ||
+ (dots && !trailing_dot && (_res.options & RES_DNSRCH))) {
+ int done = 0;
+
+ for (domain = (const char * const *)_res.dnsrch;
+ *domain && !done;
+ domain++) {
+
+ ret = res_querydomainN(name, *domain, target);
+ if (ret > 0)
+ return (ret);
+
+ /*
+ * If no server present, give up.
+ * If name isn't found in this domain,
+ * keep trying higher domains in the search list
+ * (if that's enabled).
+ * On a NO_DATA error, keep trying, otherwise
+ * a wildcard entry of another type could keep us
+ * from finding this entry higher in the domain.
+ * If we get some other error (negative answer or
+ * server failure), then stop searching up,
+ * but try the input name below in case it's
+ * fully-qualified.
+ */
+ if (errno == ECONNREFUSED) {
+ h_errno = TRY_AGAIN;
+ return (-1);
+ }
- if (p)
- {
- *pai = p;
- return 0;
- }
+ switch (h_errno) {
+ case NO_DATA:
+ got_nodata++;
+ /* FALLTHROUGH */
+ case HOST_NOT_FOUND:
+ /* keep trying */
+ break;
+ case TRY_AGAIN:
+ if (hp->rcode == SERVFAIL) {
+ /* try next search element, if any */
+ got_servfail++;
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ /* anything else implies that we're done */
+ done++;
+ }
+ /*
+ * if we got here for some reason other than DNSRCH,
+ * we only wanted one iteration of the loop, so stop.
+ */
+ if (!(_res.options & RES_DNSRCH))
+ done++;
+ }
+ }
- if (pai == NULL && last_i == 0)
- return 0;
+ /*
+ * if we have not already tried the name "as is", do that now.
+ * note that we do this regardless of how many dots were in the
+ * name or whether it ends with a dot.
+ */
+ if (!tried_as_is && (dots || !(_res.options & RES_NOTLDQUERY))) {
+ ret = res_querydomainN(name, NULL, target);
+ if (ret > 0)
+ return (ret);
+ }
- return last_i ? -(last_i & GAIH_EAI) : EAI_NONAME;
+ /*
+ * if we got here, we didn't satisfy the search.
+ * if we did an initial full query, return that query's h_errno
+ * (note that we wouldn't be here if that query had succeeded).
+ * else if we ever got a nodata, send that back as the reason.
+ * else send back meaningless h_errno, that being the one from
+ * the last DNSRCH we did.
+ */
+ if (saved_herrno != -1)
+ h_errno = saved_herrno;
+ else if (got_nodata)
+ h_errno = NO_DATA;
+ else if (got_servfail)
+ h_errno = TRY_AGAIN;
+ return (-1);
}
-libc_hidden_def (getaddrinfo)
-static_link_warning (getaddrinfo)
-
-void
-freeaddrinfo (struct addrinfo *ai)
+/*
+ * Perform a call on res_query on the concatenation of name and domain,
+ * removing a trailing dot from name if domain is NULL.
+ */
+static int
+res_querydomainN(name, domain, target)
+ const char *name, *domain;
+ struct res_target *target;
{
- struct addrinfo *p;
-
- while (ai != NULL)
- {
- p = ai;
- ai = ai->ai_next;
- free (p->ai_canonname);
- free (p);
- }
+ char nbuf[MAXDNAME];
+ const char *longname = nbuf;
+ size_t n, d;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf(";; res_querydomain(%s, %s)\n",
+ name, domain?domain:"<Nil>");
+#endif
+ if (domain == NULL) {
+ /*
+ * Check for trailing '.';
+ * copy without '.' if present.
+ */
+ n = strlen(name);
+ if (n >= MAXDNAME) {
+ h_errno = NO_RECOVERY;
+ return (-1);
+ }
+ if (n > 0 && name[--n] == '.') {
+ strncpy(nbuf, name, n);
+ nbuf[n] = '\0';
+ } else
+ longname = name;
+ } else {
+ n = strlen(name);
+ d = strlen(domain);
+ if (n + d + 1 >= MAXDNAME) {
+ h_errno = NO_RECOVERY;
+ return (-1);
+ }
+ sprintf(nbuf, "%s.%s", name, domain);
+ }
+ return (res_queryN(longname, target));
}
-libc_hidden_def (freeaddrinfo)
diff --git a/newlib/libc/sys/linux/net/getaliasent.c b/newlib/libc/sys/linux/net/getaliasent.c
deleted file mode 100644
index e3234752e..000000000
--- a/newlib/libc/sys/linux/net/getaliasent.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <aliases.h>
-
-
-#define LOOKUP_TYPE struct aliasent
-#define GETFUNC_NAME getaliasent
-#define BUFLEN 1024
-
-#include "getXXent.c"
diff --git a/newlib/libc/sys/linux/net/getaliasent_r.c b/newlib/libc/sys/linux/net/getaliasent_r.c
deleted file mode 100644
index 70dbc26b1..000000000
--- a/newlib/libc/sys/linux/net/getaliasent_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <aliases.h>
-
-
-#define LOOKUP_TYPE struct aliasent
-#define SETFUNC_NAME setaliasent
-#define GETFUNC_NAME getaliasent
-#define ENDFUNC_NAME endaliasent
-#define DATABASE_NAME aliases
-
-#include "getXXent_r.c"
diff --git a/newlib/libc/sys/linux/net/getaliasname.c b/newlib/libc/sys/linux/net/getaliasname.c
deleted file mode 100644
index 2ad315f9f..000000000
--- a/newlib/libc/sys/linux/net/getaliasname.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <aliases.h>
-
-
-#define LOOKUP_TYPE struct aliasent
-#define FUNCTION_NAME getaliasbyname
-#define DATABASE_NAME aliases
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-#define BUFLEN 1024
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getaliasname_r.c b/newlib/libc/sys/linux/net/getaliasname_r.c
deleted file mode 100644
index ec3519d57..000000000
--- a/newlib/libc/sys/linux/net/getaliasname_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <aliases.h>
-
-
-#define LOOKUP_TYPE struct aliasent
-#define FUNCTION_NAME getaliasbyname
-#define DATABASE_NAME aliases
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/gethostbydns.c b/newlib/libc/sys/linux/net/gethostbydns.c
new file mode 100644
index 000000000..9c80539f2
--- /dev/null
+++ b/newlib/libc/sys/linux/net/gethostbydns.c
@@ -0,0 +1,815 @@
+/*
+ * ++Copyright++ 1985, 1988, 1993
+ * -
+ * Copyright (c) 1985, 1988, 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.
+ * -
+ * --Copyright--
+ */
+
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
+static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <ctype.h>
+#include <errno.h>
+#include <syslog.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+
+#include "res_config.h"
+
+#define SPRINTF(x) ((size_t)sprintf x)
+
+static const char AskedForGot[] =
+ "gethostby*.gethostanswer: asked for \"%s\", got \"%s\"";
+
+#ifdef RESOLVSORT
+static void addrsort(char **, int);
+#endif
+
+u_int32_t _getlong(const u_char *src);
+u_int16_t _getshort(const u_char *src);
+
+#ifdef DEBUG
+static void dbgprintf(char *, int);
+#endif
+
+#if PACKETSZ > 1024
+#define MAXPACKET PACKETSZ
+#else
+#define MAXPACKET 1024
+#endif
+
+typedef union {
+ HEADER hdr;
+ u_char buf[MAXPACKET];
+} querybuf;
+
+typedef union {
+ int32_t al;
+ char ac;
+} align;
+
+extern int h_errno;
+int _dns_ttl_;
+
+#ifdef DEBUG
+static void
+dbgprintf(msg, num)
+ char *msg;
+ int num;
+{
+ if (_res.options & RES_DEBUG) {
+ int save = errno;
+
+ printf(msg, num);
+ errno = save;
+ }
+}
+#else
+# define dbgprintf(msg, num) /*nada*/
+#endif
+
+#define BOUNDED_INCR(x) \
+ do { \
+ cp += x; \
+ if (cp > eom) { \
+ *herr = NO_RECOVERY; \
+ return (NULL); \
+ } \
+ } while (0)
+
+#define BOUNDS_CHECK(ptr, count) \
+ do { \
+ if ((ptr) + (count) > eom) { \
+ *herr = NO_RECOVERY; \
+ return (NULL); \
+ } \
+ } while (0)
+
+static struct hostent *
+gethostanswer(answer, anslen, qname, qtype, host, hostbuf, hostbuflen, herr)
+ const querybuf *answer;
+ int anslen;
+ const char *qname;
+ int qtype;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
+ int *herr;
+{
+ const HEADER *hp;
+ const u_char *cp;
+ int n;
+ const u_char *eom, *erdata;
+ char *bp, **ap, **hap;
+ int type, class, buflen, ancount, qdcount;
+ int haveanswer, had_error;
+ int toobig = 0;
+ char tbuf[MAXDNAME];
+ const char *tname;
+ int (*name_ok)(const char *);
+
+ tname = qname;
+ host->h_name = NULL;
+ eom = answer->buf + anslen;
+ switch (qtype) {
+ case T_A:
+ case T_AAAA:
+ name_ok = res_hnok;
+ break;
+ case T_PTR:
+ name_ok = res_dnok;
+ break;
+ default:
+ *herr = NO_RECOVERY;
+ return (NULL); /* XXX should be abort(); */
+ }
+ /*
+ * find first satisfactory answer
+ */
+ hp = &answer->hdr;
+ ancount = ntohs(hp->ancount);
+ qdcount = ntohs(hp->qdcount);
+ bp = hostbuf;
+ buflen = hostbuflen;
+ cp = answer->buf;
+ BOUNDED_INCR(HFIXEDSZ);
+ if (qdcount != 1) {
+ *herr = NO_RECOVERY;
+ return (NULL);
+ }
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !(*name_ok)(bp)) {
+ *herr = NO_RECOVERY;
+ return (NULL);
+ }
+ BOUNDED_INCR(n + QFIXEDSZ);
+ if (qtype == T_A || qtype == T_AAAA) {
+ /* res_send() has already verified that the query name is the
+ * same as the one we sent; this just gets the expanded name
+ * (i.e., with the succeeding search-domain tacked on).
+ */
+ n = strlen(bp) + 1; /* for the \0 */
+ if (n >= MAXHOSTNAMELEN) {
+ *herr = NO_RECOVERY;
+ return (NULL);
+ }
+ host->h_name = bp;
+ bp += n;
+ buflen -= n;
+ /* The qname can be abbreviated, but h_name is now absolute. */
+ qname = host->h_name;
+ }
+ ap = host->__host_aliases;
+ *ap = NULL;
+ host->h_aliases = host->__host_aliases;
+ hap = host->__host_addrs;
+ *hap = NULL;
+ host->h_addr_list = host->__host_addrs;
+ haveanswer = 0;
+ had_error = 0;
+ _dns_ttl_ = -1;
+ while (ancount-- > 0 && cp < eom && !had_error) {
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !(*name_ok)(bp)) {
+ had_error++;
+ continue;
+ }
+ cp += n; /* name */
+ BOUNDS_CHECK(cp, 3 * INT16SZ + INT32SZ);
+ type = _getshort(cp);
+ cp += INT16SZ; /* type */
+ class = _getshort(cp);
+ cp += INT16SZ; /* class */
+ if (qtype == T_A && type == T_A)
+ _dns_ttl_ = _getlong(cp);
+ cp += INT32SZ; /* TTL */
+ n = _getshort(cp);
+ cp += INT16SZ; /* len */
+ BOUNDS_CHECK(cp, n);
+ erdata = cp + n;
+ if (class != C_IN) {
+ /* XXX - debug? syslog? */
+ cp += n;
+ continue; /* XXX - had_error++ ? */
+ }
+ if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) {
+ if (ap >= &host->__host_aliases[MAXALIASES-1])
+ continue;
+ n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
+ if ((n < 0) || !(*name_ok)(tbuf)) {
+ had_error++;
+ continue;
+ }
+ cp += n;
+ if (cp != erdata) {
+ *herr = NO_RECOVERY;
+ return (NULL);
+ }
+ /* Store alias. */
+ *ap++ = bp;
+ n = strlen(bp) + 1; /* for the \0 */
+ if (n >= MAXHOSTNAMELEN) {
+ had_error++;
+ continue;
+ }
+ bp += n;
+ buflen -= n;
+ /* Get canonical name. */
+ n = strlen(tbuf) + 1; /* for the \0 */
+ if (n > buflen || n >= MAXHOSTNAMELEN) {
+ had_error++;
+ continue;
+ }
+ strcpy(bp, tbuf);
+ host->h_name = bp;
+ bp += n;
+ buflen -= n;
+ continue;
+ }
+ if (qtype == T_PTR && type == T_CNAME) {
+ n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
+ if (n < 0 || !res_dnok(tbuf)) {
+ had_error++;
+ continue;
+ }
+ cp += n;
+ if (cp != erdata) {
+ *herr = NO_RECOVERY;
+ return (NULL);
+ }
+ /* Get canonical name. */
+ n = strlen(tbuf) + 1; /* for the \0 */
+ if (n > buflen || n >= MAXHOSTNAMELEN) {
+ had_error++;
+ continue;
+ }
+ strcpy(bp, tbuf);
+ tname = bp;
+ bp += n;
+ buflen -= n;
+ continue;
+ }
+ if (type != qtype) {
+ if (type != T_SIG)
+ syslog(LOG_NOTICE|LOG_AUTH,
+ "gethostby*.gethostanswer: asked for \"%s %s %s\", got type \"%s\"",
+ qname, p_class(C_IN), p_type(qtype),
+ p_type(type));
+ cp += n;
+ continue; /* XXX - had_error++ ? */
+ }
+ switch (type) {
+ case T_PTR:
+ if (strcasecmp(tname, bp) != 0) {
+ syslog(LOG_NOTICE|LOG_AUTH,
+ AskedForGot, qname, bp);
+ cp += n;
+ continue; /* XXX - had_error++ ? */
+ }
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !res_hnok(bp)) {
+ had_error++;
+ break;
+ }
+#if MULTI_PTRS_ARE_ALIASES
+ cp += n;
+ if (cp != erdata) {
+ *herr = NO_RECOVERY;
+ return (NULL);
+ }
+ if (!haveanswer)
+ host->h_name = bp;
+ else if (ap < &host->__host_aliases[MAXALIASES-1])
+ *ap++ = bp;
+ else
+ n = -1;
+ if (n != -1) {
+ n = strlen(bp) + 1; /* for the \0 */
+ if (n >= MAXHOSTNAMELEN) {
+ had_error++;
+ break;
+ }
+ bp += n;
+ buflen -= n;
+ }
+ break;
+#else
+ host->h_name = bp;
+ if (_res.options & RES_USE_INET6) {
+ n = strlen(bp) + 1; /* for the \0 */
+ if (n >= MAXHOSTNAMELEN) {
+ had_error++;
+ break;
+ }
+ bp += n;
+ buflen -= n;
+ _map_v4v6_hostent(host, &bp, &buflen);
+ }
+ *herr = NETDB_SUCCESS;
+ return host;
+#endif
+ case T_A:
+ case T_AAAA:
+ if (strcasecmp(host->h_name, bp) != 0) {
+ syslog(LOG_NOTICE|LOG_AUTH,
+ AskedForGot, host->h_name, bp);
+ cp += n;
+ continue; /* XXX - had_error++ ? */
+ }
+ if (n != host->h_length) {
+ cp += n;
+ continue;
+ }
+ if (!haveanswer) {
+ int nn;
+
+ host->h_name = bp;
+ nn = strlen(bp) + 1; /* for the \0 */
+ bp += nn;
+ buflen -= nn;
+ }
+
+ bp += sizeof(align) - ((u_long)bp % sizeof(align));
+
+ if (bp + n >= &hostbuf[hostbuflen]) {
+ dbgprintf("size (%d) too big\n", n);
+ had_error++;
+ continue;
+ }
+ if (hap >= &host->__host_addrs[MAXADDRS-1]) {
+ if (!toobig++)
+ dbgprintf("Too many addresses (%d)\n",
+ MAXADDRS);
+ cp += n;
+ continue;
+ }
+ bcopy(cp, *hap++ = bp, n);
+ bp += n;
+ buflen -= n;
+ cp += n;
+ if (cp != erdata) {
+ *herr = NO_RECOVERY;
+ return (NULL);
+ }
+ break;
+ default:
+ dbgprintf("Impossible condition (type=%d)\n", type);
+ *herr = NO_RECOVERY;
+ return (NULL);
+ /* BIND has abort() here, too risky on bad data */
+ }
+ if (!had_error)
+ haveanswer++;
+ }
+ if (haveanswer) {
+ *ap = NULL;
+ *hap = NULL;
+# if defined(RESOLVSORT)
+ /*
+ * Note: we sort even if host can take only one address
+ * in its return structures - should give it the "best"
+ * address in that case, not some random one
+ */
+ if (_res.nsort && haveanswer > 1 && qtype == T_A)
+ addrsort(host->__host_addrs, haveanswer);
+# endif /*RESOLVSORT*/
+ if (!host->h_name) {
+ n = strlen(qname) + 1; /* for the \0 */
+ if (n > buflen || n >= MAXHOSTNAMELEN)
+ goto no_recovery;
+ strcpy(bp, qname);
+ host->h_name = bp;
+ bp += n;
+ buflen -= n;
+ }
+ if (_res.options & RES_USE_INET6)
+ _map_v4v6_hostent(host, &bp, &buflen);
+ *herr = NETDB_SUCCESS;
+ return host;
+ }
+ no_recovery:
+ *herr = NO_RECOVERY;
+ return (NULL);
+}
+
+struct hostent *
+__dns_getanswer(answer, anslen, qname, qtype, host, hostbuf, hostbuflen, herr)
+ const char *answer;
+ int anslen;
+ const char *qname;
+ int qtype;
+ struct hostent *host;
+ char *hostbuf;
+ int hostbuflen;
+ int *herr;
+{
+ switch(qtype) {
+ case T_AAAA:
+ host->h_addrtype = AF_INET6;
+ host->h_length = IN6ADDRSZ;
+ break;
+ case T_A:
+ default:
+ host->h_addrtype = AF_INET;
+ host->h_length = INADDRSZ;
+ break;
+ }
+
+ return(gethostanswer((const querybuf *)answer, anslen, qname, qtype, host, hostbuf, hostbuflen, herr));
+}
+
+int
+_dns_gethostbyname(void *rval, void *cb_data, va_list ap)
+{
+ const char *name;
+ int af;
+ querybuf buf;
+ const char *cp;
+ char *bp;
+ int n, size, type, len;
+ struct hostent *resultbuf;
+ char *hostbuf;
+ int buflen;
+ int *herr;
+
+ name = va_arg(ap, const char *);
+ af = va_arg(ap, int);
+ resultbuf = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char *);
+ buflen = va_arg(ap, int);
+ herr = va_arg(ap, int *);
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ *herr = NETDB_INTERNAL;
+ return NS_UNAVAIL;
+ }
+
+ switch (af) {
+ case AF_INET:
+ size = INADDRSZ;
+ type = T_A;
+ break;
+ case AF_INET6:
+ size = IN6ADDRSZ;
+ type = T_AAAA;
+ break;
+ default:
+ *herr = NETDB_INTERNAL;
+ errno = EAFNOSUPPORT;
+ return NS_UNAVAIL;
+ }
+
+ resultbuf->h_addrtype = af;
+ resultbuf->h_length = size;
+
+ /*
+ * if there aren't any dots, it could be a user-level alias.
+ * this is also done in res_query() since we are not the only
+ * function that looks up host names.
+ */
+ if (!strchr(name, '.') && (cp = __hostalias(name)))
+ name = cp;
+
+ /*
+ * disallow names consisting only of digits/dots, unless
+ * they end in a dot.
+ */
+ if (isdigit((unsigned char)name[0]))
+ for (cp = name;; ++cp) {
+ if (!*cp) {
+ if (*--cp == '.')
+ break;
+ /*
+ * All-numeric, no dot at the end.
+ * Fake up a hostent as if we'd actually
+ * done a lookup.
+ */
+ if (inet_pton(af, name, resultbuf->__host_addr) <= 0) {
+ *herr = HOST_NOT_FOUND;
+ return NS_NOTFOUND;
+ }
+ strncpy(hostbuf, name, MAXDNAME);
+ hostbuf[MAXDNAME] = '\0';
+ bp = hostbuf + MAXDNAME;
+ len = buflen - MAXDNAME;
+ resultbuf->h_name = hostbuf;
+ resultbuf->h_aliases = resultbuf->__host_aliases;
+ resultbuf->__host_aliases[0] = NULL;
+ resultbuf->__host_addrs[0] = (char *)resultbuf->__host_addr;
+ resultbuf->__host_addrs[1] = NULL;
+ resultbuf->h_addr_list = resultbuf->__host_addrs;
+ if (_res.options & RES_USE_INET6)
+ _map_v4v6_hostent(resultbuf, &bp, &len);
+ *herr = NETDB_SUCCESS;
+ *(struct hostent **)rval = resultbuf;
+ return NS_SUCCESS;
+ }
+ if (!isdigit((unsigned char)*cp) && *cp != '.')
+ break;
+ }
+ if ((isxdigit((unsigned char)name[0]) && strchr(name, ':') != NULL) ||
+ name[0] == ':')
+ for (cp = name;; ++cp) {
+ if (!*cp) {
+ if (*--cp == '.')
+ break;
+ /*
+ * All-IPv6-legal, no dot at the end.
+ * Fake up a hostent as if we'd actually
+ * done a lookup.
+ */
+ if (inet_pton(af, name, resultbuf->__host_addr) <= 0) {
+ *herr = HOST_NOT_FOUND;
+ return NS_NOTFOUND;
+ }
+ strncpy(hostbuf, name, MAXDNAME);
+ hostbuf[MAXDNAME] = '\0';
+ bp = hostbuf + MAXDNAME;
+ len = buflen - MAXDNAME;
+ resultbuf->h_name = hostbuf;
+ resultbuf->h_aliases = resultbuf->__host_aliases;
+ resultbuf->__host_aliases[0] = NULL;
+ resultbuf->__host_addrs[0] = (char *)resultbuf->__host_addr;
+ resultbuf->__host_addrs[1] = NULL;
+ resultbuf->h_addr_list = resultbuf->__host_addrs;
+ *herr = NETDB_SUCCESS;
+ *(struct hostent **)rval = resultbuf;
+ return NS_SUCCESS;
+ }
+ if (!isxdigit((unsigned char)*cp) && *cp != ':' && *cp != '.')
+ break;
+ }
+
+ if ((n = res_search(name, C_IN, type, buf.buf, sizeof(buf))) < 0) {
+ dbgprintf("res_search failed (%d)\n", n);
+ return NS_UNAVAIL;
+ }
+ *(struct hostent **)rval = gethostanswer(&buf, n, name, type, resultbuf, hostbuf, buflen, herr);
+ return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+
+int
+_dns_gethostbyaddr(void *rval, void *cb_data, va_list ap)
+{
+ const char *addr; /* XXX should have been def'd as u_char! */
+ int len, af;
+ const u_char *uaddr;
+ static const u_char mapped[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0xff,0xff };
+ static const u_char tunnelled[] = { 0,0, 0,0, 0,0, 0,0, 0,0, 0,0 };
+ int n, size;
+ querybuf buf;
+ struct hostent *hp;
+ char qbuf[MAXDNAME+1], *qp;
+#ifdef SUNSECURITY
+ struct hostent *rhp;
+ char **haddr;
+ u_long old_options;
+ char hname2[MAXDNAME+1];
+#endif /*SUNSECURITY*/
+ struct hostent *resultbuf;
+ char *hostbuf;
+ int buflen;
+ int *herr;
+
+ addr = va_arg(ap, const char *);
+ uaddr = (const u_char *)addr;
+ len = va_arg(ap, int);
+ af = va_arg(ap, int);
+ resultbuf = va_arg(ap, struct hostent *);
+ hostbuf = va_arg(ap, char *);
+ buflen = va_arg(ap, int);
+ herr = va_arg(ap, int *);
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ *herr = NETDB_INTERNAL;
+ return NS_UNAVAIL;
+ }
+ if (af == AF_INET6 && len == IN6ADDRSZ &&
+ (!memcmp(uaddr, mapped, sizeof mapped) ||
+ !memcmp(uaddr, tunnelled, sizeof tunnelled))) {
+ /* Unmap. */
+ addr += sizeof mapped;
+ uaddr += sizeof mapped;
+ af = AF_INET;
+ len = INADDRSZ;
+ }
+ switch (af) {
+ case AF_INET:
+ size = INADDRSZ;
+ break;
+ case AF_INET6:
+ size = IN6ADDRSZ;
+ break;
+ default:
+ errno = EAFNOSUPPORT;
+ *herr = NETDB_INTERNAL;
+ return NS_UNAVAIL;
+ }
+ if (size != len) {
+ errno = EINVAL;
+ *herr = NETDB_INTERNAL;
+ return NS_UNAVAIL;
+ }
+ switch (af) {
+ case AF_INET:
+ (void) sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa",
+ (uaddr[3] & 0xff),
+ (uaddr[2] & 0xff),
+ (uaddr[1] & 0xff),
+ (uaddr[0] & 0xff));
+ break;
+ case AF_INET6:
+ qp = qbuf;
+ for (n = IN6ADDRSZ - 1; n >= 0; n--) {
+ qp += SPRINTF((qp, "%x.%x.",
+ uaddr[n] & 0xf,
+ (uaddr[n] >> 4) & 0xf));
+ }
+ strcpy(qp, "ip6.int");
+ break;
+ default:
+ abort();
+ }
+ n = res_query(qbuf, C_IN, T_PTR, (u_char *)buf.buf, sizeof buf.buf);
+ if (n < 0) {
+ dbgprintf("res_query failed (%d)\n", n);
+ return NS_UNAVAIL;
+ }
+ if (n > sizeof buf.buf) {
+ dbgprintf("static buffer is too small (%d)\n", n);
+ return NS_UNAVAIL;
+ }
+ if (!(hp = gethostanswer(&buf, n, qbuf, T_PTR, resultbuf, hostbuf, buflen, herr)))
+ return NS_NOTFOUND; /* *herr was set by gethostanswer() */
+#ifdef SUNSECURITY
+ if (af == AF_INET) {
+ /*
+ * turn off search as the name should be absolute,
+ * 'localhost' should be matched by defnames
+ */
+ strncpy(hname2, hp->h_name, MAXDNAME);
+ hname2[MAXDNAME] = '\0';
+ old_options = _res.options;
+ _res.options &= ~RES_DNSRCH;
+ _res.options |= RES_DEFNAMES;
+ if (!(rhp = gethostbyname(hname2))) {
+ syslog(LOG_NOTICE|LOG_AUTH,
+ "gethostbyaddr: No A record for %s (verifying [%s])",
+ hname2, inet_ntoa(*((struct in_addr *)addr)));
+ _res.options = old_options;
+ *herr = HOST_NOT_FOUND;
+ return NS_NOTFOUND;
+ }
+ _res.options = old_options;
+ for (haddr = rhp->h_addr_list; *haddr; haddr++)
+ if (!memcmp(*haddr, addr, INADDRSZ))
+ break;
+ if (!*haddr) {
+ syslog(LOG_NOTICE|LOG_AUTH,
+ "gethostbyaddr: A record of %s != PTR record [%s]",
+ hname2, inet_ntoa(*((struct in_addr *)addr)));
+ *herr = HOST_NOT_FOUND;
+ return NS_NOTFOUND;
+ }
+ }
+#endif /*SUNSECURITY*/
+ hp->h_addrtype = af;
+ hp->h_length = len;
+ bcopy(addr, resultbuf->__host_addr, len);
+ resultbuf->__host_addrs[0] = (char *)resultbuf->__host_addr;
+ resultbuf->__host_addrs[1] = NULL;
+ if (af == AF_INET && (_res.options & RES_USE_INET6)) {
+ _map_v4v6_address((char*)resultbuf->__host_addr, (char*)resultbuf->__host_addr);
+ hp->h_addrtype = AF_INET6;
+ hp->h_length = IN6ADDRSZ;
+ }
+ *herr = NETDB_SUCCESS;
+ *(struct hostent **)rval = hp;
+ return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+
+#ifdef RESOLVSORT
+static void
+addrsort(ap, num)
+ char **ap;
+ int num;
+{
+ int i, j;
+ char **p;
+ short aval[MAXADDRS];
+ int needsort = 0;
+
+ p = ap;
+ for (i = 0; i < num; i++, p++) {
+ for (j = 0 ; (unsigned)j < _res.nsort; j++)
+ if (_res.sort_list[j].addr.s_addr ==
+ (((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask))
+ break;
+ aval[i] = j;
+ if (needsort == 0 && i > 0 && j < aval[i-1])
+ needsort = i;
+ }
+ if (!needsort)
+ return;
+
+ while (needsort < num) {
+ for (j = needsort - 1; j >= 0; j--) {
+ if (aval[j] > aval[j+1]) {
+ char *hp;
+
+ i = aval[j];
+ aval[j] = aval[j+1];
+ aval[j+1] = i;
+
+ hp = ap[j];
+ ap[j] = ap[j+1];
+ ap[j+1] = hp;
+
+ } else
+ break;
+ }
+ needsort++;
+ }
+}
+#endif
+void
+_sethostdnsent(stayopen)
+ int stayopen;
+{
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1)
+ return;
+ if (stayopen)
+ _res.options |= RES_STAYOPEN | RES_USEVC;
+}
+
+void
+_endhostdnsent()
+{
+ _res.options &= ~(RES_STAYOPEN | RES_USEVC);
+ res_close();
+}
diff --git a/newlib/libc/sys/linux/net/gethostbyht.c b/newlib/libc/sys/linux/net/gethostbyht.c
new file mode 100644
index 000000000..4a15293dd
--- /dev/null
+++ b/newlib/libc/sys/linux/net/gethostbyht.c
@@ -0,0 +1,285 @@
+/*-
+ * Copyright (c) 1985, 1988, 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.
+ * -
+ * --Copyright--
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+#include <arpa/nameser.h> /* XXX */
+#include <resolv.h> /* XXX */
+#include <dirent.h>
+#include <stdlib.h>
+#include <errno.h>
+
+static FILE *hostf = NULL;
+static int stayopen = 0;
+__LOCK_INIT(static, host_lock);
+
+void
+_sethosthtent_r(int f, FILE **hostfile, int *hstayopen)
+{
+ if (!*hostfile)
+ *hostfile = fopen(_PATH_HOSTS, "r" );
+ else
+ rewind(*hostfile);
+ *hstayopen = f;
+}
+
+void
+_endhosthtent_r(FILE **hostfile, int *hstayopen)
+{
+ if (*hostfile && !*hstayopen) {
+ (void) fclose(*hostfile);
+ *hostfile = NULL;
+ }
+}
+
+void
+_sethosthtent(f)
+ int f;
+{
+ _sethosthtent_r(f, &hostf, &stayopen);
+}
+
+void
+_endhosthtent()
+{
+ _endhosthtent_r(&hostf, &stayopen);
+}
+
+struct hostent *
+gethostent()
+{
+ static struct hostent hp;
+ static char buffer[BUFSIZ+1];
+ static int len = BUFSIZ;
+ static int herr;
+
+#ifdef HAVE_DD_LOCK
+ __lock_acquire(host_lock);
+#endif
+ gethostent_r(&hp, buffer, len, &herr, &hostf);
+#ifdef HAVE_DD_LOCK
+ __lock_release(host_lock);
+#endif
+ return &hp;
+}
+
+int
+gethostent_r(struct hostent *hp, char *buffer, int buflen, int *herr, FILE **hostfile)
+{
+ char *p;
+ char *cp, **q;
+ int af, len;
+
+ if (!*hostfile && !(*hostfile = fopen(_PATH_HOSTS, "r" ))) {
+ *herr = NETDB_INTERNAL;
+ return -1;
+ }
+ again:
+ if (!(p = fgets(buffer, buflen, *hostfile))) {
+ *herr = HOST_NOT_FOUND;
+ return -1;
+ }
+ if (*p == '#')
+ goto again;
+ if (!(cp = strpbrk(p, "#\n")))
+ goto again;
+ *cp = '\0';
+ if (!(cp = strpbrk(p, " \t")))
+ goto again;
+ *cp++ = '\0';
+
+ hp->h_addr_list = hp->__host_addrs;
+ hp->__host_addrs[0] = (char *)hp->__host_addr;
+
+ if (inet_pton(AF_INET6, p, hp->h_addr_list[0]) > 0) {
+ af = AF_INET6;
+ len = IN6ADDRSZ;
+ } else if (inet_pton(AF_INET, p, hp->h_addr_list[0]) > 0) {
+ if (_res.options & RES_USE_INET6) {
+ _map_v4v6_address(hp->h_addr_list[0], hp->h_addr_list[0]);
+ af = AF_INET6;
+ len = IN6ADDRSZ;
+ } else {
+ af = AF_INET;
+ len = INADDRSZ;
+ }
+ } else {
+ goto again;
+ }
+
+
+ hp->h_addr_list[1] = NULL;
+ hp->h_addr = hp->__host_addrs[0];
+ hp->h_length = len;
+ hp->h_addrtype = af;
+
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ hp->h_name = cp;
+ q = hp->h_aliases = hp->__host_aliases;
+ if ((cp = strpbrk(cp, " \t")) != NULL)
+ *cp++ = '\0';
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &hp->h_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ if ((cp = strpbrk(cp, " \t")) != NULL)
+ *cp++ = '\0';
+ }
+ *q = NULL;
+
+ *herr = NETDB_SUCCESS;
+ return 0;
+}
+
+int
+_ht_gethostbyname(void *rval, void *cb_data, va_list ap)
+{
+ char **cp;
+ const char *name;
+ int af;
+ struct hostent *resultbuf;
+ char *buf;
+ int buflen;
+ int *herr;
+ FILE *hostfile = NULL;
+ int stayopen;
+ int p;
+
+ name = va_arg(ap, const char *);
+ af = va_arg(ap, int);
+ resultbuf = va_arg(ap, struct hostent *);
+ buf = va_arg(ap, char *);
+ buflen = va_arg(ap, int);
+ herr = va_arg(ap, int *);
+
+ sethostent_r(0, &hostfile, &stayopen);
+ while ((p = gethostent_r(resultbuf, buf, buflen, herr, &hostfile)) != -1) {
+ if (resultbuf->h_addrtype != af)
+ continue;
+ if (strcasecmp(resultbuf->h_name, name) == 0)
+ break;
+ for (cp = resultbuf->h_aliases; *cp != 0; cp++)
+ if (strcasecmp(*cp, name) == 0)
+ goto found;
+ }
+found:
+ endhostent_r(&hostfile, &stayopen);
+
+ if (p == -1)
+ {
+ *(struct hostent **)rval = NULL;
+ return NS_NOTFOUND;
+ }
+ else
+ {
+ *(struct hostent **)rval = resultbuf;
+ return NS_SUCCESS;
+ }
+}
+
+int
+_ht_gethostbyaddr(void *rval, void *cb_data, va_list ap)
+{
+ const char *addr;
+ int len, af;
+ struct hostent *resultbuf;
+ char *buf;
+ int buflen;
+ int *herr;
+ FILE *hostfile = NULL;
+ int stayopen;
+ int p;
+
+ addr = va_arg(ap, const char *);
+ len = va_arg(ap, int);
+ af = va_arg(ap, int);
+ resultbuf = va_arg(ap, struct hostent *);
+ buf = va_arg(ap, char *);
+ buflen = va_arg(ap, int);
+ herr = va_arg(ap, int *);
+
+ sethostent_r(0, &hostfile, &stayopen);
+ while ((p = gethostent_r(resultbuf, buf, buflen, herr, &hostfile)) != -1)
+ if (resultbuf->h_addrtype == af && !memcmp(resultbuf->h_addr, addr, len))
+ break;
+ endhostent_r(&hostfile, &stayopen);
+
+ if (p == -1)
+ {
+ *(struct hostent **)rval = NULL;
+ return NS_NOTFOUND;
+ }
+ else
+ {
+ *(struct hostent **)rval = resultbuf;
+ return NS_SUCCESS;
+ }
+}
diff --git a/newlib/libc/sys/linux/net/gethostbyname.3 b/newlib/libc/sys/linux/net/gethostbyname.3
new file mode 100644
index 000000000..51ed2f864
--- /dev/null
+++ b/newlib/libc/sys/linux/net/gethostbyname.3
@@ -0,0 +1,380 @@
+.\" Copyright (c) 1983, 1987, 1991, 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.
+.\"
+.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
+.\" $FreeBSD: src/lib/libc/net/gethostbyname.3,v 1.26 2002/01/14 16:59:00 ru Exp $
+.\"
+.Dd May 25, 1995
+.Dt GETHOSTBYNAME 3
+.Os
+.Sh NAME
+.Nm gethostbyname ,
+.Nm gethostbyname2 ,
+.Nm gethostbyaddr ,
+.Nm gethostent ,
+.Nm sethostent ,
+.Nm endhostent ,
+.Nm herror ,
+.Nm hstrerror
+.Nd get network host entry
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In netdb.h
+.Vt extern int h_errno ;
+.Ft struct hostent *
+.Fn gethostbyname "const char *name"
+.Ft struct hostent *
+.Fn gethostbyname2 "const char *name" "int af"
+.Ft struct hostent *
+.Fn gethostbyaddr "const char *addr" "int len" "int type"
+.Ft struct hostent *
+.Fn gethostent void
+.Ft void
+.Fn sethostent "int stayopen"
+.Ft void
+.Fn endhostent void
+.Ft void
+.Fn herror "const char *string"
+.Ft const char *
+.Fn hstrerror "int err"
+.Sh DESCRIPTION
+.Bf -symbolic
+The
+.Xr getaddrinfo 3
+and
+.Xr getnameinfo 3
+functions are preferred over the
+.Fn gethostbyname ,
+.Fn gethostbyname2 ,
+and
+.Fn gethostbyaddr
+functions.
+.Ef
+.Pp
+The
+.Fn gethostbyname ,
+.Fn gethostbyname2
+and
+.Fn gethostbyaddr
+functions
+each return a pointer to an object with the
+following structure describing an internet host
+referenced by name or by address, respectively.
+.Pp
+The
+.Fa name
+parameter passed to
+.Fn gethostbyname
+or
+.Fn gethostbyname2
+should point to a
+.Dv NUL Ns -terminated
+hostname.
+The
+.Fa addr
+parameter passed to
+.Fn gethostbyaddr
+should point to an address which is
+.Fa len
+bytes long,
+in binary form
+(i.e. not an IP address in human readable
+.Tn ASCII
+form).
+The
+.Fa type
+parameter specifies the address family
+(e.g.\&
+.Dv AF_INET , AF_INET6 ,
+etc.) of this address.
+.Pp
+The structure returned contains either the information obtained from the name
+server,
+.Xr named 8 ,
+broken-out fields from a line in
+.Pa /etc/hosts ,
+or database entries supplied by the
+.Xr yp 8
+system.
+The order of the lookups is controlled by the
+.Sq hosts
+entry in
+.Xr nsswitch.conf 5 .
+.Bd -literal
+struct hostent {
+ char *h_name; /* official name of host */
+ char **h_aliases; /* alias list */
+ int h_addrtype; /* host address type */
+ int h_length; /* length of address */
+ char **h_addr_list; /* list of addresses from name server */
+};
+#define h_addr h_addr_list[0] /* address, for backward compatibility */
+.Ed
+.Pp
+The members of this structure are:
+.Bl -tag -width h_addr_list
+.It Va h_name
+Official name of the host.
+.It Va h_aliases
+A
+.Dv NULL Ns -terminated
+array of alternate names for the host.
+.It Va h_addrtype
+The type of address being returned; usually
+.Dv AF_INET .
+.It Va h_length
+The length, in bytes, of the address.
+.It Va h_addr_list
+A
+.Dv NULL Ns -terminated
+array of network addresses for the host.
+Host addresses are returned in network byte order.
+.It Va h_addr
+The first address in
+.Va h_addr_list ;
+this is for backward compatibility.
+.El
+.Pp
+When using the nameserver,
+.Fn gethostbyname
+and
+.Fn gethostbyname2
+will search for the named host in the current domain and its parents
+unless the name ends in a dot.
+If the name contains no dot, and if the environment variable
+.Dq Ev HOSTALIASES
+contains the name of an alias file, the alias file will first be searched
+for an alias matching the input name.
+See
+.Xr hostname 7
+for the domain search procedure and the alias file format.
+.Pp
+The
+.Fn gethostbyname2
+function is an evolution of
+.Fn gethostbyname
+which is intended to allow lookups in address families other than
+.Dv AF_INET ,
+for example
+.Dv AF_INET6 .
+.Pp
+The
+.Fn sethostent
+function
+may be used to request the use of a connected
+.Tn TCP
+socket for queries.
+If the
+.Fa stayopen
+flag is non-zero,
+this sets the option to send all queries to the name server using
+.Tn TCP
+and to retain the connection after each call to
+.Fn gethostbyname ,
+.Fn gethostbyname2
+or
+.Fn gethostbyaddr .
+Otherwise, queries are performed using
+.Tn UDP
+datagrams.
+.Pp
+The
+.Fn endhostent
+function
+closes the
+.Tn TCP
+connection.
+.Pp
+The
+.Fn herror
+function writes a message to the diagnostic output consisting of the
+string parameter
+.Fa s ,
+the constant string
+.Qq Li ":\ " ,
+and a message corresponding to the value of
+.Va h_errno .
+.Pp
+The
+.Fn hstrerror
+function returns a string which is the message text corresponding to the
+value of the
+.Fa err
+parameter.
+.Sh FILES
+.Bl -tag -width /etc/nsswitch.conf -compact
+.It Pa /etc/hosts
+.It Pa /etc/nsswitch.conf
+.It Pa /etc/resolv.conf
+.El
+.Sh EXAMPLES
+Print out the hostname associated with a specific IP address:
+.Bd -literal -offset indent
+const char *ipstr = "127.0.0.1";
+struct in_addr ip;
+struct hostent *hp;
+
+if (!inet_aton(ipstr, &ip))
+ errx(1, "can't parse IP address %s", ipstr);
+
+if ((hp = gethostbyaddr((const char *)&ip,
+ sizeof ip, AF_INET)) == NULL)
+ errx(1, "no name associated with %s", ipstr);
+
+printf("name associated with %s is %s\en", ipstr, hp->h_name);
+.Ed
+.Sh DIAGNOSTICS
+Error return status from
+.Fn gethostbyname ,
+.Fn gethostbyname2
+and
+.Fn gethostbyaddr
+is indicated by return of a
+.Dv NULL
+pointer.
+The external integer
+.Va h_errno
+may then be checked to see whether this is a temporary failure
+or an invalid or unknown host.
+The routine
+.Fn herror
+can be used to print an error message describing the failure.
+If its argument
+.Fa string
+is
+.Pf non- Dv NULL ,
+it is printed, followed by a colon and a space.
+The error message is printed with a trailing newline.
+.Pp
+The variable
+.Va h_errno
+can have the following values:
+.Bl -tag -width HOST_NOT_FOUND
+.It Dv HOST_NOT_FOUND
+No such host is known.
+.It Dv TRY_AGAIN
+This is usually a temporary error
+and means that the local server did not receive
+a response from an authoritative server.
+A retry at some later time may succeed.
+.It Dv NO_RECOVERY
+Some unexpected server failure was encountered.
+This is a non-recoverable error.
+.It Dv NO_DATA
+The requested name is valid but does not have an IP address;
+this is not a temporary error.
+This means that the name is known to the name server but there is no address
+associated with this name.
+Another type of request to the name server using this domain name
+will result in an answer;
+for example, a mail-forwarder may be registered for this domain.
+.El
+.Sh SEE ALSO
+.Xr getaddrinfo 3 ,
+.Xr getnameinfo 3 ,
+.Xr inet_aton 3 ,
+.Xr resolver 3 ,
+.Xr hosts 5 ,
+.Xr hostname 7 ,
+.Xr named 8
+.Sh CAVEAT
+The
+.Fn gethostent
+function
+is defined, and
+.Fn sethostent
+and
+.Fn endhostent
+are redefined,
+when
+.Xr libc 3
+is built to use only the routines to lookup in
+.Pa /etc/hosts
+and not the name server.
+.Pp
+The
+.Fn gethostent
+function
+reads the next line of
+.Pa /etc/hosts ,
+opening the file if necessary.
+.Pp
+The
+.Fn sethostent
+function
+opens and/or rewinds the file
+.Pa /etc/hosts .
+If the
+.Fa stayopen
+argument is non-zero,
+the file will not be closed after each call to
+.Fn gethostbyname ,
+.Fn gethostbyname2
+or
+.Fn gethostbyaddr .
+.Pp
+The
+.Fn endhostent
+function
+closes the file.
+.Sh HISTORY
+The
+.Fn herror
+function appeared in
+.Bx 4.3 .
+The
+.Fn endhostent ,
+.Fn gethostbyaddr ,
+.Fn gethostbyname ,
+.Fn gethostent ,
+and
+.Fn sethostent
+functions appeared in
+.Bx 4.2 .
+The
+.Fn gethostbyname2
+function first appeared in
+.Tn BIND
+version 4.9.4.
+.Sh BUGS
+These functions use static data storage;
+if the data is needed for future use, it should be
+copied before any subsequent calls overwrite it.
+Only the Internet
+address format is currently understood.
+.Pp
+.Fn gethostbyname2
+cannot perform
+.Dv AF_INET6
+lookups over NIS.
+.Xr getaddrinfo 3
+must be used instead.
diff --git a/newlib/libc/sys/linux/net/gethostbynis.c b/newlib/libc/sys/linux/net/gethostbynis.c
new file mode 100644
index 000000000..917e9409d
--- /dev/null
+++ b/newlib/libc/sys/linux/net/gethostbynis.c
@@ -0,0 +1,281 @@
+/*-
+ * Copyright (c) 1994, Garrett Wollman
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+#ifdef YP
+#include <rpc/rpc.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+#endif
+
+#ifdef YP
+static char *host_aliases[MAXALIASES];
+static char hostaddr[MAXADDRS];
+static char *host_addrs[2];
+
+static struct hostent *
+_gethostbynis(name, map, af)
+ const char *name;
+ char *map;
+ int af;
+{
+ char *cp, **q;
+ char *result;
+ int resultlen,size;
+ static struct hostent h;
+ static char *domain = (char *)NULL;
+ static char ypbuf[YPMAXRECORD + 2];
+
+ switch(af) {
+ case AF_INET:
+ size = NS_INADDRSZ;
+ break;
+ default:
+ case AF_INET6:
+ size = NS_IN6ADDRSZ;
+ errno = EAFNOSUPPORT;
+ h_errno = NETDB_INTERNAL;
+ return NULL;
+ }
+
+ if (domain == (char *)NULL)
+ if (yp_get_default_domain (&domain)) {
+ h_errno = NETDB_INTERNAL;
+ return ((struct hostent *)NULL);
+ }
+
+ if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) {
+ h_errno = HOST_NOT_FOUND;
+ return ((struct hostent *)NULL);
+ }
+
+ /* avoid potential memory leak */
+ bcopy((char *)result, (char *)&ypbuf, resultlen);
+ ypbuf[resultlen] = '\0';
+ free(result);
+ result = (char *)&ypbuf;
+
+ if ((cp = index(result, '\n')))
+ *cp = '\0';
+
+ cp = strpbrk(result, " \t");
+ *cp++ = '\0';
+ h.h_addr_list = host_addrs;
+ h.h_addr = hostaddr;
+ *((u_long *)h.h_addr) = inet_addr(result);
+ h.h_length = size;
+ h.h_addrtype = AF_INET;
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ h.h_name = cp;
+ q = h.h_aliases = host_aliases;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &host_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ *q = NULL;
+ return (&h);
+}
+
+static struct hostent *
+_gethostbynis_r(name, map, af, hp, buffer, buflen, herr)
+ const char *name;
+ char *map;
+ int af;
+ struct hostent *hp;
+ char *buffer;
+ int buflen;
+ int *herr;
+{
+ char *cp, **q;
+ char *result;
+ int resultlen,size;
+ char *domain = (char *)NULL;
+
+ switch(af) {
+ case AF_INET:
+ size = NS_INADDRSZ;
+ break;
+ default:
+ case AF_INET6:
+ size = NS_IN6ADDRSZ;
+ errno = EAFNOSUPPORT;
+ *herr = NETDB_INTERNAL;
+ return NULL;
+ }
+
+ if (domain == (char *)NULL)
+ if (yp_get_default_domain (&domain)) {
+ *herr = NETDB_INTERNAL;
+ return ((struct hostent *)NULL);
+ }
+
+ if (yp_match(domain, map, name, strlen(name), &result, &resultlen)) {
+ *herr = HOST_NOT_FOUND;
+ return ((struct hostent *)NULL);
+ }
+
+ /* avoid potential memory leak */
+ bcopy((char *)result, buffer, resultlen);
+ buffer[resultlen] = '\0';
+ free(result);
+ result = buffer;
+
+ if ((cp = index(result, '\n')))
+ *cp = '\0';
+
+ cp = strpbrk(result, " \t");
+ *cp++ = '\0';
+ *((u_long *)hp->__host_addrs[0]) = inet_addr(result);
+ hp->__host_addrs[1] = NULL;
+ hp->h_addr_list = hp->__host_addrs;
+ hp->h_addr = hp->__host_addrs[0];
+ hp->h_length = size;
+ hp->h_addrtype = AF_INET;
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ hp->h_name = cp;
+ q = hp->__host_aliases;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &hp->__host_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ hp->h_aliases = hp->__host_aliases;
+ *q = NULL;
+ return (&hp);
+}
+#endif /* YP */
+
+/* XXX _gethostbynisname/_gethostbynisaddr only used by getaddrinfo */
+struct hostent *
+_gethostbynisname(const char *name, int af)
+{
+#ifdef YP
+ return _gethostbynis(name, "hosts.byname", af);
+#else
+ return NULL;
+#endif
+}
+
+struct hostent *
+_gethostbynisaddr(const char *addr, int len, int af)
+{
+#ifdef YP
+ return _gethostbynis(inet_ntoa(*(struct in_addr *)addr),
+ "hosts.byaddr", af);
+#else
+ return NULL;
+#endif
+}
+
+
+int
+_nis_gethostbyname(void *rval, void *cb_data, va_list ap)
+{
+#ifdef YP
+ const char *name;
+ int af;
+ struct hostent *resultbuf;
+ char *buf;
+ int buflen;
+ int *herr;
+
+ name = va_arg(ap, const char *);
+ af = va_arg(ap, int);
+ resultbuf = va_arg(ap, struct hostent *);
+ buf = va_arg(ap, char *);
+ buflen = va_arg(ap, int);
+ herr = va_arg(ap, int *);
+
+ *(struct hostent **)rval = _gethostbynis_r(name, "hosts.byname", af, resultbuf, buf, buflen, herr);
+
+ return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+#else
+ return NS_UNAVAIL;
+#endif
+}
+
+int
+_nis_gethostbyaddr(void *rval, void *cb_data, va_list ap)
+{
+#ifdef YP
+ const char *addr;
+ int len;
+ int af;
+ struct hostent *resultbuf;
+ char *buf;
+ int buflen;
+ int *herr;
+
+ addr = va_arg(ap, const char *);
+ len = va_arg(ap, int);
+ af = va_arg(ap, int);
+ resultbuf = va_arg(ap, struct hostent *);
+ buf = va_arg(ap, char *);
+ buflen = va_arg(ap, int);
+ herr = va_arg(ap, int *);
+
+ *(struct hostent **)rval = _gethostbynis_r(inet_ntoa(*(struct in_addr *)addr),"hosts.byaddr", af);
+ return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+#else
+ return NS_UNAVAIL;
+#endif
+}
diff --git a/newlib/libc/sys/linux/net/gethostnamadr.c b/newlib/libc/sys/linux/net/gethostnamadr.c
new file mode 100644
index 000000000..de1efd8ed
--- /dev/null
+++ b/newlib/libc/sys/linux/net/gethostnamadr.c
@@ -0,0 +1,221 @@
+/*-
+ * Copyright (c) 1994, Garrett Wollman
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+#include <arpa/nameser.h> /* XXX hack for _res */
+#include <resolv.h> /* XXX hack for _res */
+#include <dirent.h>
+
+extern int _ht_gethostbyname(void *, void *, va_list);
+extern int _dns_gethostbyname(void *, void *, va_list);
+extern int _nis_gethostbyname(void *, void *, va_list);
+extern int _ht_gethostbyaddr(void *, void *, va_list);
+extern int _dns_gethostbyaddr(void *, void *, va_list);
+extern int _nis_gethostbyaddr(void *, void *, va_list);
+
+/* Host lookup order if nsswitch.conf is broken or nonexistant */
+static const ns_src default_src[] = {
+ { NSSRC_FILES, NS_SUCCESS },
+ { NSSRC_DNS, NS_SUCCESS },
+ { 0 }
+};
+
+__LOCK_INIT(static, name_lock);
+__LOCK_INIT(static, addr_lock);
+
+struct hostent *
+gethostbyname(const char *name)
+{
+ struct hostent *hp = NULL;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (NULL);
+ }
+ if (_res.options & RES_USE_INET6) { /* XXX */
+ hp = gethostbyname2(name, AF_INET6); /* XXX */
+ if (hp) /* XXX */
+ return (hp); /* XXX */
+ } /* XXX */
+ return (gethostbyname2(name, AF_INET));
+}
+
+struct hostent *
+gethostbyname2(const char *name, int type)
+{
+ static struct hostent host, *hp;
+ static char hostbuf[BUFSIZ];
+ static int herr;
+ int rval;
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_ht_gethostbyname, NULL)
+ { NSSRC_DNS, _dns_gethostbyname, NULL },
+ NS_NIS_CB(_nis_gethostbyname, NULL) /* force -DHESIOD */
+ { 0 }
+ };
+
+#ifdef HAVE_DD_LOCK
+ __lock_acquire(name_lock);
+#endif
+ rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyname",
+ default_src, name, type, &host, hostbuf, BUFSIZ, &herr);
+
+#ifdef HAVE_DD_LOCK
+ __lock_release(name_lock);
+#endif
+ if (rval != NS_SUCCESS)
+ return NULL;
+ else
+ return hp;
+}
+
+int
+__gethostbyname_r(const char *name, struct hostent *result,
+ void *buffer, int buflen, struct hostent **hp, int *herr)
+{
+ int rval;
+ int type;
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_ht_gethostbyname, NULL)
+ { NSSRC_DNS, _dns_gethostbyname, NULL },
+ NS_NIS_CB(_nis_gethostbyname, NULL) /* force -DHESIOD */
+ { 0 }
+ };
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return HOST_NOT_FOUND;
+ }
+
+ if (_res.options & RES_USE_INET6)
+ type = AF_INET6;
+ else
+ type = AF_INET;
+
+ rval = nsdispatch((void *)hp, dtab, NSDB_HOSTS, "gethostbyname",
+ default_src, name, type, result, buffer, buflen, herr);
+
+ if (rval != NS_SUCCESS)
+ return rval;
+ else
+ return 0;
+}
+
+struct hostent *
+gethostbyaddr(const char *addr, int len, int type)
+{
+ static struct hostent host, *hp;
+ static char hostbuf[BUFSIZ];
+ static int herr;
+ int rval;
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_ht_gethostbyaddr, NULL)
+ { NSSRC_DNS, _dns_gethostbyaddr, NULL },
+ NS_NIS_CB(_nis_gethostbyaddr, NULL) /* force -DHESIOD */
+ { 0 }
+ };
+
+#ifdef HAVE_DD_LOCK
+ __lock_acquire(addr_lock);
+#endif
+ rval = nsdispatch((void *)&hp, dtab, NSDB_HOSTS, "gethostbyaddr",
+ default_src, addr, len, type, &host, hostbuf, BUFSIZ, &herr);
+
+#ifdef HAVE_DD_LOCK
+ __lock_release(addr_lock);
+#endif
+ if (rval != NS_SUCCESS)
+ return NULL;
+ else
+ return hp;
+}
+
+int
+__gethostbyaddr_r (const char *addr, int len, int type,
+ struct hostent *result, void *buffer, int buflen,
+ struct hostent **hp, int *herr)
+{
+ int rval;
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_ht_gethostbyaddr, NULL)
+ { NSSRC_DNS, _dns_gethostbyaddr, NULL },
+ NS_NIS_CB(_nis_gethostbyaddr, NULL) /* force -DHESIOD */
+ { 0 }
+ };
+
+ rval = nsdispatch((void *)hp, dtab, NSDB_HOSTS, "gethostbyaddr",
+ default_src, addr, len, type, result, buffer, buflen, herr);
+
+ if(rval != NS_SUCCESS)
+ return rval;
+ else
+ return 0;
+}
+
+void
+sethostent(stayopen)
+ int stayopen;
+{
+ _sethosthtent(stayopen);
+ _sethostdnsent(stayopen);
+}
+
+void
+endhostent()
+{
+ _endhosthtent();
+ _endhostdnsent();
+}
+
+void
+sethostent_r(int f, FILE **hostfile, int *stayopen)
+{
+ _sethosthtent_r(f, hostfile, stayopen);
+ _sethostdnsent(f);
+}
+
+void
+endhostent_r(FILE **hostfile, int *stayopen)
+{
+ _endhosthtent_r(hostfile, stayopen);
+ _endhostdnsent();
+}
diff --git a/newlib/libc/sys/linux/net/gethstbyad.c b/newlib/libc/sys/linux/net/gethstbyad.c
deleted file mode 100644
index 97992ad8d..000000000
--- a/newlib/libc/sys/linux/net/gethstbyad.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define FUNCTION_NAME gethostbyaddr
-#define DATABASE_NAME hosts
-#define ADD_PARAMS const void *addr, socklen_t len, int type
-#define ADD_VARIABLES addr, len, type
-#define BUFLEN 1024
-#define NEED_H_ERRNO 1
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/gethstbyad_r.c b/newlib/libc/sys/linux/net/gethstbyad_r.c
deleted file mode 100644
index 244828e8d..000000000
--- a/newlib/libc/sys/linux/net/gethstbyad_r.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 1996,1997,1998,1999,2000,2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-#include <string.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define FUNCTION_NAME gethostbyaddr
-#define DATABASE_NAME hosts
-#define ADD_PARAMS const void *addr, socklen_t len, int type
-#define ADD_VARIABLES addr, len, type
-#define NEED_H_ERRNO 1
-#define NEED__RES 1
-#define NEED__RES_HCONF 1
-/* If the addr parameter is the IPv6 unspecified address no query must
- be performed. */
-#define PREPROCESS \
- if (len == sizeof (struct in6_addr) \
- && __builtin_expect (memcmp (&in6addr_any, addr, \
- sizeof (struct in6_addr)), 1) == 0) \
- { \
- *h_errnop = HOST_NOT_FOUND; \
- *result = NULL; \
- return ENOENT; \
- }
-#define POSTPROCESS \
- if (status == NSS_STATUS_SUCCESS) \
- { \
- _res_hconf_reorder_addrs (resbuf); \
- _res_hconf_trim_domains (resbuf); \
- }
-
-/* Special name for the lookup function. */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/gethstbynm.c b/newlib/libc/sys/linux/net/gethstbynm.c
deleted file mode 100644
index e94eb0a0f..000000000
--- a/newlib/libc/sys/linux/net/gethstbynm.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <errno.h>
-#include <netdb.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define FUNCTION_NAME gethostbyname
-#define DATABASE_NAME hosts
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-#define BUFLEN 1024
-#define NEED_H_ERRNO 1
-
-#define HANDLE_DIGITS_DOTS 1
-
-#include <getXXbyYY.c>
diff --git a/newlib/libc/sys/linux/net/gethstbynm2.c b/newlib/libc/sys/linux/net/gethstbynm2.c
deleted file mode 100644
index b365511a8..000000000
--- a/newlib/libc/sys/linux/net/gethstbynm2.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <errno.h>
-#include <netdb.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define FUNCTION_NAME gethostbyname2
-#define DATABASE_NAME hosts
-#define ADD_PARAMS const char *name, int af
-#define ADD_VARIABLES name, af
-#define BUFLEN 1024
-#define NEED_H_ERRNO 1
-
-#define HANDLE_DIGITS_DOTS 1
-#define HAVE_AF 1
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/gethstbynm2_r.c b/newlib/libc/sys/linux/net/gethstbynm2_r.c
deleted file mode 100644
index c7a2201c2..000000000
--- a/newlib/libc/sys/linux/net/gethstbynm2_r.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <errno.h>
-#include <netdb.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define FUNCTION_NAME gethostbyname2
-#define DATABASE_NAME hosts
-#define ADD_PARAMS const char *name, int af
-#define ADD_VARIABLES name, af
-#define NEED_H_ERRNO 1
-#define NEED__RES_HCONF 1
-#define POSTPROCESS \
- if (status == NSS_STATUS_SUCCESS) \
- _res_hconf_reorder_addrs (resbuf);
-
-#define HANDLE_DIGITS_DOTS 1
-#define HAVE_LOOKUP_BUFFER 1
-#define HAVE_AF 1
-
-/* Special name for the lookup function. */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/gethstbynm_r.c b/newlib/libc/sys/linux/net/gethstbynm_r.c
deleted file mode 100644
index ccdd6c2a4..000000000
--- a/newlib/libc/sys/linux/net/gethstbynm_r.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <errno.h>
-#include <netdb.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define FUNCTION_NAME gethostbyname
-#define DATABASE_NAME hosts
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-#define NEED_H_ERRNO 1
-#define NEED__RES_HCONF 1
-#define POSTPROCESS \
- if (status == NSS_STATUS_SUCCESS) \
- _res_hconf_reorder_addrs (resbuf);
-
-#define HANDLE_DIGITS_DOTS 1
-#define HAVE_LOOKUP_BUFFER 1
-
-/* Special name for the lookup function. */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/gethstent.c b/newlib/libc/sys/linux/net/gethstent.c
deleted file mode 100644
index eab9f8f79..000000000
--- a/newlib/libc/sys/linux/net/gethstent.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define GETFUNC_NAME gethostent
-#define BUFLEN 1024
-#define NEED_H_ERRNO 1
-
-#include "getXXent.c"
diff --git a/newlib/libc/sys/linux/net/gethstent_r.c b/newlib/libc/sys/linux/net/gethstent_r.c
deleted file mode 100644
index c8afa8128..000000000
--- a/newlib/libc/sys/linux/net/gethstent_r.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct hostent
-#define SETFUNC_NAME sethostent
-#define GETFUNC_NAME gethostent
-#define ENDFUNC_NAME endhostent
-#define DATABASE_NAME hosts
-#define STAYOPEN int stayopen
-#define STAYOPEN_VAR stayopen
-#define NEED_H_ERRNO 1
-#define NEED__RES 1
-
-/* Special name for the lookup function. */
-#define DB_LOOKUP_FCT __nss_hosts_lookup
-
-#include "getXXent_r.c"
diff --git a/newlib/libc/sys/linux/net/getifaddrs.3 b/newlib/libc/sys/linux/net/getifaddrs.3
new file mode 100644
index 000000000..47e50049d
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getifaddrs.3
@@ -0,0 +1,164 @@
+.\" $FreeBSD: src/lib/libc/net/getifaddrs.3,v 1.6 2001/10/01 16:08:55 ru Exp $
+.\" $KAME: getifaddrs.3,v 1.4 2000/05/17 14:13:14 itojun Exp $
+.\" BSDI getifaddrs.3,v 2.5 2000/02/23 14:51:59 dab Exp
+.\"
+.\" Copyright (c) 1995, 1999
+.\" Berkeley Software Design, Inc. 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.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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.
+.Dd October 12, 1995
+.Dt GETIFADDRS 3
+.Os
+.Sh NAME
+.Nm getifaddrs
+.Nd get interface addresses
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In ifaddrs.h
+.Ft int
+.Fn getifaddrs "struct ifaddrs **ifap"
+.Ft void
+.Fn freeifaddrs "struct ifaddrs *ifp"
+.Sh DESCRIPTION
+The
+.Fn getifaddrs
+function stores a reference to a linked list of the network interfaces
+on the local machine in the memory referenced by
+.Fa ifap .
+The list consists of
+.Nm ifaddrs
+structures, as defined in the include file
+.Aq Pa ifaddrs.h .
+The
+.Nm ifaddrs
+structure contains at least the following entries:
+.Bd -literal
+ struct ifaddrs *ifa_next; /* Pointer to next struct */
+ char *ifa_name; /* Interface name */
+ u_int ifa_flags; /* Interface flags */
+ struct sockaddr *ifa_addr; /* Interface address */
+ struct sockaddr *ifa_netmask; /* Interface netmask */
+ struct sockaddr *ifa_broadaddr; /* Interface broadcast address */
+ struct sockaddr *ifa_dstaddr; /* P2P interface destination */
+ void *ifa_data; /* Address specific data */
+.Ed
+.Pp
+The
+.Li ifa_next
+field contains a pointer to the next structure on the list.
+This field is
+.Dv NULL
+in last structure on the list.
+.Pp
+The
+.Li ifa_name
+field contains the interface name.
+.Pp
+The
+.Li ifa_flags
+field contains the interface flags, as set by
+.Xr ifconfig 8
+utility.
+.Pp
+The
+.Li ifa_addr
+field references either the address of the interface or the link level
+address of the interface, if one exists, otherwise it is NULL.
+(The
+.Li sa_family
+field of the
+.Li ifa_addr
+field should be consulted to determine the format of the
+.Li ifa_addr
+address.)
+.Pp
+The
+.Li ifa_netmask
+field references the netmask associated with
+.Li ifa_addr ,
+if one is set, otherwise it is NULL.
+.Pp
+The
+.Li ifa_broadaddr
+field,
+which should only be referenced for non-P2P interfaces,
+references the broadcast address associated with
+.Li ifa_addr ,
+if one exists, otherwise it is NULL.
+.Pp
+The
+.Li ifa_dstaddr
+field references the destination address on a P2P interface,
+if one exists, otherwise it is NULL.
+.Pp
+The
+.Li ifa_data
+field references address family specific data. For
+.Dv AF_LINK
+addresses it contains a pointer to the
+.Fa struct if_data
+(as defined in include file
+.Aq Pa net/if.h )
+which contains various interface attributes and statistics.
+For all other address families, it contains a pointer to the
+.Fa struct ifa_data
+(as defined in include file
+.Aq Pa net/if.h )
+which contains per-address interface statistics.
+.Pp
+The data returned by
+.Fn getifaddrs
+is dynamically allocated and should be freed using
+.Fn freeifaddrs
+when no longer needed.
+.Sh RETURN VALUES
+.Rv -std getifaddrs
+.Sh ERRORS
+The
+.Fn getifaddrs
+may fail and set
+.Va errno
+for any of the errors specified for the library routines
+.Xr ioctl 2 ,
+.Xr socket 2 ,
+.Xr malloc 3
+or
+.Xr sysctl 3 .
+.Sh BUGS
+If both
+.Aq Pa net/if.h
+and
+.Aq Pa ifaddrs.h
+are being included,
+.Aq Pa net/if.h
+.Em must
+be included before
+.Aq Pa ifaddrs.h .
+.Sh SEE ALSO
+.Xr ioctl 2 ,
+.Xr socket 2 ,
+.Xr sysctl 3 ,
+.Xr networking 4 ,
+.Xr ifconfig 8
+.Sh HISTORY
+The
+.Nm
+implementation first appeared in BSDi
+.Bsx .
diff --git a/newlib/libc/sys/linux/net/getifaddrs.c b/newlib/libc/sys/linux/net/getifaddrs.c
new file mode 100644
index 000000000..fdb8c9b9d
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getifaddrs.c
@@ -0,0 +1,401 @@
+/* $KAME: getifaddrs.c,v 1.9 2001/08/20 02:31:20 itojun Exp $ */
+
+/*
+ * Copyright (c) 1995, 1999
+ * Berkeley Software Design, Inc. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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.
+ *
+ * BSDI getifaddrs.c,v 2.12 2000/02/23 14:51:59 dab Exp
+ */
+/*
+ * NOTE: SIOCGIFCONF case is not LP64 friendly. it also does not perform
+ * try-and-error for region size.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/types.h>
+#include <sys/sockio.h>
+#include <unistd.h>
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#ifdef NET_RT_IFLIST
+#include <sys/param.h>
+#include <net/route.h>
+#include <sys/sysctl.h>
+#include <net/if_dl.h>
+#endif
+
+#include <ifaddrs.h>
+#include <stdlib.h>
+#include <string.h>
+#include "un-namespace.h"
+
+#if !defined(AF_LINK)
+#define SA_LEN(sa) sizeof(struct sockaddr)
+#endif
+
+#if !defined(SA_LEN)
+#define SA_LEN(sa) sizeof(struct sockaddr)
+#endif
+
+#define SALIGN (sizeof(long) - 1)
+#define SA_RLEN(sa) (sizeof(struct sockaddr) ? ((sizeof(struct sockaddr) + SALIGN) & ~SALIGN) : (SALIGN + 1))
+
+#ifndef ALIGNBYTES
+/*
+ * On systems with a routing socket, ALIGNBYTES should match the value
+ * that the kernel uses when building the messages.
+ */
+#define ALIGNBYTES XXX
+#endif
+#ifndef ALIGN
+#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+#endif
+
+#if _BSDI_VERSION >= 199701
+#define HAVE_IFM_DATA
+#endif
+
+#if _BSDI_VERSION >= 199802
+/* ifam_data is very specific to recent versions of bsdi */
+#define HAVE_IFAM_DATA
+#endif
+
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#define HAVE_IFM_DATA
+#endif
+
+int
+getifaddrs(struct ifaddrs **pif)
+{
+ int icnt = 1;
+ int dcnt = 0;
+ int ncnt = 0;
+#ifdef NET_RT_IFLIST
+ int mib[6];
+ size_t needed;
+ char *buf;
+ char *next;
+ struct ifaddrs *cif = 0;
+ char *p, *p0;
+ struct rt_msghdr *rtm;
+ struct if_msghdr *ifm;
+ struct ifa_msghdr *ifam;
+ struct sockaddr_dl *dl;
+ struct sockaddr *sa;
+ struct ifaddrs *ifa, *ift;
+ u_short idx = 0;
+#else /* NET_RT_IFLIST */
+ struct ifaddrs *ifa, *ift;
+ char buf[1024];
+ int m, sock;
+ struct ifconf ifc;
+ struct ifreq *ifr;
+ struct ifreq *lifr;
+#endif /* NET_RT_IFLIST */
+ int i;
+ size_t len, alen;
+ char *data;
+ char *names;
+
+#ifdef NET_RT_IFLIST
+ mib[0] = CTL_NET;
+ mib[1] = PF_ROUTE;
+ mib[2] = 0; /* protocol */
+ mib[3] = 0; /* wildcard address family */
+ mib[4] = NET_RT_IFLIST;
+ mib[5] = 0; /* no flags */
+ if (__sysctl(mib, 6, NULL, &needed, NULL, 0) < 0)
+ return (-1);
+ if ((buf = malloc(needed)) == NULL)
+ return (-1);
+ if (__sysctl(mib, 6, buf, &needed, NULL, 0) < 0) {
+ free(buf);
+ return (-1);
+ }
+
+ for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
+ rtm = (struct rt_msghdr *)(void *)next;
+ if (rtm->rtm_version != RTM_VERSION)
+ continue;
+ switch (rtm->rtm_type) {
+ case RTM_IFINFO:
+ ifm = (struct if_msghdr *)(void *)rtm;
+ if (ifm->ifm_addrs & RTA_IFP) {
+ idx = ifm->ifm_index;
+ ++icnt;
+ dl = (struct sockaddr_dl *)(void *)(ifm + 1);
+ dcnt += SA_RLEN((struct sockaddr *)(void*)dl) +
+ ALIGNBYTES;
+#ifdef HAVE_IFM_DATA
+ dcnt += sizeof(ifm->ifm_data);
+#endif /* HAVE_IFM_DATA */
+ ncnt += dl->sdl_nlen + 1;
+ } else
+ idx = 0;
+ break;
+
+ case RTM_NEWADDR:
+ ifam = (struct ifa_msghdr *)(void *)rtm;
+ if (idx && ifam->ifam_index != idx)
+ abort(); /* this cannot happen */
+
+#define RTA_MASKS (RTA_NETMASK | RTA_IFA | RTA_BRD)
+ if (idx == 0 || (ifam->ifam_addrs & RTA_MASKS) == 0)
+ break;
+ p = (char *)(void *)(ifam + 1);
+ ++icnt;
+#ifdef HAVE_IFAM_DATA
+ dcnt += sizeof(ifam->ifam_data) + ALIGNBYTES;
+#endif /* HAVE_IFAM_DATA */
+ /* Scan to look for length of address */
+ alen = 0;
+ for (p0 = p, i = 0; i < RTAX_MAX; i++) {
+ if ((RTA_MASKS & ifam->ifam_addrs & (1 << i))
+ == 0)
+ continue;
+ sa = (struct sockaddr *)(void *)p;
+ len = SA_RLEN(sa);
+ if (i == RTAX_IFA) {
+ alen = len;
+ break;
+ }
+ p += len;
+ }
+ for (p = p0, i = 0; i < RTAX_MAX; i++) {
+ if ((RTA_MASKS & ifam->ifam_addrs & (1 << i))
+ == 0)
+ continue;
+ sa = (struct sockaddr *)(void *)p;
+ len = SA_RLEN(sa);
+ if (i == RTAX_NETMASK && SA_LEN(sa) == 0)
+ dcnt += alen;
+ else
+ dcnt += len;
+ p += len;
+ }
+ break;
+ }
+ }
+#else /* NET_RT_IFLIST */
+ ifc.ifc_buf = buf;
+ ifc.ifc_len = sizeof(buf);
+
+ if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
+ return (-1);
+ i = ioctl(sock, SIOCGIFCONF, (char *)&ifc);
+ close(sock);
+ if (i < 0)
+ return (-1);
+
+ ifr = ifc.ifc_req;
+ lifr = (struct ifreq *)&ifc.ifc_buf[ifc.ifc_len];
+
+ while (ifr < lifr) {
+ struct sockaddr *sa;
+
+ sa = &ifr->ifr_addr;
+ ++icnt;
+ dcnt += SA_RLEN(sa);
+ ncnt += sizeof(ifr->ifr_name) + 1;
+
+ if (SA_LEN(sa) < sizeof(*sa))
+ ifr = (struct ifreq *)(((char *)sa) + sizeof(*sa));
+ else
+ ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa));
+ }
+#endif /* NET_RT_IFLIST */
+
+ if (icnt + dcnt + ncnt == 1) {
+ *pif = NULL;
+ free(buf);
+ return (0);
+ }
+ data = malloc(sizeof(struct ifaddrs) * icnt + dcnt + ncnt);
+ if (data == NULL) {
+ free(buf);
+ return(-1);
+ }
+
+ ifa = (struct ifaddrs *)(void *)data;
+ data += sizeof(struct ifaddrs) * icnt;
+ names = data + dcnt;
+
+ memset(ifa, 0, sizeof(struct ifaddrs) * icnt);
+ ift = ifa;
+
+#ifdef NET_RT_IFLIST
+ idx = 0;
+ for (next = buf; next < buf + needed; next += rtm->rtm_msglen) {
+ rtm = (struct rt_msghdr *)(void *)next;
+ if (rtm->rtm_version != RTM_VERSION)
+ continue;
+ switch (rtm->rtm_type) {
+ case RTM_IFINFO:
+ ifm = (struct if_msghdr *)(void *)rtm;
+ if (ifm->ifm_addrs & RTA_IFP) {
+ idx = ifm->ifm_index;
+ dl = (struct sockaddr_dl *)(void *)(ifm + 1);
+
+ cif = ift;
+ ift->ifa_name = names;
+ ift->ifa_flags = (int)ifm->ifm_flags;
+ memcpy(names, dl->sdl_data,
+ (size_t)dl->sdl_nlen);
+ names[dl->sdl_nlen] = 0;
+ names += dl->sdl_nlen + 1;
+
+ ift->ifa_addr = (struct sockaddr *)(void *)data;
+ memcpy(data, dl,
+ (size_t)SA_LEN((struct sockaddr *)
+ (void *)dl));
+ data += SA_RLEN((struct sockaddr *)(void *)dl);
+
+#ifdef HAVE_IFM_DATA
+ /* ifm_data needs to be aligned */
+ ift->ifa_data = data = (void *)ALIGN(data);
+ memcpy(data, &ifm->ifm_data, sizeof(ifm->ifm_data));
+ data += sizeof(ifm->ifm_data);
+#else /* HAVE_IFM_DATA */
+ ift->ifa_data = NULL;
+#endif /* HAVE_IFM_DATA */
+
+ ift = (ift->ifa_next = ift + 1);
+ } else
+ idx = 0;
+ break;
+
+ case RTM_NEWADDR:
+ ifam = (struct ifa_msghdr *)(void *)rtm;
+ if (idx && ifam->ifam_index != idx)
+ abort(); /* this cannot happen */
+
+ if (idx == 0 || (ifam->ifam_addrs & RTA_MASKS) == 0)
+ break;
+ ift->ifa_name = cif->ifa_name;
+ ift->ifa_flags = cif->ifa_flags;
+ ift->ifa_data = NULL;
+ p = (char *)(void *)(ifam + 1);
+ /* Scan to look for length of address */
+ alen = 0;
+ for (p0 = p, i = 0; i < RTAX_MAX; i++) {
+ if ((RTA_MASKS & ifam->ifam_addrs & (1 << i))
+ == 0)
+ continue;
+ sa = (struct sockaddr *)(void *)p;
+ len = SA_RLEN(sa);
+ if (i == RTAX_IFA) {
+ alen = len;
+ break;
+ }
+ p += len;
+ }
+ for (p = p0, i = 0; i < RTAX_MAX; i++) {
+ if ((RTA_MASKS & ifam->ifam_addrs & (1 << i))
+ == 0)
+ continue;
+ sa = (struct sockaddr *)(void *)p;
+ len = SA_RLEN(sa);
+ switch (i) {
+ case RTAX_IFA:
+ ift->ifa_addr =
+ (struct sockaddr *)(void *)data;
+ memcpy(data, p, len);
+ data += len;
+ break;
+
+ case RTAX_NETMASK:
+ ift->ifa_netmask =
+ (struct sockaddr *)(void *)data;
+ if (SA_LEN(sa) == 0) {
+ memset(data, 0, alen);
+ data += alen;
+ break;
+ }
+ memcpy(data, p, len);
+ data += len;
+ break;
+
+ case RTAX_BRD:
+ ift->ifa_broadaddr =
+ (struct sockaddr *)(void *)data;
+ memcpy(data, p, len);
+ data += len;
+ break;
+ }
+ p += len;
+ }
+
+#ifdef HAVE_IFAM_DATA
+ /* ifam_data needs to be aligned */
+ ift->ifa_data = data = (void *)ALIGN(data);
+ memcpy(data, &ifam->ifam_data, sizeof(ifam->ifam_data));
+ data += sizeof(ifam->ifam_data);
+#endif /* HAVE_IFAM_DATA */
+
+ ift = (ift->ifa_next = ift + 1);
+ break;
+ }
+ }
+
+ free(buf);
+#else /* NET_RT_IFLIST */
+ ifr = ifc.ifc_req;
+ lifr = (struct ifreq *)&ifc.ifc_buf[ifc.ifc_len];
+
+ while (ifr < lifr) {
+ struct sockaddr *sa;
+
+ ift->ifa_name = names;
+ names[sizeof(ifr->ifr_name)] = 0;
+ strncpy(names, ifr->ifr_name, sizeof(ifr->ifr_name));
+ while (*names++)
+ ;
+
+ ift->ifa_addr = (struct sockaddr *)data;
+ sa = &ifr->ifr_addr;
+ memcpy(data, sa, SA_LEN(sa));
+ data += SA_RLEN(sa);
+
+ ifr = (struct ifreq *)(((char *)sa) + SA_LEN(sa));
+ ift = (ift->ifa_next = ift + 1);
+ }
+#endif /* NET_RT_IFLIST */
+ if (--ift >= ifa) {
+ ift->ifa_next = NULL;
+ *pif = ifa;
+ } else {
+ *pif = NULL;
+ free(ifa);
+ }
+ return (0);
+}
+
+void
+freeifaddrs(struct ifaddrs *ifp)
+{
+
+ free(ifp);
+}
diff --git a/newlib/libc/sys/linux/net/getipnodebyname.3 b/newlib/libc/sys/linux/net/getipnodebyname.3
new file mode 100644
index 000000000..5b8ea1ecb
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getipnodebyname.3
@@ -0,0 +1,461 @@
+.\" $FreeBSD: src/lib/libc/net/getipnodebyname.3,v 1.8 2001/10/01 16:08:55 ru Exp $
+.\" $KAME: getipnodebyname.3,v 1.6 2000/08/09 21:16:17 itojun Exp $
+.\"
+.\" Copyright (c) 1983, 1987, 1991, 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.
+.\"
+.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
+.\"
+.Dd May 25, 1995
+.Dt GETIPNODEBYNAME 3
+.Os
+.\"
+.Sh NAME
+.Nm getipnodebyname ,
+.Nm getipnodebyaddr ,
+.Nm freehostent
+.Nd nodename-to-address and address-to-nodename translation
+.\"
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netdb.h
+.Ft "struct hostent *"
+.Fn getipnodebyname "const char *name" "int af" "int flags" "int *error_num"
+.Ft "struct hostent *"
+.Fn getipnodebyaddr "const void *src" "size_t len" "int af" "int *error_num"
+.Ft void
+.Fn freehostent "struct hostent *ptr"
+.\"
+.Sh DESCRIPTION
+.Fn getipnodebyname
+and
+.Fn getipnodebyaddr
+functions are very similar to
+.Xr gethostbyname 3 ,
+.Xr gethostbyname2 3
+and
+.Xr gethostbyaddr 3 .
+The functions cover all the functionalities provided by the older ones,
+and provide better interface to programmers.
+The functions require additional arguments,
+.Ar af ,
+and
+.Ar flags ,
+for specifying address family and operation mode.
+The additional arguments allow programmer to get address for a nodename,
+for specific address family
+(such as
+.Dv AF_INET
+or
+.Dv AF_INET6 ) .
+The functions also require an additional pointer argument,
+.Ar error_num
+to return the appropriate error code,
+to support thread safe error code returns.
+.Pp
+The type and usage of the return value,
+.Li "struct hostent"
+is described in
+.Xr gethostbyname 3 .
+.Pp
+For
+.Fn getipnodebyname ,
+the
+.Ar name
+argument can be either a node name or a numeric address
+string
+(i.e., a dotted-decimal IPv4 address or an IPv6 hex address).
+The
+.Ar af
+argument specifies the address family, either
+.Dv AF_INET
+or
+.Dv AF_INET6 .
+The
+.Ar flags
+argument specifies the types of addresses that are searched for,
+and the types of addresses that are returned.
+We note that a special flags value of
+.Dv AI_DEFAULT
+(defined below)
+should handle most applications.
+That is, porting simple applications to use IPv6 replaces the call
+.Bd -literal -offset
+ hptr = gethostbyname(name);
+.Ed
+.Pp
+with
+.Bd -literal -offset
+ hptr = getipnodebyname(name, AF_INET6, AI_DEFAULT, &error_num);
+.Ed
+.Pp
+Applications desiring finer control over the types of addresses
+searched for and returned, can specify other combinations of the
+.Ar flags
+argument.
+.Pp
+A
+.Ar flags
+of
+.Li 0
+implies a strict interpretation of the
+.Ar af
+argument:
+.Bl -bullet
+.It
+If
+.Ar flags
+is 0 and
+.Ar af
+is
+.Dv AF_INET ,
+then the caller wants only IPv4 addresses.
+A query is made for
+.Li A
+records.
+If successful, the IPv4 addresses are returned and the
+.Li h_length
+member of the
+.Li hostent
+structure will be 4, else the function returns a
+.Dv NULL
+pointer.
+.It
+If
+.Ar flags
+is 0 and if
+.Ar af
+is
+.Li AF_INET6 ,
+then the caller wants only IPv6 addresses.
+A query is made for
+.Li AAAA
+records.
+If successful, the IPv6 addresses are returned and the
+.Li h_length
+member of the
+.Li hostent
+structure will be 16, else the function returns a
+.Dv NULL
+pointer.
+.El
+.Pp
+Other constants can be logically-ORed into the
+.Ar flags
+argument, to modify the behavior of the function.
+.Bl -bullet
+.It
+If the
+.Dv AI_V4MAPPED
+flag is specified along with an
+.Ar af
+of
+.Dv AF_INET6 ,
+then the caller will accept IPv4-mapped IPv6 addresses.
+That is, if no
+.Li AAAA
+records are found then a query is made for
+.Li A
+records and any found are returned as IPv4-mapped IPv6 addresses
+.Li ( h_length
+will be 16).
+The
+.Dv AI_V4MAPPED
+flag is ignored unless
+.Ar af
+equals
+.Dv AF_INET6 .
+.It
+The
+.Dv AI_V4MAPPED_CFG
+flag is exact same as the
+.Dv AI_V4MAPPED
+flag only if the kernel supports IPv4-mapped IPv6 address.
+.It
+If the
+.Dv AI_ALL
+flag is used in conjunction with the
+.Dv AI_V4MAPPED
+flag, and only used with the IPv6 address family.
+When
+.Dv AI_ALL
+is logically or'd with
+.Dv AI_V4MAPPED
+flag then the caller wants all addresses: IPv6 and IPv4-mapped IPv6.
+A query is first made for
+.Li AAAA
+records and if successful, the
+IPv6 addresses are returned. Another query is then made for
+.Li A
+records and any found are returned as IPv4-mapped IPv6 addresses.
+.Li h_length
+will be 16. Only if both queries fail does the function
+return a
+.Dv NULL
+pointer. This flag is ignored unless af equals
+AF_INET6. If both
+.Dv AI_ALL
+and
+.Dv AI_V4MAPPED
+are specified,
+.Dv AI_ALL
+takes precedence.
+.It
+The
+.Dv AI_ADDRCONFIG
+flag specifies that a query for
+.Li AAAA
+records
+should occur only if the node has at least one IPv6 source
+address configured and a query for
+.Li A
+records should occur only if the node has at least one IPv4 source address
+configured.
+.Pp
+For example, if the node has no IPv6 source addresses configured,
+and
+.Ar af
+equals AF_INET6, and the node name being looked up has both
+.Li AAAA
+and
+.Li A
+records, then:
+(a) if only
+.Dv AI_ADDRCONFIG
+is
+specified, the function returns a
+.Dv NULL
+pointer;
+(b) if
+.Dv AI_ADDRCONFIG
+|
+.Dv AI_V4MAPPED
+is specified, the
+.Li A
+records are returned as IPv4-mapped IPv6 addresses;
+.El
+.Pp
+The special flags value of
+.Dv AI_DEFAULT
+is defined as
+.Bd -literal -offset
+ #define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
+.Ed
+.Pp
+We noted that the
+.Fn getipnodebyname
+function must allow the
+.Ar name
+argument to be either a node name or a literal address string
+(i.e., a dotted-decimal IPv4 address or an IPv6 hex address).
+This saves applications from having to call
+.Xr inet_pton 3
+to handle literal address strings.
+When the
+.Ar name
+argument is a literal address string,
+the
+.Ar flags
+argument is always ignored.
+.Pp
+There are four scenarios based on the type of literal address string
+and the value of the
+.Ar af
+argument.
+The two simple cases are when
+.Ar name
+is a dotted-decimal IPv4 address and
+.Ar af
+equals
+.Dv AF_INET ,
+or when
+.Ar name
+is an IPv6 hex address and
+.Ar af
+equals
+.Dv AF_INET6 .
+The members of the
+returned hostent structure are:
+.Li h_name
+points to a copy of the
+.Ar name
+argument,
+.Li h_aliases
+is a
+.Dv NULL
+pointer,
+.Li h_addrtype
+is a copy of the
+.Ar af
+argument,
+.Li h_length
+is either 4
+(for
+.Dv AF_INET )
+or 16
+(for
+.Dv AF_INET6 ) ,
+.Li h_addr_list[0]
+is a pointer to the 4-byte or 16-byte binary address,
+and
+.Li h_addr_list[1]
+is a
+.Dv NULL
+pointer.
+.Pp
+When
+.Ar name
+is a dotted-decimal IPv4 address and
+.Ar af
+equals
+.Dv AF_INET6 ,
+and
+.Dv AI_V4MAPPED
+is specified,
+an IPv4-mapped IPv6 address is returned:
+.Li h_name
+points to an IPv6 hex address containing the IPv4-mapped IPv6 address,
+.Li h_aliases
+is a
+.Dv NULL
+pointer,
+.Li h_addrtype
+is
+.Dv AF_INET6 ,
+.Li h_length
+is 16,
+.Li h_addr_list[0]
+is a pointer to the 16-byte binary address, and
+.Li h_addr_list[1]
+is a
+.Dv NULL
+pointer.
+.Pp
+It is an error when
+.Ar name
+is an IPv6 hex address and
+.Ar af
+equals
+.Dv AF_INET .
+The function's return value is a
+.Dv NULL
+pointer and the value pointed to by
+.Ar error_num
+equals
+.Dv HOST_NOT_FOUND .
+.Pp
+.Fn getipnodebyaddr
+takes almost the same argument as
+.Xr gethostbyaddr 3 ,
+but adds a pointer to return an error number.
+Additionally it takes care of IPv4-mapped IPv6 addresses,
+and IPv4-compatible IPv6 addresses.
+.Pp
+.Fn getipnodebyname
+and
+.Fn getipnodebyaddr
+dynamically allocate the structure to be returned to the caller.
+.Fn freehostent
+reclaims memory region allocated and returned by
+.Fn getipnodebyname
+or
+.Fn getipnodebyaddr .
+.\"
+.Sh FILES
+.Bl -tag -width /etc/nsswitch.conf -compact
+.It Pa /etc/hosts
+.It Pa /etc/nsswitch.conf
+.It Pa /etc/resolv.conf
+.El
+.\"
+.Sh DIAGNOSTICS
+.Fn getipnodebyname
+and
+.Fn getipnodebyaddr
+returns
+.Dv NULL
+on errors.
+The integer values pointed to by
+.Ar error_num
+may then be checked to see whether this is a temporary failure
+or an invalid or unknown host.
+The meanings of each error code are described in
+.Xr gethostbyname 3 .
+.\"
+.Sh SEE ALSO
+.Xr gethostbyaddr 3 ,
+.Xr gethostbyname 3 ,
+.Xr hosts 5 ,
+.Xr nsswitch.conf 5 ,
+.Xr services 5 ,
+.Xr hostname 7 ,
+.Xr named 8
+.Pp
+.Rs
+.%A R. Gilligan
+.%A S. Thomson
+.%A J. Bound
+.%A W. Stevens
+.%T Basic Socket Interface Extensions for IPv6
+.%R RFC2553
+.%D March 1999
+.Re
+.\"
+.Sh HISTORY
+The implementation first appeared in KAME advanced networking kit.
+.\"
+.Sh STANDARDS
+.Fn getipnodebyname
+and
+.Fn getipnodebyaddr
+are documented in
+.Dq Basic Socket Interface Extensions for IPv6
+(RFC2553).
+.\"
+.Sh BUGS
+.Fn getipnodebyname
+and
+.Fn getipnodebyaddr
+do not handle scoped IPv6 address properly.
+If you use these functions,
+your program will not be able to handle scoped IPv6 addresses.
+For IPv6 address manipulation,
+.Fn getaddrinfo 3
+and
+.Fn getnameinfo 3
+are recommended.
+.Pp
+The current implementation is not thread-safe.
+.Pp
+The text was shamelessly copied from RFC2553.
diff --git a/newlib/libc/sys/linux/net/getnameinfo.3 b/newlib/libc/sys/linux/net/getnameinfo.3
new file mode 100644
index 000000000..d7afa2f40
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getnameinfo.3
@@ -0,0 +1,311 @@
+.\" $FreeBSD: src/lib/libc/net/getnameinfo.3,v 1.11 2001/10/01 16:08:55 ru Exp $
+.\" $KAME: getnameinfo.3,v 1.17 2000/08/09 21:16:17 itojun Exp $
+.\"
+.\" Copyright (c) 1983, 1987, 1991, 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.
+.\"
+.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
+.\"
+.Dd May 25, 1995
+.Dt GETNAMEINFO 3
+.Os
+.\"
+.Sh NAME
+.Nm getnameinfo
+.Nd address-to-nodename translation in protocol-independent manner
+.\"
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netdb.h
+.Ft int
+.Fn getnameinfo "const struct sockaddr *sa" "socklen_t salen" \
+"char *host" "size_t hostlen" "char *serv" "size_t servlen" "int flags"
+.\"
+.Sh DESCRIPTION
+The
+.Fn getnameinfo
+function is defined for protocol-independent address-to-nodename translation.
+Its functionality is a reverse conversion of
+.Xr getaddrinfo 3 ,
+and implements similar functionality with
+.Xr gethostbyaddr 3
+and
+.Xr getservbyport 3
+in more sophisticated manner.
+.Pp
+This function looks up an IP address and port number provided by the
+caller in the DNS and system-specific database, and returns text
+strings for both in buffers provided by the caller.
+The function indicates successful completion by a zero return value;
+a non-zero return value indicates failure.
+.Pp
+The first argument,
+.Fa sa ,
+points to either a
+.Li sockaddr_in
+structure (for IPv4) or a
+.Li sockaddr_in6
+structure (for IPv6) that holds the IP address and port number.
+The
+.Fa salen
+argument gives the length of the
+.Li sockaddr_in
+or
+.Li sockaddr_in6
+structure.
+.Pp
+The function returns the nodename associated with the IP address in
+the buffer pointed to by the
+.Fa host
+argument.
+The caller provides the size of this buffer via the
+.Fa hostlen
+argument.
+The service name associated with the port number is returned in the buffer
+pointed to by
+.Fa serv ,
+and the
+.Fa servlen
+argument gives the length of this buffer.
+The caller specifies not to return either string by providing a zero
+value for the
+.Fa hostlen
+or
+.Fa servlen
+arguments.
+Otherwise, the caller must provide buffers large enough to hold the
+nodename and the service name, including the terminating null characters.
+.Pp
+Unfortunately most systems do not provide constants that specify the
+maximum size of either a fully-qualified domain name or a service name.
+Therefore to aid the application in allocating buffers for these two
+returned strings the following constants are defined in
+.Aq Pa netdb.h :
+.Bd -literal -offset
+#define NI_MAXHOST 1025
+#define NI_MAXSERV 32
+.Ed
+.Pp
+The first value is actually defined as the constant
+.Dv MAXDNAME
+in recent versions of BIND's
+.Aq Pa arpa/nameser.h
+header
+(older versions of BIND define this constant to be 256)
+and the second is a guess based on the services listed in the current
+Assigned Numbers RFC.
+.Pp
+The final argument is a
+.Fa flag
+that changes the default actions of this function.
+By default the fully-qualified domain name (FQDN) for the host is
+looked up in the DNS and returned.
+If the flag bit
+.Dv NI_NOFQDN
+is set, only the nodename portion of the FQDN is returned for local hosts.
+.Pp
+If the
+.Fa flag
+bit
+.Dv NI_NUMERICHOST
+is set, or if the host's name cannot be located in the DNS,
+the numeric form of the host's address is returned instead of its name
+(e.g., by calling
+.Fn inet_ntop
+instead of
+.Fn getnodebyaddr ) .
+If the
+.Fa flag
+bit
+.Dv NI_NAMEREQD
+is set, an error is returned if the host's name cannot be located in the DNS.
+.Pp
+If the flag bit
+.Dv NI_NUMERICSERV
+is set, the numeric form of the service address is returned
+(e.g., its port number)
+instead of its name.
+The two
+.Dv NI_NUMERICxxx
+flags are required to support the
+.Fl n
+flag that many commands provide.
+.Pp
+A fifth flag bit,
+.Dv NI_DGRAM ,
+specifies that the service is a datagram service, and causes
+.Fn getservbyport
+to be called with a second argument of
+.Dq udp
+instead of its default of
+.Dq tcp .
+This is required for the few ports (512-514)
+that have different services for UDP and TCP.
+.Pp
+These
+.Dv NI_xxx
+flags are defined in
+.Aq Pa netdb.h .
+.\"
+.Sh EXTENSION
+The implementation allows experimental numeric IPv6 address notation with
+scope identifier.
+IPv6 link-local address will appear as string like
+.Dq Li fe80::1%ne0 ,
+if
+.Dv NI_WITHSCOPEID
+bit is enabled in
+.Ar flags
+argument.
+Refer to
+.Xr getaddrinfo 3
+for the notation.
+.\"
+.Sh EXAMPLES
+The following code tries to get numeric hostname, and service name,
+for given socket address.
+Observe that there is no hardcoded reference to particular address family.
+.Bd -literal -offset indent
+struct sockaddr *sa; /* input */
+char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
+
+if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), sbuf,
+ sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV)) {
+ errx(1, "could not get numeric hostname");
+ /*NOTREACHED*/
+}
+printf("host=%s, serv=%s\\n", hbuf, sbuf);
+.Ed
+.Pp
+The following version checks if the socket address has reverse address mapping.
+.Bd -literal -offset indent
+struct sockaddr *sa; /* input */
+char hbuf[NI_MAXHOST];
+
+if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0,
+ NI_NAMEREQD)) {
+ errx(1, "could not resolve hostname");
+ /*NOTREACHED*/
+}
+printf("host=%s\\n", hbuf);
+.Ed
+.\"
+.Sh FILES
+.Bl -tag -width /etc/nsswitch.conf -compact
+.It Pa /etc/hosts
+.It Pa /etc/nsswitch.conf
+.It Pa /etc/resolv.conf
+.El
+.\"
+.Sh DIAGNOSTICS
+The function indicates successful completion by a zero return value;
+a non-zero return value indicates failure.
+Error codes are as below:
+.Bl -tag -width Er
+.It Bq Er EAI_AGAIN
+The name could not be resolved at this time.
+Future attempts may succeed.
+.It Bq Er EAI_BADFLAGS
+The flags had an invalid value.
+.It Bq Er EAI_FAIL
+A non-recoverable error occurred.
+.It Bq Er EAI_FAMILY
+The address family was not recognized or the address length was invalid
+for the specified family.
+.It Bq Er EAI_MEMORY
+There was a memory allocation failure.
+.It Bq Er EAI_NONAME
+The name does not resolve for the supplied parameters.
+.Dv NI_NAMEREQD
+is set and the host's name cannot be located,
+or both nodename and servname were null.
+.It Bq Er EAI_SYSTEM
+A system error occurred.
+The error code can be found in errno.
+.El
+.\"
+.Sh SEE ALSO
+.Xr getaddrinfo 3 ,
+.Xr gethostbyaddr 3 ,
+.Xr getservbyport 3 ,
+.Xr hosts 5 ,
+.Xr services 5 ,
+.Xr hostname 7 ,
+.Xr named 8
+.Pp
+.Rs
+.%A R. Gilligan
+.%A S. Thomson
+.%A J. Bound
+.%A W. Stevens
+.%T Basic Socket Interface Extensions for IPv6
+.%R RFC2553
+.%D March 1999
+.Re
+.Rs
+.%A Tatsuya Jinmei
+.%A Atsushi Onoe
+.%T "An Extension of Format for IPv6 Scoped Addresses"
+.%R internet draft
+.%N draft-ietf-ipngwg-scopedaddr-format-02.txt
+.%O work in progress material
+.Re
+.Rs
+.%A Craig Metz
+.%T Protocol Independence Using the Sockets API
+.%B "Proceedings of the freenix track: 2000 USENIX annual technical conference"
+.%D June 2000
+.Re
+.\"
+.Sh HISTORY
+The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit.
+.\"
+.Sh STANDARDS
+The
+.Fn getaddrinfo
+function is defined in
+.St -p1003.1g-2000 ,
+and documented in
+.Dq Basic Socket Interface Extensions for IPv6
+(RFC2553).
+.\"
+.Sh BUGS
+The current implementation is not thread-safe.
+.Pp
+The text was shamelessly copied from RFC2553.
+.Pp
+The type of the 2nd argument should be
+.Li socklen_t
+for RFC2553 conformance.
+The current code is based on pre-RFC2553 specification.
diff --git a/newlib/libc/sys/linux/net/getnameinfo.c b/newlib/libc/sys/linux/net/getnameinfo.c
index f79bc317f..e2f9631c1 100644
--- a/newlib/libc/sys/linux/net/getnameinfo.c
+++ b/newlib/libc/sys/linux/net/getnameinfo.c
@@ -1,456 +1,372 @@
-/* The Inner Net License, Version 2.00
-
- The author(s) grant permission for redistribution and use in source and
-binary forms, with or without modification, of the software and documentation
-provided that the following conditions are met:
-
-0. If you receive a version of the software that is specifically labelled
- as not being for redistribution (check the version message and/or README),
- you are not permitted to redistribute that version of the software in any
- way or form.
-1. All terms of the all other applicable copyrights and licenses must be
- followed.
-2. Redistributions of source code must retain the authors' copyright
- notice(s), this list of conditions, and the following disclaimer.
-3. Redistributions in binary form must reproduce the authors' copyright
- notice(s), this list of conditions, and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-4. [The copyright holder has authorized the removal of this clause.]
-5. Neither the name(s) of the author(s) 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 ITS AUTHORS 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 AUTHORS 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.
-
- If these license terms cause you a real problem, contact the author. */
-
-/* This software is Copyright 1996 by Craig Metz, All Rights Reserved. */
+/* $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+/*
+ * Issues to be discussed:
+ * - Thread safe-ness must be checked
+ * - RFC2553 says that we should raise error on short buffer. X/Open says
+ * we need to truncate the result. We obey RFC2553 (and X/Open should be
+ * modified). ipngwg rough consensus seems to follow RFC2553.
+ * - What is "local" in NI_FQDN?
+ * - NI_NAMEREQD and NI_NUMERICHOST conflict with each other.
+ * - (KAME extension) NI_WITHSCOPEID when called with global address,
+ * and sin6_scope_id filled
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
-#include <alloca.h>
-#include <errno.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <arpa/inet.h>
+#include <sys/types.h>
+#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/utsname.h>
-#define _IO_MTSAFE_IO
-#include <bits/libc-lock.h>
-#include <libc-symbols.h>
-#include "local.h"
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <string.h>
+#include <stddef.h>
+#include <errno.h>
-#ifdef HAVE_LIBIDN
-# include <libidn/idna.h>
-extern int __idna_to_unicode_lzlz (const char *input, char **output,
- int flags);
+#define SUCCESS 0
+#define ANY 0
+#define YES 1
+#define NO 0
+
+static struct afd {
+ int a_af;
+ int a_addrlen;
+ int a_socklen;
+ int a_off;
+} afdl [] = {
+#ifdef INET6
+ {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
+ offsetof(struct sockaddr_in6, sin6_addr)},
#endif
+ {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
+ offsetof(struct sockaddr_in, sin_addr)},
+ {0, 0, 0},
+};
-#ifndef min
-# define min(x,y) (((x) > (y)) ? (y) : (x))
-#endif /* min */
+struct sockinet {
+ u_char si_len;
+ u_char si_family;
+ u_short si_port;
+};
-libc_freeres_ptr (static char *domain);
+#ifdef INET6
+static int ip6_parsenumeric(const struct sockaddr *, const char *, char *,
+ size_t, int);
+static int ip6_sa2str(const struct sockaddr_in6 *, char *, size_t, int);
+#endif
+/* 2553bis: use EAI_xx for getnameinfo */
+#define ENI_NOSOCKET EAI_FAIL /*XXX*/
+#define ENI_NOSERVNAME EAI_NONAME
+#define ENI_NOHOSTNAME EAI_NONAME
+#define ENI_MEMORY EAI_MEMORY
+#define ENI_SYSTEM EAI_SYSTEM
+#define ENI_FAMILY EAI_FAMILY
+#define ENI_SALEN EAI_FAMILY
-static char *
-internal_function
-nrl_domainname (void)
+int
+getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
+ const struct sockaddr *sa;
+ socklen_t salen;
+ char *host;
+ size_t hostlen;
+ char *serv;
+ size_t servlen;
+ int flags;
{
- static int not_first;
-
- if (! not_first)
- {
- __libc_lock_define_initialized (static, lock);
- __libc_lock_lock (lock);
-
- if (! not_first)
- {
- char *c;
- struct hostent *h, th;
- size_t tmpbuflen = 1024;
- char *tmpbuf = alloca (tmpbuflen);
- int herror;
-
- not_first = 1;
+ struct afd *afd;
+ struct servent *sp;
+ struct hostent *hp;
+ u_short port;
+ int family, i;
+ const char *addr;
+ u_int32_t v4a;
+ int h_error;
+ char numserv[512];
+ char numaddr[512];
+
+ if (sa == NULL)
+ return ENI_NOSOCKET;
+
+ family = sa->sa_family;
+ for (i = 0; afdl[i].a_af; i++)
+ if (afdl[i].a_af == family) {
+ afd = &afdl[i];
+ goto found;
+ }
+ return ENI_FAMILY;
+
+ found:
+ if (salen != afd->a_socklen)
+ return ENI_SALEN;
+
+ /* network byte order */
+ port = ((const struct sockinet *)sa)->si_port;
+ addr = (const char *)sa + afd->a_off;
+
+ if (serv == NULL || servlen == 0) {
+ /*
+ * do nothing in this case.
+ * in case you are wondering if "&&" is more correct than
+ * "||" here: RFC2553 says that serv == NULL OR servlen == 0
+ * means that the caller does not want the result.
+ */
+ } else {
+ if (flags & NI_NUMERICSERV)
+ sp = NULL;
+ else {
+ sp = getservbyport(port,
+ (flags & NI_DGRAM) ? "udp" : "tcp");
+ }
+ if (sp) {
+ if (strlen(sp->s_name) + 1 > servlen)
+ return ENI_MEMORY;
+ strcpy(serv, sp->s_name);
+ } else {
+ snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
+ if (strlen(numserv) + 1 > servlen)
+ return ENI_MEMORY;
+ strcpy(serv, numserv);
+ }
+ }
- while (__gethostbyname_r ("localhost", &th, tmpbuf, tmpbuflen, &h,
- &herror))
- {
- if (herror == NETDB_INTERNAL && errno == ERANGE)
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
- else
+ switch (sa->sa_family) {
+ case AF_INET:
+ v4a = (u_int32_t)
+ ntohl(((const struct sockaddr_in *)sa)->sin_addr.s_addr);
+ if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
+ flags |= NI_NUMERICHOST;
+ v4a >>= IN_CLASSA_NSHIFT;
+ if (v4a == 0)
+ flags |= NI_NUMERICHOST;
break;
- }
-
- if (h && (c = strchr (h->h_name, '.')))
- domain = strdup (++c);
- else
+#ifdef INET6
+ case AF_INET6:
{
- /* The name contains no domain information. Use the name
- now to get more information. */
- while (__gethostname (tmpbuf, tmpbuflen))
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
-
- if ((c = strchr (tmpbuf, '.')))
- domain = strdup (++c);
- else
- {
- /* We need to preserve the hostname. */
- const char *hstname = alloca (strlen (tmpbuf) + 1);
- strcpy (hstname, tmpbuf);
-
- while (__gethostbyname_r (hstname, &th, tmpbuf, tmpbuflen,
- &h, &herror))
- {
- if (herror == NETDB_INTERNAL && errno == ERANGE)
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
- 2 * tmpbuflen);
- else
+ const struct sockaddr_in6 *sin6;
+ sin6 = (const struct sockaddr_in6 *)sa;
+ switch (sin6->sin6_addr.s6_addr[0]) {
+ case 0x00:
+ if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
+ ;
+ else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
+ ;
+ else
+ flags |= NI_NUMERICHOST;
break;
- }
-
- if (h && (c = strchr(h->h_name, '.')))
- domain = strdup (++c);
- else
- {
- struct in_addr in_addr;
-
- in_addr.s_addr = htonl (INADDR_LOOPBACK);
-
- while (__gethostbyaddr_r ((const char *) &in_addr,
- sizeof (struct in_addr),
- AF_INET, &th, tmpbuf,
- tmpbuflen, &h, &herror))
- {
- if (herror == NETDB_INTERNAL && errno == ERANGE)
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
- 2 * tmpbuflen);
- else
- break;
+ default:
+ if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
+ flags |= NI_NUMERICHOST;
}
-
- if (h && (c = strchr (h->h_name, '.')))
- domain = strdup (++c);
- }
+ else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
+ flags |= NI_NUMERICHOST;
+ break;
}
}
+ break;
+#endif
}
+ if (host == NULL || hostlen == 0) {
+ /*
+ * do nothing in this case.
+ * in case you are wondering if "&&" is more correct than
+ * "||" here: RFC2553 says that host == NULL OR hostlen == 0
+ * means that the caller does not want the result.
+ */
+ } else if (flags & NI_NUMERICHOST) {
+ int numaddrlen;
+
+ /* NUMERICHOST and NAMEREQD conflicts with each other */
+ if (flags & NI_NAMEREQD)
+ return ENI_NOHOSTNAME;
+
+ switch(afd->a_af) {
+#ifdef INET6
+ case AF_INET6:
+ {
+ int error;
- __libc_lock_unlock (lock);
- }
-
- return domain;
-};
+ if ((error = ip6_parsenumeric(sa, addr, host,
+ hostlen, flags)) != 0)
+ return(error);
+ break;
+ }
+#endif
+ default:
+ if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
+ == NULL)
+ return ENI_SYSTEM;
+ numaddrlen = strlen(numaddr);
+ if (numaddrlen + 1 > hostlen) /* don't forget terminator */
+ return ENI_MEMORY;
+ strcpy(host, numaddr);
+ break;
+ }
+ } else {
+ hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
+
+ if (hp) {
+#if 0
+ /*
+ * commented out, since "for local host" is not
+ * implemented here - see RFC2553 p30
+ */
+ if (flags & NI_NOFQDN) {
+ char *p;
+ p = strchr(hp->h_name, '.');
+ if (p)
+ *p = '\0';
+ }
+#endif
+ if (strlen(hp->h_name) + 1 > hostlen) {
+ freehostent(hp);
+ return ENI_MEMORY;
+ }
+ strcpy(host, hp->h_name);
+ freehostent(hp);
+ } else {
+ if (flags & NI_NAMEREQD)
+ return ENI_NOHOSTNAME;
+ switch(afd->a_af) {
+#ifdef INET6
+ case AF_INET6:
+ {
+ int error;
+ if ((error = ip6_parsenumeric(sa, addr, host,
+ hostlen,
+ flags)) != 0)
+ return(error);
+ break;
+ }
+#endif
+ default:
+ if (inet_ntop(afd->a_af, addr, host,
+ hostlen) == NULL)
+ return ENI_SYSTEM;
+ break;
+ }
+ }
+ }
+ return SUCCESS;
+}
-int
-getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
- socklen_t hostlen, char *serv, socklen_t servlen,
- unsigned int flags)
+#ifdef INET6
+static int
+ip6_parsenumeric(sa, addr, host, hostlen, flags)
+ const struct sockaddr *sa;
+ const char *addr;
+ char *host;
+ size_t hostlen;
+ int flags;
{
- int serrno = errno;
- int tmpbuflen = 1024;
- int herrno;
- char *tmpbuf = alloca (tmpbuflen);
- struct hostent th;
- int ok = 0;
-
- if (flags & ~(NI_NUMERICHOST|NI_NUMERICSERV|NI_NOFQDN|NI_NAMEREQD|NI_DGRAM
-#ifdef HAVE_LIBIDN
- |NI_IDN|NI_IDN_ALLOW_UNASSIGNED|NI_IDN_USE_STD3_ASCII_RULES
+ int numaddrlen;
+ char numaddr[512];
+
+ if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr))
+ == NULL)
+ return ENI_SYSTEM;
+
+ numaddrlen = strlen(numaddr);
+ if (numaddrlen + 1 > hostlen) /* don't forget terminator */
+ return ENI_MEMORY;
+ strcpy(host, numaddr);
+
+#ifdef NI_WITHSCOPEID
+ if (
+#ifdef DONT_OPAQUE_SCOPEID
+ (IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr) ||
+ IN6_IS_ADDR_MULTICAST((struct in6_addr *)addr)) &&
#endif
- ))
- return EAI_BADFLAGS;
-
- if (sa == NULL || addrlen < sizeof (sa_family_t))
- return EAI_FAMILY;
-
- switch (sa->sa_family)
- {
- case AF_LOCAL:
- if (addrlen < (socklen_t) (((struct sockaddr_un *) NULL)->sun_path))
- return EAI_FAMILY;
- break;
- case AF_INET:
- if (addrlen < sizeof (struct sockaddr_in))
- return EAI_FAMILY;
- break;
- case AF_INET6:
- if (addrlen < sizeof (struct sockaddr_in6))
- return EAI_FAMILY;
- break;
- default:
- return EAI_FAMILY;
- }
-
- if (host != NULL && hostlen > 0)
- switch (sa->sa_family)
- {
- case AF_INET:
- case AF_INET6:
- if (!(flags & NI_NUMERICHOST))
- {
- struct hostent *h = NULL;
- if (h == NULL)
- {
- if (sa->sa_family == AF_INET6)
- {
- while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
- sizeof(struct in6_addr),
- AF_INET6, &th, tmpbuf, tmpbuflen,
- &h, &herrno))
- {
- if (herrno == NETDB_INTERNAL)
- {
- if (errno == ERANGE)
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
- 2 * tmpbuflen);
- else
- {
- h_errno = (herrno);
- errno = (serrno);
- return EAI_SYSTEM;
- }
- }
- else
- {
- break;
- }
- }
- }
- else
- {
- while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
- sizeof(struct in_addr), AF_INET,
- &th, tmpbuf, tmpbuflen,
- &h, &herrno))
- {
- if (errno == ERANGE)
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
- 2 * tmpbuflen);
- else
- {
- break;
- }
- }
- }
- }
-
- if (h)
- {
- char *c;
- if ((flags & NI_NOFQDN)
- && (c = nrl_domainname ())
- && (c = strstr (h->h_name, c))
- && (c != h->h_name) && (*(--c) == '.'))
- /* Terminate the string after the prefix. */
- *c = '\0';
+ ((const struct sockaddr_in6 *)sa)->sin6_scope_id) {
+#ifndef ALWAYS_WITHSCOPE
+ if (flags & NI_WITHSCOPEID)
+#endif /* !ALWAYS_WITHSCOPE */
+ {
+ char scopebuf[MAXHOSTNAMELEN];
+ int scopelen;
+
+ /* ip6_sa2str never fails */
+ scopelen = ip6_sa2str((const struct sockaddr_in6 *)sa,
+ scopebuf, sizeof(scopebuf),
+ flags);
+ if (scopelen + 1 + numaddrlen + 1 > hostlen)
+ return ENI_MEMORY;
+ /*
+ * construct <numeric-addr><delim><scopeid>
+ */
+ memcpy(host + numaddrlen + 1, scopebuf,
+ scopelen);
+ host[numaddrlen] = SCOPE_DELIMITER;
+ host[numaddrlen + 1 + scopelen] = '\0';
+ }
+ }
+#endif /* NI_WITHSCOPEID */
-#ifdef HAVE_LIBIDN
- /* If requested, convert from the IDN format. */
- if (flags & NI_IDN)
- {
- int idn_flags = 0;
- if (flags & NI_IDN_ALLOW_UNASSIGNED)
- idn_flags |= IDNA_ALLOW_UNASSIGNED;
- if (flags & NI_IDN_USE_STD3_ASCII_RULES)
- idn_flags |= IDNA_USE_STD3_ASCII_RULES;
+ return 0;
+}
- char *out;
- int rc = __idna_to_unicode_lzlz (h->h_name, &out,
- idn_flags);
- if (rc != IDNA_SUCCESS)
- {
- if (rc == IDNA_MALLOC_ERROR)
- return EAI_MEMORY;
- if (rc == IDNA_DLOPEN_ERROR)
- return EAI_SYSTEM;
- return EAI_IDN_ENCODE;
- }
+/* ARGSUSED */
+static int
+ip6_sa2str(sa6, buf, bufsiz, flags)
+ const struct sockaddr_in6 *sa6;
+ char *buf;
+ size_t bufsiz;
+ int flags;
+{
+ unsigned int ifindex = (unsigned int)sa6->sin6_scope_id;
+ const struct in6_addr *a6 = &sa6->sin6_addr;
- if (out != h->h_name)
- {
- h->h_name = strdupa (out);
- free (out);
- }
- }
+#ifdef NI_NUMERICSCOPE
+ if (flags & NI_NUMERICSCOPE) {
+ return(snprintf(buf, bufsiz, "%d", sa6->sin6_scope_id));
+ }
#endif
- size_t len = strlen (h->h_name) + 1;
- if (len > hostlen)
- return EAI_OVERFLOW;
-
- memcpy (host, h->h_name, len);
-
- ok = 1;
- }
- }
-
- if (!ok)
- {
- if (flags & NI_NAMEREQD)
- {
- __set_errno (serrno);
- return EAI_NONAME;
- }
- else
- {
- const char *c;
- if (sa->sa_family == AF_INET6)
- {
- const struct sockaddr_in6 *sin6p;
- uint32_t scopeid;
-
- sin6p = (const struct sockaddr_in6 *) sa;
-
- c = inet_ntop (AF_INET6,
- (const void *) &sin6p->sin6_addr, host, hostlen);
- scopeid = sin6p->sin6_scope_id;
- if (scopeid != 0)
- {
- /* Buffer is >= IFNAMSIZ+1. */
- char scopebuf[IFNAMSIZ + 1];
- char *scopeptr;
- int ni_numericscope = 0;
- size_t real_hostlen = strnlen (host, hostlen);
- size_t scopelen = 0;
-
- scopebuf[0] = SCOPE_DELIMITER;
- scopebuf[1] = '\0';
- scopeptr = &scopebuf[1];
-
- if (IN6_IS_ADDR_LINKLOCAL (&sin6p->sin6_addr)
- || IN6_IS_ADDR_MC_LINKLOCAL (&sin6p->sin6_addr))
- {
- if (if_indextoname (scopeid, scopeptr) == NULL)
- ++ni_numericscope;
- else
- scopelen = strlen (scopebuf);
- }
- else
- ++ni_numericscope;
-
- if (ni_numericscope)
- scopelen = 1 + snprintf (scopeptr,
- (scopebuf
- + sizeof scopebuf
- - scopeptr),
- "%u", scopeid);
-
- if (real_hostlen + scopelen + 1 > hostlen)
- /* XXX We should not fail here. Simply enlarge
- the buffer or return with out of memory. */
- return EAI_SYSTEM;
- memcpy (host + real_hostlen, scopebuf, scopelen + 1);
- }
- }
- else
- c = inet_ntop (AF_INET,
- (const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
- host, hostlen);
- if (c == NULL)
- {
- __set_errno (serrno);
- return EAI_SYSTEM;
- }
- }
- ok = 1;
- }
- break;
-
- case AF_LOCAL:
- if (!(flags & NI_NUMERICHOST))
- {
- struct utsname utsname;
-
- if (!uname (&utsname))
- {
- strncpy (host, utsname.nodename, hostlen);
- break;
- };
- };
-
- if (flags & NI_NAMEREQD)
- {
- __set_errno (serrno);
- return EAI_NONAME;
- }
-
- strncpy (host, "localhost", hostlen);
- break;
-
- default:
- return EAI_FAMILY;
- }
-
- if (serv && (servlen > 0))
- switch (sa->sa_family)
- {
- case AF_INET:
- case AF_INET6:
- if (!(flags & NI_NUMERICSERV))
- {
- struct servent *s, ts;
- while (__getservbyport_r (((const struct sockaddr_in *) sa)->sin_port,
- ((flags & NI_DGRAM) ? "udp" : "tcp"),
- &ts, tmpbuf, tmpbuflen, &s))
- {
- if (herrno == NETDB_INTERNAL)
- {
- if (errno == ERANGE)
- tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
- 2 * tmpbuflen);
- else
- {
- __set_errno (serrno);
- return EAI_SYSTEM;
- }
- }
- else
- {
- break;
- }
- }
- if (s)
- {
- strncpy (serv, s->s_name, servlen);
- break;
- }
- }
-
- if (snprintf (serv, servlen, "%d",
- ntohs (((const struct sockaddr_in *) sa)->sin_port))
- + 1 > servlen)
- return EAI_OVERFLOW;
-
- break;
-
- case AF_LOCAL:
- strncpy (serv, ((const struct sockaddr_un *) sa)->sun_path, servlen);
- break;
- }
+ /* if_indextoname() does not take buffer size. not a good api... */
+ if ((IN6_IS_ADDR_LINKLOCAL(a6) || IN6_IS_ADDR_MC_LINKLOCAL(a6)) &&
+ bufsiz >= IF_NAMESIZE) {
+ char *p = if_indextoname(ifindex, buf);
+ if (p) {
+ return(strlen(p));
+ }
+ }
- if (host && (hostlen > 0))
- host[hostlen-1] = 0;
- if (serv && (servlen > 0))
- serv[servlen-1] = 0;
- errno = serrno;
- return 0;
+ /* last resort */
+ return(snprintf(buf, bufsiz, "%u", sa6->sin6_scope_id));
}
-libc_hidden_def (getnameinfo)
+#endif /* INET6 */
diff --git a/newlib/libc/sys/linux/net/getnetbyad.c b/newlib/libc/sys/linux/net/getnetbyad.c
deleted file mode 100644
index 73ae203e8..000000000
--- a/newlib/libc/sys/linux/net/getnetbyad.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-#include <stdint.h>
-
-
-#define LOOKUP_TYPE struct netent
-#define FUNCTION_NAME getnetbyaddr
-#define DATABASE_NAME networks
-#define ADD_PARAMS uint32_t net, int type
-#define ADD_VARIABLES net, type
-#define BUFLEN 1024
-#define NEED_H_ERRNO 1
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getnetbyad_r.c b/newlib/libc/sys/linux/net/getnetbyad_r.c
deleted file mode 100644
index 7af3cb40b..000000000
--- a/newlib/libc/sys/linux/net/getnetbyad_r.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-#include <stdint.h>
-
-
-#define LOOKUP_TYPE struct netent
-#define FUNCTION_NAME getnetbyaddr
-#define DATABASE_NAME networks
-#define ADD_PARAMS uint32_t net, int type
-#define ADD_VARIABLES net, type
-#define NEED__RES 1
-#define NEED_H_ERRNO 1
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/getnetbydns.c b/newlib/libc/sys/linux/net/getnetbydns.c
new file mode 100644
index 000000000..2cc4fce54
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getnetbydns.c
@@ -0,0 +1,327 @@
+/*-
+ * Copyright (c) 1985, 1988, 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.
+ * -
+ * --Copyright--
+ */
+/* Portions Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
+ * Dep. Matematica Universidade de Coimbra, Portugal, Europe
+ *
+ * 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <stdio.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <ctype.h>
+#include <string.h>
+#include <unistd.h>
+#include <syslog.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+
+#include "res_config.h"
+
+extern int h_errno;
+
+#define BYADDR 0
+#define BYNAME 1
+#define MAXALIASES 35
+
+#if PACKETSZ > 1024
+#define MAXPACKET PACKETSZ
+#else
+#define MAXPACKET 1024
+#endif
+
+typedef union {
+ HEADER hdr;
+ u_char buf[MAXPACKET];
+} querybuf;
+
+typedef union {
+ long al;
+ char ac;
+} align;
+
+static struct netent *
+getnetanswer(answer, anslen, net_i)
+ querybuf *answer;
+ int anslen;
+ int net_i;
+{
+
+ HEADER *hp;
+ u_char *cp;
+ int n;
+ u_char *eom;
+ int type, class, buflen, ancount, qdcount, haveanswer, i, nchar;
+ char aux1[MAXHOSTNAMELEN], aux2[MAXHOSTNAMELEN], ans[MAXHOSTNAMELEN];
+ char *in, *st, *pauxt, *bp, **ap;
+ char *paux1 = &aux1[0], *paux2 = &aux2[0], flag = 0;
+static struct netent net_entry;
+static char *net_aliases[MAXALIASES], netbuf[PACKETSZ];
+
+ /*
+ * find first satisfactory answer
+ *
+ * answer --> +------------+ ( MESSAGE )
+ * | Header |
+ * +------------+
+ * | Question | the question for the name server
+ * +------------+
+ * | Answer | RRs answering the question
+ * +------------+
+ * | Authority | RRs pointing toward an authority
+ * | Additional | RRs holding additional information
+ * +------------+
+ */
+ eom = answer->buf + anslen;
+ hp = &answer->hdr;
+ ancount = ntohs(hp->ancount); /* #/records in the answer section */
+ qdcount = ntohs(hp->qdcount); /* #/entries in the question section */
+ bp = netbuf;
+ buflen = sizeof(netbuf);
+ cp = answer->buf + HFIXEDSZ;
+ if (!qdcount) {
+ if (hp->aa)
+ h_errno = HOST_NOT_FOUND;
+ else
+ h_errno = TRY_AGAIN;
+ return (NULL);
+ }
+ while (qdcount-- > 0)
+ cp += __dn_skipname(cp, eom) + QFIXEDSZ;
+ ap = net_aliases;
+ *ap = NULL;
+ net_entry.n_aliases = net_aliases;
+ haveanswer = 0;
+ while (--ancount >= 0 && cp < eom) {
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !res_dnok(bp))
+ break;
+ cp += n;
+ ans[0] = '\0';
+ (void)strncpy(&ans[0], bp, sizeof(ans) - 1);
+ ans[sizeof(ans) - 1] = '\0';
+ GETSHORT(type, cp);
+ GETSHORT(class, cp);
+ cp += INT32SZ; /* TTL */
+ GETSHORT(n, cp);
+ if (class == C_IN && type == T_PTR) {
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !res_hnok(bp)) {
+ cp += n;
+ return (NULL);
+ }
+ cp += n;
+ *ap++ = bp;
+ bp += strlen(bp) + 1;
+ net_entry.n_addrtype =
+ (class == C_IN) ? AF_INET : AF_UNSPEC;
+ haveanswer++;
+ }
+ }
+ if (haveanswer) {
+ *ap = NULL;
+ switch (net_i) {
+ case BYADDR:
+ net_entry.n_name = *net_entry.n_aliases;
+ net_entry.n_net = 0L;
+ break;
+ case BYNAME:
+ in = *net_entry.n_aliases;
+ net_entry.n_name = &ans[0];
+ aux2[0] = '\0';
+ for (i = 0; i < 4; i++) {
+ for (st = in, nchar = 0;
+ *st != '.';
+ st++, nchar++)
+ ;
+ if (nchar != 1 || *in != '0' || flag) {
+ flag = 1;
+ (void)strncpy(paux1,
+ (i==0) ? in : in-1,
+ (i==0) ?nchar : nchar+1);
+ paux1[(i==0) ? nchar : nchar+1] = '\0';
+ pauxt = paux2;
+ paux2 = strcat(paux1, paux2);
+ paux1 = pauxt;
+ }
+ in = ++st;
+ }
+ net_entry.n_net = inet_network(paux2);
+ break;
+ }
+ net_entry.n_aliases++;
+ return (&net_entry);
+ }
+ h_errno = TRY_AGAIN;
+ return (NULL);
+}
+
+int
+_dns_getnetbyaddr(void *rval, void *cb_data, va_list ap)
+{
+ unsigned long net;
+ int net_type;
+ unsigned int netbr[4];
+ int nn, anslen;
+ querybuf buf;
+ char qbuf[MAXDNAME];
+ unsigned long net2;
+ struct netent *net_entry;
+
+ net = va_arg(ap, unsigned long);
+ net_type = va_arg(ap, int);
+
+ *(struct netent **)rval = NULL;
+
+ if (net_type != AF_INET)
+ return NS_UNAVAIL;
+
+ for (nn = 4, net2 = net; net2; net2 >>= 8)
+ netbr[--nn] = net2 & 0xff;
+ switch (nn) {
+ case 3: /* Class A */
+ sprintf(qbuf, "0.0.0.%u.in-addr.arpa", netbr[3]);
+ break;
+ case 2: /* Class B */
+ sprintf(qbuf, "0.0.%u.%u.in-addr.arpa", netbr[3], netbr[2]);
+ break;
+ case 1: /* Class C */
+ sprintf(qbuf, "0.%u.%u.%u.in-addr.arpa", netbr[3], netbr[2],
+ netbr[1]);
+ break;
+ case 0: /* Class D - E */
+ sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa", netbr[3], netbr[2],
+ netbr[1], netbr[0]);
+ break;
+ }
+ anslen = res_query(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof(buf));
+ if (anslen < 0) {
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf("res_query failed\n");
+#endif
+ return NS_UNAVAIL;
+ }
+ net_entry = getnetanswer(&buf, anslen, BYADDR);
+ if (net_entry) {
+ unsigned u_net = net; /* maybe net should be unsigned ? */
+
+ /* Strip trailing zeros */
+ while ((u_net & 0xff) == 0 && u_net != 0)
+ u_net >>= 8;
+ net_entry->n_net = u_net;
+ *(struct netent **)rval = net_entry;
+ return NS_SUCCESS;
+ }
+ return NS_NOTFOUND;
+}
+
+int
+_dns_getnetbyname(void *rval, void *cb_data, va_list ap)
+{
+ const char *net;
+ int anslen;
+ querybuf buf;
+ char qbuf[MAXDNAME];
+
+ net = va_arg(ap, const char *);
+
+ *(struct netent**)rval = NULL;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return NS_UNAVAIL;
+ }
+ strncpy(qbuf, net, sizeof(qbuf) - 1);
+ qbuf[sizeof(qbuf) - 1] = '\0';
+ anslen = res_search(qbuf, C_IN, T_PTR, (u_char *)&buf, sizeof(buf));
+ if (anslen < 0) {
+#ifdef DEBUG
+ if (_res.options & RES_DEBUG)
+ printf("res_query failed\n");
+#endif
+ return NS_UNAVAIL;
+ }
+ *(struct netent**)rval = getnetanswer(&buf, anslen, BYNAME);
+ return (*(struct netent**)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+
+void
+_setnetdnsent(stayopen)
+ int stayopen;
+{
+ if (stayopen)
+ _res.options |= RES_STAYOPEN | RES_USEVC;
+}
+
+void
+_endnetdnsent()
+{
+ _res.options &= ~(RES_STAYOPEN | RES_USEVC);
+ res_close();
+}
diff --git a/newlib/libc/sys/linux/net/getnetbyht.c b/newlib/libc/sys/linux/net/getnetbyht.c
new file mode 100644
index 000000000..8e4a16f1c
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getnetbyht.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 1983, 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 Carlos Leandro and Rui Salgueiro
+ * Dep. Matematica Universidade de Coimbra, Portugal, Europe
+ *
+ * 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.
+ *
+ * from getnetent.c 1.1 (Coimbra) 93/06/02
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93";
+static char orig_rcsid[] = "From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+
+#define MAXALIASES 35
+
+static FILE *netf;
+static char line[BUFSIZ+1];
+static struct netent net;
+static char *net_aliases[MAXALIASES];
+static int _net_stayopen;
+
+void
+_setnethtent(f)
+ int f;
+{
+
+ if (netf == NULL)
+ netf = fopen(_PATH_NETWORKS, "r" );
+ else
+ rewind(netf);
+ _net_stayopen |= f;
+}
+
+void
+_endnethtent()
+{
+
+ if (netf) {
+ fclose(netf);
+ netf = NULL;
+ }
+ _net_stayopen = 0;
+}
+
+struct netent *
+getnetent()
+{
+ char *p;
+ char *cp, **q;
+
+ if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL)
+ return (NULL);
+again:
+ p = fgets(line, sizeof line, netf);
+ if (p == NULL)
+ return (NULL);
+ if (*p == '#')
+ goto again;
+ cp = strpbrk(p, "#\n");
+ if (cp == NULL)
+ goto again;
+ *cp = '\0';
+ net.n_name = p;
+ cp = strpbrk(p, " \t");
+ if (cp == NULL)
+ goto again;
+ *cp++ = '\0';
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ p = strpbrk(cp, " \t");
+ if (p != NULL)
+ *p++ = '\0';
+ net.n_net = inet_network(cp);
+ net.n_addrtype = AF_INET;
+ q = net.n_aliases = net_aliases;
+ if (p != NULL)
+ cp = p;
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &net_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ *q = NULL;
+ return (&net);
+}
+
+int
+_ht_getnetbyname(void *rval, void *cb_data, va_list ap)
+{
+ const char *name;
+ struct netent *p;
+ char **cp;
+
+ name = va_arg(ap, const char *);
+
+ setnetent(_net_stayopen);
+ while ( (p = getnetent()) ) {
+ if (strcasecmp(p->n_name, name) == 0)
+ break;
+ for (cp = p->n_aliases; *cp != 0; cp++)
+ if (strcasecmp(*cp, name) == 0)
+ goto found;
+ }
+found:
+ if (!_net_stayopen)
+ endnetent();
+ *(struct netent **)rval = p;
+ return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+
+int
+_ht_getnetbyaddr(void *rval, void *cb_data, va_list ap)
+{
+ unsigned long net;
+ int type;
+ struct netent *p;
+
+ net = va_arg(ap, unsigned long);
+ type = va_arg(ap, int);
+
+ setnetent(_net_stayopen);
+ while ( (p = getnetent()) )
+ if (p->n_addrtype == type && p->n_net == net)
+ break;
+ if (!_net_stayopen)
+ endnetent();
+ *(struct netent **)rval = p;
+ return (p != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
diff --git a/newlib/libc/sys/linux/net/getnetbynis.c b/newlib/libc/sys/linux/net/getnetbynis.c
new file mode 100644
index 000000000..6d222e60f
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getnetbynis.c
@@ -0,0 +1,190 @@
+/*-
+ * Copyright (c) 1994, Garrett Wollman
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <errno.h>
+#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+#include <arpa/nameser.h>
+#ifdef YP
+#include <rpc/rpc.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+#endif
+
+#define MAXALIASES 35
+#define MAXADDRS 35
+
+#ifdef YP
+static char *host_aliases[MAXALIASES];
+
+static struct netent *
+_getnetbynis(const char *name, char *map, int af)
+{
+ char *cp, **q;
+ static char *result;
+ int resultlen;
+ static struct netent h;
+ static char *domain = (char *)NULL;
+ static char ypbuf[YPMAXRECORD + 2];
+
+ switch(af) {
+ case AF_INET:
+ break;
+ default:
+ case AF_INET6:
+ errno = EAFNOSUPPORT;
+ return NULL;
+ }
+
+ if (domain == (char *)NULL)
+ if (yp_get_default_domain (&domain))
+ return (NULL);
+
+ if (yp_match(domain, map, name, strlen(name), &result, &resultlen))
+ return (NULL);
+
+ bcopy((char *)result, (char *)&ypbuf, resultlen);
+ ypbuf[resultlen] = '\0';
+ free(result);
+ result = (char *)&ypbuf;
+
+ if ((cp = index(result, '\n')))
+ *cp = '\0';
+
+ cp = strpbrk(result, " \t");
+ *cp++ = '\0';
+ h.n_name = result;
+
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+
+ h.n_net = inet_network(cp);
+ h.n_addrtype = AF_INET;
+
+ q = h.n_aliases = host_aliases;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &host_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ *q = NULL;
+ return (&h);
+}
+#endif /* YP */
+
+int
+_nis_getnetbyname(void *rval, void *cb_data, va_list ap)
+{
+#ifdef YP
+ const char *name;
+
+ name = va_arg(ap, const char *);
+
+ *(struct netent **)rval = _getnetbynis(name, "networks.byname", AF_INET);
+ return (*(struct netent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+#else
+ return NS_UNAVAIL;
+#endif
+
+}
+
+int
+_nis_getnetbyaddr(void *rval, void *cb_data, va_list ap)
+{
+#ifdef YP
+ unsigned long addr;
+ int af;
+ char *str, *cp;
+ unsigned long net2;
+ int nn;
+ unsigned int netbr[4];
+ char buf[MAXDNAME];
+
+ addr = va_arg(ap, unsigned long);
+ af = va_arg(ap, int);
+
+ *(struct netent **)rval = NULL;
+
+ if (af != AF_INET) {
+ errno = EAFNOSUPPORT;
+ return NS_UNAVAIL;
+ }
+
+ for (nn = 4, net2 = addr; net2; net2 >>= 8) {
+ netbr[--nn] = net2 & 0xff;
+ }
+
+ switch (nn) {
+ case 3: /* Class A */
+ sprintf(buf, "%u", netbr[3]);
+ break;
+ case 2: /* Class B */
+ sprintf(buf, "%u.%u", netbr[2], netbr[3]);
+ break;
+ case 1: /* Class C */
+ sprintf(buf, "%u.%u.%u", netbr[1], netbr[2], netbr[3]);
+ break;
+ case 0: /* Class D - E */
+ sprintf(buf, "%u.%u.%u.%u", netbr[0], netbr[1],
+ netbr[2], netbr[3]);
+ break;
+ }
+
+ str = (char *)&buf;
+ cp = str + (strlen(str) - 2);
+
+ while(!strcmp(cp, ".0")) {
+ *cp = '\0';
+ cp = str + (strlen(str) - 2);
+ }
+
+ *(struct netent **)rval = _getnetbynis(str, "networks.byaddr", af);
+ return (*(struct netent**)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+#else
+ return NS_UNAVAIL;
+#endif /* YP */
+}
diff --git a/newlib/libc/sys/linux/net/getnetbynm.c b/newlib/libc/sys/linux/net/getnetbynm.c
deleted file mode 100644
index cacf14899..000000000
--- a/newlib/libc/sys/linux/net/getnetbynm.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct netent
-#define FUNCTION_NAME getnetbyname
-#define DATABASE_NAME networks
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-#define BUFLEN 1024
-#define NEED_H_ERRNO 1
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getnetbynm_r.c b/newlib/libc/sys/linux/net/getnetbynm_r.c
deleted file mode 100644
index 3acd2d3e6..000000000
--- a/newlib/libc/sys/linux/net/getnetbynm_r.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct netent
-#define FUNCTION_NAME getnetbyname
-#define DATABASE_NAME networks
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-#define NEED__RES 1
-#define NEED_H_ERRNO 1
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/getnetent.3 b/newlib/libc/sys/linux/net/getnetent.3
new file mode 100644
index 000000000..6801e9707
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getnetent.3
@@ -0,0 +1,172 @@
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/getnetent.3,v 1.17 2002/01/14 16:59:01 ru Exp $
+.\"
+.Dd June 4, 1993
+.Dt GETNETENT 3
+.Os
+.Sh NAME
+.Nm getnetent ,
+.Nm getnetbyaddr ,
+.Nm getnetbyname ,
+.Nm setnetent ,
+.Nm endnetent
+.Nd get network entry
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In netdb.h
+.Ft struct netent *
+.Fn getnetent void
+.Ft struct netent *
+.Fn getnetbyname "const char *name"
+.Ft struct netent *
+.Fn getnetbyaddr "unsigned long net" "int type"
+.Ft void
+.Fn setnetent "int stayopen"
+.Ft void
+.Fn endnetent void
+.Sh DESCRIPTION
+The
+.Fn getnetent ,
+.Fn getnetbyname ,
+and
+.Fn getnetbyaddr
+functions
+each return a pointer to an object with the
+following structure describing an internet network.
+This structure contains either the information obtained
+from the nameserver,
+.Xr named 8 ,
+broken-out fields of a line in the network data base
+.Pa /etc/networks ,
+or entries supplied by the
+.Xr yp 8
+system. The order of the lookups is controlled by the
+`networks' entry in
+.Xr nsswitch.conf 5 .
+.Pp
+.Bd -literal -offset indent
+struct netent {
+ char *n_name; /* official name of net */
+ char **n_aliases; /* alias list */
+ int n_addrtype; /* net number type */
+ unsigned long n_net; /* net number */
+};
+.Ed
+.Pp
+The members of this structure are:
+.Bl -tag -width n_addrtype
+.It Fa n_name
+The official name of the network.
+.It Fa n_aliases
+A zero terminated list of alternate names for the network.
+.It Fa n_addrtype
+The type of the network number returned; currently only AF_INET.
+.It Fa n_net
+The network number. Network numbers are returned in machine byte
+order.
+.El
+.Pp
+The
+.Fn getnetent
+function
+reads the next line of the file, opening the file if necessary.
+.Pp
+The
+.Fn setnetent
+function
+opens and rewinds the file. If the
+.Fa stayopen
+flag is non-zero,
+the net data base will not be closed after each call to
+.Fn getnetbyname
+or
+.Fn getnetbyaddr .
+.Pp
+The
+.Fn endnetent
+function
+closes the file.
+.Pp
+The
+.Fn getnetbyname
+function
+and
+.Fn getnetbyaddr
+sequentially search from the beginning
+of the file until a matching
+net name or
+net address and type is found,
+or until
+.Dv EOF
+is encountered.
+The
+.Fa type
+must be
+.Dv AF_INET .
+Network numbers are supplied in host order.
+.Sh FILES
+.Bl -tag -width /etc/nsswitch.conf -compact
+.It Pa /etc/networks
+.It Pa /etc/nsswitch.conf
+.It Pa /etc/resolv.conf
+.El
+.Sh DIAGNOSTICS
+Null pointer
+(0) returned on
+.Dv EOF
+or error.
+.Sh SEE ALSO
+.Xr networks 5
+.Pp
+.%T RFC 1101
+.Sh HISTORY
+The
+.Fn getnetent ,
+.Fn getnetbyaddr ,
+.Fn getnetbyname ,
+.Fn setnetent ,
+and
+.Fn endnetent
+functions appeared in
+.Bx 4.2 .
+.Sh BUGS
+The data space used by
+these functions is static; if future use requires the data, it should be
+copied before any subsequent calls to these functions overwrite it.
+Only Internet network
+numbers are currently understood.
+Expecting network numbers to fit
+in no more than 32 bits is probably
+naive.
diff --git a/newlib/libc/sys/linux/net/getnetent.c b/newlib/libc/sys/linux/net/getnetent.c
deleted file mode 100644
index b42ef165e..000000000
--- a/newlib/libc/sys/linux/net/getnetent.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct netent
-#define GETFUNC_NAME getnetent
-#define BUFLEN 1024
-#define NEED_H_ERRNO 1
-
-#include "getXXent.c"
diff --git a/newlib/libc/sys/linux/net/getnetent_r.c b/newlib/libc/sys/linux/net/getnetent_r.c
deleted file mode 100644
index bb698196c..000000000
--- a/newlib/libc/sys/linux/net/getnetent_r.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct netent
-#define SETFUNC_NAME setnetent
-#define GETFUNC_NAME getnetent
-#define ENDFUNC_NAME endnetent
-#define DATABASE_NAME networks
-#define STAYOPEN int stayopen
-#define STAYOPEN_VAR stayopen
-#define NEED__RES 1
-#define NEED_H_ERRNO 1
-
-#include "getXXent_r.c"
diff --git a/newlib/libc/sys/linux/net/getnetgrent.c b/newlib/libc/sys/linux/net/getnetgrent.c
deleted file mode 100644
index 050af800f..000000000
--- a/newlib/libc/sys/linux/net/getnetgrent.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 1996, 1997, 2000, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <netdb.h>
-#include <stdlib.h>
-#define _IO_MTSAFE_IO
-#include <bits/libc-lock.h>
-#include "libc-symbols.h"
-
-/* Static buffer for return value. We allocate it when needed. */
-libc_freeres_ptr (static char *buffer);
-/* All three strings should fit in a block of 1kB size. */
-#define BUFSIZE 1024
-
-
-
-static void
-allocate (void)
-{
- buffer = (char *) malloc (BUFSIZE);
-}
-
-int
-getnetgrent (char **hostp, char **userp, char **domainp)
-{
- __libc_once_define (static, once);
- __libc_once (once, allocate);
-
- if (buffer == NULL)
- {
- __set_errno (ENOMEM);
- return -1;
- }
-
- return __getnetgrent_r (hostp, userp, domainp, buffer, BUFSIZE);
-}
diff --git a/newlib/libc/sys/linux/net/getnetgrent_r.c b/newlib/libc/sys/linux/net/getnetgrent_r.c
deleted file mode 100644
index ebc2ac5ea..000000000
--- a/newlib/libc/sys/linux/net/getnetgrent_r.c
+++ /dev/null
@@ -1,446 +0,0 @@
-/* Copyright (C) 1996,1997,1998,1999,2002,2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define _IO_MTSAFE_IO
-#include <bits/libc-lock.h>
-#include <errno.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <string.h>
-#include "netgroup.h"
-#include "nsswitch.h"
-#include "libc-symbols.h"
-
-
-/* Protect above variable against multiple uses at the same time. */
-__libc_lock_define_initialized (static, lock)
-
-/* The whole information for the set/get/endnetgrent functions are
- kept in this structure. */
-static struct __netgrent dataset;
-
-/* The lookup function for the first entry of this service. */
-extern int __nss_netgroup_lookup (service_user **nip, const char *name,
- void **fctp) internal_function;
-
-
-/* Set up NIP to run through the services. If ALL is zero, use NIP's
- current location if it's not nil. Return nonzero if there are no
- services (left). */
-static enum nss_status
-setup (void **fctp, const char *func_name, int all, service_user **nipp)
-{
- /* Remember the first service_entry, it's always the same. */
- static service_user *startp;
- int no_more;
-
- if (startp == NULL)
- {
- /* Executing this more than once at the same time must yield the
- same result every time. So we need no locking. */
- no_more = __nss_netgroup_lookup (nipp, func_name, fctp);
- startp = no_more ? (service_user *) -1 : *nipp;
- }
- else if (startp == (service_user *) -1)
- /* No services at all. */
- return 1;
- else
- {
- if (all || *nipp == NULL)
- /* Reset to the beginning of the service list. */
- *nipp = startp;
- /* Look up the first function. */
- no_more = __nss_lookup (nipp, func_name, fctp);
- }
- return no_more;
-}
-
-/* Free used memory. */
-static void
-free_memory (struct __netgrent *data)
-{
- while (data->known_groups != NULL)
- {
- struct name_list *tmp = data->known_groups;
- data->known_groups = data->known_groups->next;
- free (tmp);
- }
-
- while (data->needed_groups != NULL)
- {
- struct name_list *tmp = data->needed_groups;
- data->needed_groups = data->needed_groups->next;
- free (tmp);
- }
-}
-
-static int
-internal_function
-__internal_setnetgrent_reuse (const char *group, struct __netgrent *datap,
- int *errnop)
-{
- union
- {
- enum nss_status (*f) (const char *, struct __netgrent *);
- void *ptr;
- } fct;
- enum nss_status status = NSS_STATUS_UNAVAIL;
- struct name_list *new_elem;
-
- /* Cycle through all the services and run their setnetgrent functions. */
- int no_more = setup (&fct.ptr, "setnetgrent", 1, &datap->nip);
- while (! no_more)
- {
- /* Ignore status, we force check in `__nss_next'. */
- status = (*fct.f) (group, datap);
-
- no_more = __nss_next (&datap->nip, "setnetgrent", &fct.ptr, status, 0);
- }
-
- /* Add the current group to the list of known groups. */
- size_t group_len = strlen (group) + 1;
- new_elem = (struct name_list *) malloc (sizeof (struct name_list)
- + group_len);
- if (new_elem == NULL)
- {
- *errnop = errno;
- status = NSS_STATUS_TRYAGAIN;
- }
- else
- {
- new_elem->next = datap->known_groups;
- memcpy (new_elem->name, group, group_len);
- datap->known_groups = new_elem;
- }
-
- return status == NSS_STATUS_SUCCESS;
-}
-
-int internal_setnetgrent (const char *group, struct __netgrent *datap);
-libc_hidden_proto (internal_setnetgrent)
-
-int
-internal_setnetgrent (const char *group, struct __netgrent *datap)
-{
- /* Free list of all netgroup names from last run. */
- free_memory (datap);
-
- return __internal_setnetgrent_reuse (group, datap, &errno);
-}
-libc_hidden_def (internal_setnetgrent)
-strong_alias (internal_setnetgrent, __internal_setnetgrent)
-
-int
-setnetgrent (const char *group)
-{
- int result;
-
- __libc_lock_lock (lock);
-
- result = internal_setnetgrent (group, &dataset);
-
- __libc_lock_unlock (lock);
-
- return result;
-}
-
-
-void internal_endnetgrent (struct __netgrent *datap);
-libc_hidden_proto (internal_endnetgrent)
-
-void
-internal_endnetgrent (struct __netgrent *datap)
-{
- service_user *old_nip;
- union
- {
- enum nss_status (*f) (struct __netgrent *);
- void *ptr;
- } fct;
-
- /* Remember which was the last used service. */
- old_nip = datap->nip;
-
- /* Cycle through all the services and run their endnetgrent functions. */
- int no_more = setup (&fct.ptr, "endnetgrent", 1, &datap->nip);
- while (! no_more)
- {
- /* Ignore status, we force check in `__nss_next'. */
- (void) (*fct.f) (datap);
-
- no_more = (datap->nip == old_nip
- || __nss_next (&datap->nip, "endnetgrent", &fct.ptr, 0, 1));
- }
-
- /* Now free list of all netgroup names from last run. */
- free_memory (datap);
-}
-libc_hidden_def (internal_endnetgrent)
-strong_alias (internal_endnetgrent, __internal_endnetgrent)
-
-
-void
-endnetgrent (void)
-{
- __libc_lock_lock (lock);
-
- internal_endnetgrent (&dataset);
-
- __libc_lock_unlock (lock);
-}
-
-
-int internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
- struct __netgrent *datap,
- char *buffer, size_t buflen, int *errnop);
-libc_hidden_proto (internal_getnetgrent_r)
-
-int
-internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
- struct __netgrent *datap,
- char *buffer, size_t buflen, int *errnop)
-{
- union
- {
- enum nss_status (*f) (struct __netgrent *, char *, size_t, int *);
- void *ptr;
- } fct;
-
- /* Initialize status to return if no more functions are found. */
- enum nss_status status = NSS_STATUS_NOTFOUND;
-
- /* Run through available functions, starting with the same function last
- run. We will repeat each function as long as it succeeds, and then go
- on to the next service action. */
- int no_more = setup (&fct.ptr, "getnetgrent_r", 0, &datap->nip);
- while (! no_more)
- {
- status = (*fct.f) (datap, buffer, buflen, &errno);
-
- if (status == NSS_STATUS_RETURN)
- {
- /* This was the last one for this group. Look at next group
- if available. */
- int found = 0;
- while (datap->needed_groups != NULL && ! found)
- {
- struct name_list *tmp = datap->needed_groups;
- datap->needed_groups = datap->needed_groups->next;
- tmp->next = datap->known_groups;
- datap->known_groups = tmp;
-
- found = __internal_setnetgrent_reuse (datap->known_groups->name,
- datap, errnop);
- }
-
- if (found)
- continue;
- }
- else if (status == NSS_STATUS_SUCCESS && datap->type == group_val)
- {
- /* The last entry was a name of another netgroup. */
- struct name_list *namep;
-
- /* Ignore if we've seen the name before. */
- for (namep = datap->known_groups; namep != NULL;
- namep = namep->next)
- if (strcmp (datap->val.group, namep->name) == 0)
- break;
- if (namep != NULL)
- /* Really ignore. */
- continue;
-
- size_t group_len = strlen (datap->val.group) + 1;
- namep = (struct name_list *) malloc (sizeof (struct name_list)
- + group_len);
- if (namep == NULL)
- /* We are out of memory. */
- status = NSS_STATUS_RETURN;
- else
- {
- namep->next = datap->needed_groups;
- memcpy (namep->name, datap->val.group, group_len);
- datap->needed_groups = namep;
- /* And get the next entry. */
- continue;
- }
- }
-
- no_more = __nss_next (&datap->nip, "getnetgrent_r", &fct.ptr, status, 0);
- }
-
- if (status == NSS_STATUS_SUCCESS)
- {
- *hostp = (char *) datap->val.triple.host;
- *userp = (char *) datap->val.triple.user;
- *domainp = (char *) datap->val.triple.domain;
- }
-
- return status == NSS_STATUS_SUCCESS ? 1 : 0;
-}
-libc_hidden_def (internal_getnetgrent_r)
-strong_alias (internal_getnetgrent_r, __internal_getnetgrent_r)
-
-/* The real entry point. */
-int
-__getnetgrent_r (char **hostp, char **userp, char **domainp,
- char *buffer, size_t buflen)
-{
- enum nss_status status;
-
- __libc_lock_lock (lock);
-
- status = internal_getnetgrent_r (hostp, userp, domainp, &dataset,
- buffer, buflen, &errno);
-
- __libc_lock_unlock (lock);
-
- return status;
-}
-weak_alias (__getnetgrent_r, getnetgrent_r)
-
-/* Test whether given (host,user,domain) triple is in NETGROUP. */
-int
-innetgr (const char *netgroup, const char *host, const char *user,
- const char *domain)
-{
- union
- {
- int (*f) (const char *, struct __netgrent *);
- void *ptr;
- } setfct;
- union
- {
- void (*f) (struct __netgrent *);
- void *ptr;
- } endfct;
- union
- {
- int (*f) (struct __netgrent *, char *, size_t, int *);
- void *ptr;
- } getfct;
- struct __netgrent entry;
- int result = 0;
- const char *current_group = netgroup;
- int real_entry = 0;
-
- memset (&entry, '\0', sizeof (entry));
-
- /* Walk through the services until we found an answer or we shall
- not work further. We can do some optimization here. Since all
- services must provide the `setnetgrent' function we can do all
- the work during one walk through the service list. */
- while (1)
- {
- int no_more = setup (&setfct.ptr, "setnetgrent", 1, &entry.nip);
- while (! no_more)
- {
- /* Open netgroup. */
- enum nss_status status = (*setfct.f) (current_group, &entry);
-
- if (status == NSS_STATUS_SUCCESS
- && __nss_lookup (&entry.nip, "getnetgrent_r", &getfct.ptr) == 0)
- {
- char buffer[1024];
-
- while ((*getfct.f) (&entry, buffer, sizeof buffer, &errno)
- == NSS_STATUS_SUCCESS)
- {
- if (entry.type == group_val)
- {
- /* Make sure we haven't seen the name before. */
- struct name_list *namep;
-
- for (namep = entry.known_groups; namep != NULL;
- namep = namep->next)
- if (strcmp (entry.val.group, namep->name) == 0)
- break;
- if (namep == NULL
- && strcmp (netgroup, entry.val.group) != 0)
- {
- size_t group_len = strlen (entry.val.group) + 1;
- namep =
- (struct name_list *) malloc (sizeof (*namep)
- + group_len);
- if (namep == NULL)
- {
- /* Out of memory, simply return. */
- result = -1;
- break;
- }
-
- namep->next = entry.needed_groups;
- memcpy (namep->name, entry.val.group, group_len);
- entry.needed_groups = namep;
- }
- }
- else
- {
- real_entry = 1;
-
- if ((entry.val.triple.host == NULL || host == NULL
- || strcasecmp (entry.val.triple.host, host) == 0)
- && (entry.val.triple.user == NULL || user == NULL
- || strcmp (entry.val.triple.user, user) == 0)
- && (entry.val.triple.domain == NULL || domain == NULL
- || strcasecmp (entry.val.triple.domain,
- domain) == 0))
- {
- result = 1;
- break;
- }
- }
- }
-
- if (result != 0)
- break;
-
- /* If we found one service which does know the given
- netgroup we don't try further. */
- status = NSS_STATUS_RETURN;
- }
-
- /* Free all resources of the service. */
- if (__nss_lookup (&entry.nip, "endnetgrent", &endfct.ptr) == 0)
- (*endfct.f) (&entry);
-
- /* Look for the next service. */
- no_more = __nss_next (&entry.nip, "setnetgrent",
- &setfct.ptr, status, 0);
- }
-
- if (result == 0 && entry.needed_groups != NULL)
- {
- struct name_list *tmp = entry.needed_groups;
- entry.needed_groups = tmp->next;
- tmp->next = entry.known_groups;
- entry.known_groups = tmp;
- current_group = entry.known_groups->name;
- continue;
- }
-
- /* No way out. */
- break;
- }
-
- /* Free the memory. */
- free_memory (&entry);
-
- return result;
-}
-libc_hidden_def (innetgr)
diff --git a/newlib/libc/sys/linux/net/getnetnamadr.c b/newlib/libc/sys/linux/net/getnetnamadr.c
new file mode 100644
index 000000000..180ab14e2
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getnetnamadr.c
@@ -0,0 +1,113 @@
+/*-
+ * Copyright (c) 1994, Garrett Wollman
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+
+extern int _ht_getnetbyname(void *, void *, va_list);
+extern int _dns_getnetbyname(void *, void *, va_list);
+extern int _nis_getnetbyname(void *, void *, va_list);
+extern int _ht_getnetbyaddr(void *, void *, va_list);
+extern int _dns_getnetbyaddr(void *, void *, va_list);
+extern int _nis_getnetbyaddr(void *, void *, va_list);
+
+/* Network lookup order if nsswitch.conf is broken or nonexistant */
+static const ns_src default_src[] = {
+ { NSSRC_FILES, NS_SUCCESS },
+ { NSSRC_DNS, NS_SUCCESS },
+ { 0 }
+};
+
+struct netent *
+getnetbyname(const char *name)
+{
+ struct netent *hp = 0;
+ int rval;
+
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_ht_getnetbyname, NULL)
+ { NSSRC_DNS, _dns_getnetbyname, NULL },
+ NS_NIS_CB(_nis_getnetbyname, NULL) /* force -DHESIOD */
+ { 0 }
+ };
+
+ rval = nsdispatch((void *)&hp, dtab, NSDB_NETWORKS, "getnetbyname",
+ default_src, name);
+
+ if (rval != NS_SUCCESS)
+ return NULL;
+ else
+ return hp;
+}
+
+struct netent *
+getnetbyaddr(u_long addr, int af)
+{
+ struct netent *hp = 0;
+ int rval;
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_ht_getnetbyaddr, NULL)
+ { NSSRC_DNS, _dns_getnetbyaddr, NULL },
+ NS_NIS_CB(_nis_getnetbyaddr, NULL) /* force -DHESIOD */
+ { 0 }
+ };
+
+ rval = nsdispatch((void *)&hp, dtab, NSDB_NETWORKS, "getnetbyaddr",
+ default_src, addr, af);
+
+ if (rval != NS_SUCCESS)
+ return NULL;
+ else
+ return hp;
+}
+
+void
+setnetent(stayopen)
+ int stayopen;
+{
+ _setnethtent(stayopen);
+ _setnetdnsent(stayopen);
+}
+
+void
+endnetent()
+{
+ _endnethtent();
+ _endnetdnsent();
+}
diff --git a/newlib/libc/sys/linux/net/getnssent.c b/newlib/libc/sys/linux/net/getnssent.c
deleted file mode 100644
index 1f7573da7..000000000
--- a/newlib/libc/sys/linux/net/getnssent.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 2000, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <stdlib.h>
-#include <netdb.h>
-#include "nsswitch.h"
-
-void *
-__nss_getent (getent_r_function func, void **resbuf, char **buffer,
- size_t buflen, size_t *buffer_size, int *h_errnop)
-{
- void *result;
-
- if (*buffer == NULL)
- {
- *buffer_size = buflen;
- *buffer = malloc (*buffer_size);
- }
-
- while (buffer != NULL
- && func (resbuf, *buffer, *buffer_size, &result, h_errnop) == ERANGE
- && (h_errnop == NULL || *h_errnop == NETDB_INTERNAL))
- {
- char *new_buf;
- *buffer_size *= 2;
- new_buf = realloc (*buffer, *buffer_size);
- if (new_buf == NULL)
- {
- /* We are out of memory. Free the current buffer so that the
- process gets a chance for a normal termination. */
- int save = errno;
- free (*buffer);
- __set_errno (save);
- }
- *buffer = new_buf;
- }
-
- if (*buffer == NULL)
- result = NULL;
-
- return result;
-}
diff --git a/newlib/libc/sys/linux/net/getnssent_r.c b/newlib/libc/sys/linux/net/getnssent_r.c
deleted file mode 100644
index 517f19d02..000000000
--- a/newlib/libc/sys/linux/net/getnssent_r.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <errno.h>
-#include <netdb.h>
-#include "nsswitch.h"
-
-/* Set up NIP to run through the services. If ALL is zero, use NIP's
- current location if it's not nil. Return nonzero if there are no
- services (left). */
-static int
-setup (const char *func_name, db_lookup_function lookup_fct,
- void **fctp, service_user **nip, service_user **startp, int all)
-{
- int no_more;
- if (*startp == NULL)
- {
- no_more = lookup_fct (nip, func_name, fctp);
- *startp = no_more ? (service_user *) -1l : *nip;
- }
- else if (*startp == (service_user *) -1l)
- /* No services at all. */
- return 1;
- else
- {
- if (all || !*nip)
- /* Reset to the beginning of the service list. */
- *nip = *startp;
- /* Look up the first function. */
- no_more = __nss_lookup (nip, func_name, fctp);
- }
- return no_more;
-}
-
-void
-__nss_setent (const char *func_name, db_lookup_function lookup_fct,
- service_user **nip, service_user **startp,
- service_user **last_nip, int stayopen, int *stayopen_tmp,
- int res)
-{
- union
- {
- setent_function f;
- void *ptr;
- } fct;
- int no_more;
-
- if (res && __res_maybe_init (&_res, 0) == -1)
- {
- h_errno = (NETDB_INTERNAL);
- return;
- }
-
- /* Cycle through the services and run their `setXXent' functions until
- we find an available service. */
- no_more = setup (func_name, lookup_fct, &fct.ptr, nip,
- startp, 1);
- while (! no_more)
- {
- int is_last_nip = *nip == *last_nip;
- enum nss_status status;
-
- if (stayopen_tmp)
- status = DL_CALL_FCT (fct.f, (*stayopen_tmp));
- else
- status = DL_CALL_FCT (fct.f, (0));
-
- no_more = __nss_next (nip, func_name, &fct.ptr,
- status, 0);
- if (is_last_nip)
- *last_nip = *nip;
- }
-
- if (stayopen_tmp)
- *stayopen_tmp = stayopen;
-}
-
-
-void
-__nss_endent (const char *func_name, db_lookup_function lookup_fct,
- service_user **nip, service_user **startp,
- service_user **last_nip, int res)
-{
- union
- {
- endent_function f;
- void *ptr;
- } fct;
- int no_more;
-
- if (res && __res_maybe_init (&_res, 0) == -1)
- {
- h_errno = (NETDB_INTERNAL);
- return;
- }
-
- /* Cycle through all the services and run their endXXent functions. */
- no_more = setup (func_name, lookup_fct, &fct.ptr, nip, startp, 1);
- while (! no_more)
- {
- /* Ignore status, we force check in __NSS_NEXT. */
- DL_CALL_FCT (fct.f, ());
-
- if (*nip == *last_nip)
- /* We have processed all services which were used. */
- break;
-
- no_more = __nss_next (nip, func_name, &fct.ptr, 0, 1);
- }
- *last_nip = *nip = NULL;
-}
-
-
-int
-__nss_getent_r (const char *getent_func_name,
- const char *setent_func_name,
- db_lookup_function lookup_fct,
- service_user **nip, service_user **startp,
- service_user **last_nip, int *stayopen_tmp, int res,
- void *resbuf, char *buffer, size_t buflen,
- void **result, int *h_errnop)
-{
- union
- {
- getent_function f;
- void *ptr;
- } fct;
- int no_more;
- enum nss_status status;
-
- if (res && __res_maybe_init (&_res, 0) == -1)
- {
- *h_errnop = NETDB_INTERNAL;
- *result = NULL;
- return errno;
- }
-
- /* Initialize status to return if no more functions are found. */
- status = NSS_STATUS_NOTFOUND;
-
- /* Run through available functions, starting with the same function last
- run. We will repeat each function as long as it succeeds, and then go
- on to the next service action. */
- no_more = setup (getent_func_name, lookup_fct, &fct.ptr, nip,
- startp, 0);
- while (! no_more)
- {
- int is_last_nip = *nip == *last_nip;
-
- status = DL_CALL_FCT (fct.f,
- (resbuf, buffer, buflen, &errno, &h_errno));
-
- /* The the status is NSS_STATUS_TRYAGAIN and errno is ERANGE the
- provided buffer is too small. In this case we should give
- the user the possibility to enlarge the buffer and we should
- not simply go on with the next service (even if the TRYAGAIN
- action tells us so). */
- if (status == NSS_STATUS_TRYAGAIN
- && (h_errnop == NULL || *h_errnop == NETDB_INTERNAL)
- && errno == ERANGE)
- break;
-
- do
- {
- no_more = __nss_next (nip, getent_func_name, &fct.ptr,
- status, 0);
-
- if (is_last_nip)
- *last_nip = *nip;
-
- if (! no_more)
- {
- /* Call the `setXXent' function. This wasn't done before. */
- union
- {
- setent_function f;
- void *ptr;
- } sfct;
-
- no_more = __nss_lookup (nip, setent_func_name,
- &sfct.ptr);
-
- if (! no_more)
- {
- if (stayopen_tmp)
- status = DL_CALL_FCT (sfct.f, (*stayopen_tmp));
- else
- status = DL_CALL_FCT (sfct.f, (0));
- }
- else
- status = NSS_STATUS_NOTFOUND;
- }
- }
- while (! no_more && status != NSS_STATUS_SUCCESS);
- }
-
- *result = status == NSS_STATUS_SUCCESS ? resbuf : NULL;
- return (status == NSS_STATUS_SUCCESS ? 0
- : status != NSS_STATUS_TRYAGAIN ? ENOENT
- /* h_errno functions only set errno if h_errno is NETDB_INTERNAL. */
- : (h_errnop == NULL || *h_errnop == NETDB_INTERNAL) ? errno
- : EAGAIN);
-}
diff --git a/newlib/libc/sys/linux/net/getproto.c b/newlib/libc/sys/linux/net/getproto.c
index 750c1097f..937c30732 100644
--- a/newlib/libc/sys/linux/net/getproto.c
+++ b/newlib/libc/sys/linux/net/getproto.c
@@ -1,30 +1,57 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
+/*
+ * Copyright (c) 1983, 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.
+ */
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getproto.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <netdb.h>
+extern int _proto_stayopen;
-#define LOOKUP_TYPE struct protoent
-#define FUNCTION_NAME getprotobynumber
-#define DATABASE_NAME protocols
-#define ADD_PARAMS int proto
-#define ADD_VARIABLES proto
-#define BUFLEN 1024
+struct protoent *
+getprotobynumber(proto)
+ int proto;
+{
+ struct protoent *p;
-#include "getXXbyYY.c"
+ setprotoent(_proto_stayopen);
+ while ( (p = getprotoent()) )
+ if (p->p_proto == proto)
+ break;
+ if (!_proto_stayopen)
+ endprotoent();
+ return (p);
+}
diff --git a/newlib/libc/sys/linux/net/getproto_r.c b/newlib/libc/sys/linux/net/getproto_r.c
deleted file mode 100644
index 486df1d4e..000000000
--- a/newlib/libc/sys/linux/net/getproto_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct protoent
-#define FUNCTION_NAME getprotobynumber
-#define DATABASE_NAME protocols
-#define ADD_PARAMS int proto
-#define ADD_VARIABLES proto
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/getprotoent.3 b/newlib/libc/sys/linux/net/getprotoent.3
new file mode 100644
index 000000000..18b56541b
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getprotoent.3
@@ -0,0 +1,149 @@
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" @(#)getprotoent.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/getprotoent.3,v 1.8 2001/10/01 16:08:55 ru Exp $
+.\"
+.Dd June 4, 1993
+.Dt GETPROTOENT 3
+.Os
+.Sh NAME
+.Nm getprotoent ,
+.Nm getprotobynumber ,
+.Nm getprotobyname ,
+.Nm setprotoent ,
+.Nm endprotoent
+.Nd get protocol entry
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In netdb.h
+.Ft struct protoent *
+.Fn getprotoent void
+.Ft struct protoent *
+.Fn getprotobyname "const char *name"
+.Ft struct protoent *
+.Fn getprotobynumber "int proto"
+.Ft void
+.Fn setprotoent "int stayopen"
+.Ft void
+.Fn endprotoent void
+.Sh DESCRIPTION
+The
+.Fn getprotoent ,
+.Fn getprotobyname ,
+and
+.Fn getprotobynumber
+functions
+each return a pointer to an object with the
+following structure
+containing the broken-out
+fields of a line in the network protocol data base,
+.Pa /etc/protocols .
+.Bd -literal -offset indent
+.Pp
+struct protoent {
+ char *p_name; /* official name of protocol */
+ char **p_aliases; /* alias list */
+ int p_proto; /* protocol number */
+};
+.Ed
+.Pp
+The members of this structure are:
+.Bl -tag -width p_aliases
+.It Fa p_name
+The official name of the protocol.
+.It Fa p_aliases
+A zero terminated list of alternate names for the protocol.
+.It Fa p_proto
+The protocol number.
+.El
+.Pp
+The
+.Fn getprotoent
+function
+reads the next line of the file, opening the file if necessary.
+.Pp
+The
+.Fn setprotoent
+function
+opens and rewinds the file. If the
+.Fa stayopen
+flag is non-zero,
+the net data base will not be closed after each call to
+.Fn getprotobyname
+or
+.Fn getprotobynumber .
+.Pp
+The
+.Fn endprotoent
+function
+closes the file.
+.Pp
+The
+.Fn getprotobyname
+function
+and
+.Fn getprotobynumber
+sequentially search from the beginning
+of the file until a matching
+protocol name or
+protocol number is found,
+or until
+.Dv EOF
+is encountered.
+.Sh RETURN VALUES
+Null pointer
+(0) returned on
+.Dv EOF
+or error.
+.Sh FILES
+.Bl -tag -width /etc/protocols -compact
+.It Pa /etc/protocols
+.El
+.Sh SEE ALSO
+.Xr protocols 5
+.Sh HISTORY
+The
+.Fn getprotoent ,
+.Fn getprotobynumber ,
+.Fn getprotobyname ,
+.Fn setprotoent ,
+and
+.Fn endprotoent
+functions appeared in
+.Bx 4.2 .
+.Sh BUGS
+These functions use a static data space;
+if the data is needed for future use, it should be
+copied before any subsequent calls overwrite it.
+Only the Internet
+protocols are currently understood.
diff --git a/newlib/libc/sys/linux/net/getprotoent.c b/newlib/libc/sys/linux/net/getprotoent.c
new file mode 100644
index 000000000..422eeacea
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getprotoent.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define MAXALIASES 35
+
+static FILE *protof = NULL;
+static char line[BUFSIZ+1];
+static struct protoent proto;
+static char *proto_aliases[MAXALIASES];
+int _proto_stayopen;
+
+void
+setprotoent(f)
+ int f;
+{
+ if (protof == NULL)
+ protof = fopen(_PATH_PROTOCOLS, "r" );
+ else
+ rewind(protof);
+ _proto_stayopen |= f;
+}
+
+void
+endprotoent()
+{
+ if (protof) {
+ fclose(protof);
+ protof = NULL;
+ }
+ _proto_stayopen = 0;
+}
+
+struct protoent *
+getprotoent()
+{
+ char *p;
+ char *cp, **q;
+
+ if (protof == NULL && (protof = fopen(_PATH_PROTOCOLS, "r" )) == NULL)
+ return (NULL);
+again:
+ if ((p = fgets(line, BUFSIZ, protof)) == NULL)
+ return (NULL);
+ if (*p == '#')
+ goto again;
+ cp = strpbrk(p, "#\n");
+ if (cp == NULL)
+ goto again;
+ *cp = '\0';
+ proto.p_name = p;
+ cp = strpbrk(p, " \t");
+ if (cp == NULL)
+ goto again;
+ *cp++ = '\0';
+ while (*cp == ' ' || *cp == '\t')
+ cp++;
+ p = strpbrk(cp, " \t");
+ if (p != NULL)
+ *p++ = '\0';
+ proto.p_proto = atoi(cp);
+ q = proto.p_aliases = proto_aliases;
+ if (p != NULL) {
+ cp = p;
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &proto_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ }
+ *q = NULL;
+ return (&proto);
+}
diff --git a/newlib/libc/sys/linux/net/getprotoname.c b/newlib/libc/sys/linux/net/getprotoname.c
new file mode 100644
index 000000000..f25883fe8
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getprotoname.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getprotoname.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <netdb.h>
+#include <string.h>
+
+extern int _proto_stayopen;
+
+struct protoent *
+getprotobyname(name)
+ const char *name;
+{
+ struct protoent *p;
+ char **cp;
+
+ setprotoent(_proto_stayopen);
+ while ( (p = getprotoent()) ) {
+ if (strcmp(p->p_name, name) == 0)
+ break;
+ for (cp = p->p_aliases; *cp != 0; cp++)
+ if (strcmp(*cp, name) == 0)
+ goto found;
+ }
+found:
+ if (!_proto_stayopen)
+ endprotoent();
+ return (p);
+}
diff --git a/newlib/libc/sys/linux/net/getprtent.c b/newlib/libc/sys/linux/net/getprtent.c
deleted file mode 100644
index 16a7e57bc..000000000
--- a/newlib/libc/sys/linux/net/getprtent.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct protoent
-#define GETFUNC_NAME getprotoent
-#define BUFLEN 1024
-
-#include "getXXent.c"
diff --git a/newlib/libc/sys/linux/net/getprtent_r.c b/newlib/libc/sys/linux/net/getprtent_r.c
deleted file mode 100644
index 2f0ca473b..000000000
--- a/newlib/libc/sys/linux/net/getprtent_r.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct protoent
-#define SETFUNC_NAME setprotoent
-#define GETFUNC_NAME getprotoent
-#define ENDFUNC_NAME endprotoent
-#define DATABASE_NAME protocols
-#define STAYOPEN int stayopen
-#define STAYOPEN_VAR stayopen
-
-#include "getXXent_r.c"
diff --git a/newlib/libc/sys/linux/net/getprtname.c b/newlib/libc/sys/linux/net/getprtname.c
deleted file mode 100644
index 1222daeea..000000000
--- a/newlib/libc/sys/linux/net/getprtname.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct protoent
-#define FUNCTION_NAME getprotobyname
-#define DATABASE_NAME protocols
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-#define BUFLEN 1024
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getprtname_r.c b/newlib/libc/sys/linux/net/getprtname_r.c
deleted file mode 100644
index b0dee382e..000000000
--- a/newlib/libc/sys/linux/net/getprtname_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct protoent
-#define FUNCTION_NAME getprotobyname
-#define DATABASE_NAME protocols
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/getrpcbyname.c b/newlib/libc/sys/linux/net/getrpcbyname.c
deleted file mode 100644
index 266967aed..000000000
--- a/newlib/libc/sys/linux/net/getrpcbyname.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <rpc/netdb.h>
-
-
-#define LOOKUP_TYPE struct rpcent
-#define FUNCTION_NAME getrpcbyname
-#define DATABASE_NAME rpc
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-#define BUFLEN 1024
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getrpcbyname_r.c b/newlib/libc/sys/linux/net/getrpcbyname_r.c
deleted file mode 100644
index 3e7c2df74..000000000
--- a/newlib/libc/sys/linux/net/getrpcbyname_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <rpc/netdb.h>
-
-
-#define LOOKUP_TYPE struct rpcent
-#define FUNCTION_NAME getrpcbyname
-#define DATABASE_NAME rpc
-#define ADD_PARAMS const char *name
-#define ADD_VARIABLES name
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/getrpcbynumber.c b/newlib/libc/sys/linux/net/getrpcbynumber.c
deleted file mode 100644
index f9513eb62..000000000
--- a/newlib/libc/sys/linux/net/getrpcbynumber.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <rpc/netdb.h>
-
-
-#define LOOKUP_TYPE struct rpcent
-#define FUNCTION_NAME getrpcbynumber
-#define DATABASE_NAME rpc
-#define ADD_PARAMS int number
-#define ADD_VARIABLES number
-#define BUFLEN 1024
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getrpcbynumber_r.c b/newlib/libc/sys/linux/net/getrpcbynumber_r.c
deleted file mode 100644
index 839442214..000000000
--- a/newlib/libc/sys/linux/net/getrpcbynumber_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <rpc/netdb.h>
-
-
-#define LOOKUP_TYPE struct rpcent
-#define FUNCTION_NAME getrpcbynumber
-#define DATABASE_NAME rpc
-#define ADD_PARAMS int number
-#define ADD_VARIABLES number
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/getrpcent.c b/newlib/libc/sys/linux/net/getrpcent.c
deleted file mode 100644
index 1b4eb03a2..000000000
--- a/newlib/libc/sys/linux/net/getrpcent.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <rpc/netdb.h>
-
-
-#define LOOKUP_TYPE struct rpcent
-#define GETFUNC_NAME getrpcent
-#define BUFLEN 1024
-
-#include "getXXent.c"
diff --git a/newlib/libc/sys/linux/net/getrpcent_r.c b/newlib/libc/sys/linux/net/getrpcent_r.c
deleted file mode 100644
index e212b5f2e..000000000
--- a/newlib/libc/sys/linux/net/getrpcent_r.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct rpcent
-#define SETFUNC_NAME setrpcent
-#define GETFUNC_NAME getrpcent
-#define ENDFUNC_NAME endrpcent
-#define DATABASE_NAME rpc
-#define STAYOPEN int stayopen
-#define STAYOPEN_VAR stayopen
-
-#include "getXXent_r.c"
diff --git a/newlib/libc/sys/linux/net/getservbyname.c b/newlib/libc/sys/linux/net/getservbyname.c
new file mode 100644
index 000000000..ced03d617
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getservbyname.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getservbyname.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <netdb.h>
+#include <string.h>
+
+extern int _serv_stayopen;
+
+struct servent *
+getservbyname(name, proto)
+ const char *name, *proto;
+{
+ struct servent *p;
+ char **cp;
+
+#ifdef YP
+ extern char *___getservbyname_yp;
+ extern char *___getservbyproto_yp;
+
+ ___getservbyname_yp = (char *)name;
+ ___getservbyproto_yp = (char *)proto;
+#endif
+
+ setservent(_serv_stayopen);
+ while ( (p = getservent()) ) {
+ if (strcmp(name, p->s_name) == 0)
+ goto gotname;
+ for (cp = p->s_aliases; *cp; cp++)
+ if (strcmp(name, *cp) == 0)
+ goto gotname;
+ continue;
+gotname:
+ if (proto == 0 || strcmp(p->s_proto, proto) == 0)
+ break;
+ }
+ if (!_serv_stayopen)
+ endservent();
+
+#ifdef YP
+ ___getservbyname_yp = NULL;
+ ___getservbyproto_yp = NULL;
+#endif
+
+ return (p);
+}
diff --git a/newlib/libc/sys/linux/net/getservbyport.c b/newlib/libc/sys/linux/net/getservbyport.c
new file mode 100644
index 000000000..88b684da4
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getservbyport.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getservbyport.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <netdb.h>
+#include <string.h>
+
+extern int _serv_stayopen;
+
+struct servent *
+getservbyport(port, proto)
+ int port;
+ const char *proto;
+{
+ struct servent *p;
+
+#ifdef YP
+ extern int ___getservbyport_yp;
+ extern char *___getservbyproto_yp;
+
+ ___getservbyport_yp = port;
+ ___getservbyproto_yp = (char *)proto;
+#endif
+
+ setservent(_serv_stayopen);
+ while ( (p = getservent()) ) {
+ if (p->s_port != port)
+ continue;
+ if (proto == 0 || strcmp(p->s_proto, proto) == 0)
+ break;
+ }
+ if (!_serv_stayopen)
+ endservent();
+
+#ifdef YP
+ ___getservbyport_yp = 0;
+ ___getservbyproto_yp = NULL;
+#endif
+
+ return (p);
+}
diff --git a/newlib/libc/sys/linux/net/getservent.3 b/newlib/libc/sys/linux/net/getservent.3
new file mode 100644
index 000000000..3d398bdb1
--- /dev/null
+++ b/newlib/libc/sys/linux/net/getservent.3
@@ -0,0 +1,158 @@
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" From: @(#)getservent.3 8.3 (Berkeley) 1/12/94
+.\" $FreeBSD: src/lib/libc/net/getservent.3,v 1.12 2001/10/01 16:08:55 ru Exp $
+.\"
+.Dd July 9, 1995
+.Dt GETSERVENT 3
+.Os
+.Sh NAME
+.Nm getservent ,
+.Nm getservbyport ,
+.Nm getservbyname ,
+.Nm setservent ,
+.Nm endservent
+.Nd get service entry
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In netdb.h
+.Ft struct servent *
+.Fn getservent
+.Ft struct servent *
+.Fn getservbyname "const char *name" "const char *proto"
+.Ft struct servent *
+.Fn getservbyport "int port" "const char *proto"
+.Ft void
+.Fn setservent "int stayopen"
+.Ft void
+.Fn endservent void
+.Sh DESCRIPTION
+The
+.Fn getservent ,
+.Fn getservbyname ,
+and
+.Fn getservbyport
+functions
+each return a pointer to an object with the
+following structure
+containing the broken-out
+fields of a line in the network services data base,
+.Pa /etc/services .
+.Bd -literal -offset indent
+struct servent {
+ char *s_name; /* official name of service */
+ char **s_aliases; /* alias list */
+ int s_port; /* port service resides at */
+ char *s_proto; /* protocol to use */
+};
+.Ed
+.Pp
+The members of this structure are:
+.Bl -tag -width s_aliases
+.It Fa s_name
+The official name of the service.
+.It Fa s_aliases
+A zero terminated list of alternate names for the service.
+.It Fa s_port
+The port number at which the service resides.
+Port numbers are returned in network byte order.
+.It Fa s_proto
+The name of the protocol to use when contacting the
+service.
+.El
+.Pp
+The
+.Fn getservent
+function
+reads the next line of the file, opening the file if necessary.
+.Pp
+The
+.Fn setservent
+function
+opens and rewinds the file. If the
+.Fa stayopen
+flag is non-zero,
+the net data base will not be closed after each call to
+.Fn getservbyname
+or
+.Fn getservbyport .
+.Pp
+The
+.Fn endservent
+function
+closes the file.
+.Pp
+The
+.Fn getservbyname
+and
+.Fn getservbyport
+functions
+sequentially search from the beginning
+of the file until a matching
+protocol name or
+port number (which must be specified in
+network byte order) is found,
+or until
+.Dv EOF
+is encountered.
+If a protocol name is also supplied (non-
+.Dv NULL ) ,
+searches must also match the protocol.
+.Sh FILES
+.Bl -tag -width /etc/services -compact
+.It Pa /etc/services
+.El
+.Sh DIAGNOSTICS
+Null pointer
+(0) returned on
+.Dv EOF
+or error.
+.Sh SEE ALSO
+.Xr getprotoent 3 ,
+.Xr services 5
+.Sh HISTORY
+The
+.Fn getservent ,
+.Fn getservbyport ,
+.Fn getservbyname ,
+.Fn setservent ,
+and
+.Fn endservent
+functions appeared in
+.Bx 4.2 .
+.Sh BUGS
+These functions use static data storage;
+if the data is needed for future use, it should be
+copied before any subsequent calls overwrite it.
+Expecting port numbers to fit in a 32 bit
+quantity is probably naive.
diff --git a/newlib/libc/sys/linux/net/getservent.c b/newlib/libc/sys/linux/net/getservent.c
index 76a0ead8e..1c26df75c 100644
--- a/newlib/libc/sys/linux/net/getservent.c
+++ b/newlib/libc/sys/linux/net/getservent.c
@@ -1,26 +1,282 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
+/*
+ * Copyright (c) 1983, 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.
+ */
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
- The GNU C 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
- Lesser General Public License for more details.
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#ifdef YP
+#include <rpc/rpc.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+static int serv_stepping_yp = 0;
+extern int _yp_check( char ** );
+#endif
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-#include <netdb.h>
+#define MAXALIASES 35
+
+static FILE *servf = NULL;
+static char line[BUFSIZ+1];
+static struct servent serv;
+static char *serv_aliases[MAXALIASES];
+int _serv_stayopen;
+
+#ifdef YP
+char *___getservbyname_yp = NULL;
+char *___getservbyproto_yp = NULL;
+int ___getservbyport_yp = 0;
+static char *yp_domain = NULL;
+
+static int
+_getservbyport_yp(line)
+ char *line;
+{
+ char *result;
+ int resultlen;
+ char buf[YPMAXRECORD + 2];
+ int rv;
+
+ snprintf(buf, sizeof(buf), "%d/%s", ntohs(___getservbyport_yp),
+ ___getservbyproto_yp);
+
+ ___getservbyport_yp = 0;
+ ___getservbyproto_yp = NULL;
+
+ if(!yp_domain) {
+ if(yp_get_default_domain(&yp_domain))
+ return (0);
+ }
+
+ /*
+ * We have to be a little flexible here. Ideally you're supposed
+ * to have both a services.byname and a services.byport map, but
+ * some systems have only services.byname. FreeBSD cheats a little
+ * by putting the services.byport information in the same map as
+ * services.byname so that either case will work. We allow for both
+ * possibilities here: if there is no services.byport map, we try
+ * services.byname instead.
+ */
+ if ((rv = yp_match(yp_domain, "services.byport", buf, strlen(buf),
+ &result, &resultlen))) {
+ if (rv == YPERR_MAP) {
+ if (yp_match(yp_domain, "services.byname", buf,
+ strlen(buf), &result, &resultlen))
+ return(0);
+ } else
+ return(0);
+ }
+
+ /* getservent() expects lines terminated with \n -- make it happy */
+ snprintf(line, BUFSIZ, "%.*s\n", resultlen, result);
+
+ free(result);
+ return(1);
+}
+
+static int
+_getservbyname_yp(line)
+ char *line;
+{
+ char *result;
+ int resultlen;
+ char buf[YPMAXRECORD + 2];
+
+ if(!yp_domain) {
+ if(yp_get_default_domain(&yp_domain))
+ return (0);
+ }
+
+ snprintf(buf, sizeof(buf), "%s/%s", ___getservbyname_yp,
+ ___getservbyproto_yp);
+
+ ___getservbyname_yp = 0;
+ ___getservbyproto_yp = NULL;
+
+ if (yp_match(yp_domain, "services.byname", buf, strlen(buf),
+ &result, &resultlen)) {
+ return(0);
+ }
+
+ /* getservent() expects lines terminated with \n -- make it happy */
+ snprintf(line, BUFSIZ, "%.*s\n", resultlen, result);
+
+ free(result);
+ return(1);
+}
+
+static int
+_getservent_yp(line)
+ char *line;
+{
+ static char *key = NULL;
+ static int keylen;
+ char *lastkey, *result;
+ int resultlen;
+ int rv;
+
+ if(!yp_domain) {
+ if(yp_get_default_domain(&yp_domain))
+ return (0);
+ }
+
+ if (!serv_stepping_yp) {
+ if (key)
+ free(key);
+ if ((rv = yp_first(yp_domain, "services.byname", &key, &keylen,
+ &result, &resultlen))) {
+ serv_stepping_yp = 0;
+ return(0);
+ }
+ serv_stepping_yp = 1;
+ } else {
+ lastkey = key;
+ rv = yp_next(yp_domain, "services.byname", key, keylen, &key,
+ &keylen, &result, &resultlen);
+ free(lastkey);
+ if (rv) {
+ serv_stepping_yp = 0;
+ return (0);
+ }
+ }
+
+ /* getservent() expects lines terminated with \n -- make it happy */
+ snprintf(line, BUFSIZ, "%.*s\n", resultlen, result);
+
+ free(result);
+
+ return(1);
+}
+#endif
+
+void
+setservent(f)
+ int f;
+{
+ if (servf == NULL)
+ servf = fopen(_PATH_SERVICES, "r" );
+ else
+ rewind(servf);
+ _serv_stayopen |= f;
+}
+void
+endservent()
+{
+ if (servf) {
+ fclose(servf);
+ servf = NULL;
+ }
+ _serv_stayopen = 0;
+}
-#define LOOKUP_TYPE struct servent
-#define GETFUNC_NAME getservent
-#define BUFLEN 1024
+struct servent *
+getservent()
+{
+ char *p;
+ char *cp, **q;
-#include "getXXent.c"
+#ifdef YP
+ if (serv_stepping_yp && _getservent_yp(line)) {
+ p = (char *)&line;
+ goto unpack;
+ }
+tryagain:
+#endif
+ if (servf == NULL && (servf = fopen(_PATH_SERVICES, "r" )) == NULL)
+ return (NULL);
+again:
+ if ((p = fgets(line, BUFSIZ, servf)) == NULL)
+ return (NULL);
+#ifdef YP
+ if (*p == '+' && _yp_check(NULL)) {
+ if (___getservbyname_yp != NULL) {
+ if (!_getservbyname_yp(line))
+ goto tryagain;
+ }
+ else if (___getservbyport_yp != 0) {
+ if (!_getservbyport_yp(line))
+ goto tryagain;
+ }
+ else if (!_getservent_yp(line))
+ goto tryagain;
+ }
+unpack:
+#endif
+ if (*p == '#')
+ goto again;
+ cp = strpbrk(p, "#\n");
+ if (cp == NULL)
+ goto again;
+ *cp = '\0';
+ serv.s_name = p;
+ p = strpbrk(p, " \t");
+ if (p == NULL)
+ goto again;
+ *p++ = '\0';
+ while (*p == ' ' || *p == '\t')
+ p++;
+ cp = strpbrk(p, ",/");
+ if (cp == NULL)
+ goto again;
+ *cp++ = '\0';
+ serv.s_port = htons((u_short)atoi(p));
+ serv.s_proto = cp;
+ q = serv.s_aliases = serv_aliases;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ while (cp && *cp) {
+ if (*cp == ' ' || *cp == '\t') {
+ cp++;
+ continue;
+ }
+ if (q < &serv_aliases[MAXALIASES - 1])
+ *q++ = cp;
+ cp = strpbrk(cp, " \t");
+ if (cp != NULL)
+ *cp++ = '\0';
+ }
+ *q = NULL;
+ return (&serv);
+}
diff --git a/newlib/libc/sys/linux/net/getservent_r.c b/newlib/libc/sys/linux/net/getservent_r.c
deleted file mode 100644
index 93708bdc2..000000000
--- a/newlib/libc/sys/linux/net/getservent_r.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct servent
-#define SETFUNC_NAME setservent
-#define GETFUNC_NAME getservent
-#define ENDFUNC_NAME endservent
-#define DATABASE_NAME services
-#define STAYOPEN int stayopen
-#define STAYOPEN_VAR stayopen
-
-#include "getXXent_r.c"
diff --git a/newlib/libc/sys/linux/net/getsrvbynm.c b/newlib/libc/sys/linux/net/getsrvbynm.c
deleted file mode 100644
index c3d2b2a21..000000000
--- a/newlib/libc/sys/linux/net/getsrvbynm.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct servent
-#define FUNCTION_NAME getservbyname
-#define DATABASE_NAME services
-#define ADD_PARAMS const char *name, const char *proto
-#define ADD_VARIABLES name, proto
-#define BUFLEN 1024
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getsrvbynm_r.c b/newlib/libc/sys/linux/net/getsrvbynm_r.c
deleted file mode 100644
index 3abf99774..000000000
--- a/newlib/libc/sys/linux/net/getsrvbynm_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct servent
-#define FUNCTION_NAME getservbyname
-#define DATABASE_NAME services
-#define ADD_PARAMS const char *name, const char *proto
-#define ADD_VARIABLES name, proto
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/getsrvbypt.c b/newlib/libc/sys/linux/net/getsrvbypt.c
deleted file mode 100644
index f6b383d6b..000000000
--- a/newlib/libc/sys/linux/net/getsrvbypt.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct servent
-#define FUNCTION_NAME getservbyport
-#define DATABASE_NAME services
-#define ADD_PARAMS int port, const char *proto
-#define ADD_VARIABLES port, proto
-#define BUFLEN 1024
-
-#include "getXXbyYY.c"
diff --git a/newlib/libc/sys/linux/net/getsrvbypt_r.c b/newlib/libc/sys/linux/net/getsrvbypt_r.c
deleted file mode 100644
index 100a9b25e..000000000
--- a/newlib/libc/sys/linux/net/getsrvbypt_r.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netdb.h>
-
-
-#define LOOKUP_TYPE struct servent
-#define FUNCTION_NAME getservbyport
-#define DATABASE_NAME services
-#define ADD_PARAMS int port, const char *proto
-#define ADD_VARIABLES port, proto
-
-#include "getXXbyYY_r.c"
diff --git a/newlib/libc/sys/linux/net/grp-lookup.c b/newlib/libc/sys/linux/net/grp-lookup.c
deleted file mode 100644
index 9373045b5..000000000
--- a/newlib/libc/sys/linux/net/grp-lookup.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME group
-#define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/herrno.c b/newlib/libc/sys/linux/net/herrno.c
deleted file mode 100644
index bb6d3f598..000000000
--- a/newlib/libc/sys/linux/net/herrno.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <reent.h>
-
-int *__h_errno_location() {
- return &(_REENT->_new._reent._h_errno);
-}
-
diff --git a/newlib/libc/sys/linux/net/herror.c b/newlib/libc/sys/linux/net/herror.c
new file mode 100644
index 000000000..0edec9890
--- /dev/null
+++ b/newlib/libc/sys/linux/net/herror.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 1987, 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) 1996 by Internet Software Consortium.
+ *
+ * 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include "un-namespace.h"
+
+const char *h_errlist[] = {
+ "Resolver Error 0 (no error)",
+ "Unknown host", /* 1 HOST_NOT_FOUND */
+ "Host name lookup failure", /* 2 TRY_AGAIN */
+ "Unknown server error", /* 3 NO_RECOVERY */
+ "No address associated with name", /* 4 NO_ADDRESS */
+};
+int h_nerr = { sizeof h_errlist / sizeof h_errlist[0] };
+
+int h_errno;
+
+/*
+ * herror --
+ * print the error indicated by the h_errno value.
+ */
+void
+herror(s)
+ const char *s;
+{
+ char *ptr;
+ if (s && *s) {
+ write(STDERR_FILENO, s, strlen(s));
+ write(STDERR_FILENO, ": ", 2);
+ }
+ ptr = (char *)hstrerror(h_errno);
+ write(STDERR_FILENO, ptr, strlen(ptr));
+ write(STDERR_FILENO, "\n", 1);
+}
+
+const char *
+hstrerror(err)
+ int err;
+{
+ if (err < 0)
+ return ("Resolver internal error");
+ else if (err < h_nerr)
+ return (h_errlist[err]);
+ return ("Unknown resolver error");
+}
diff --git a/newlib/libc/sys/linux/net/hesiod.3 b/newlib/libc/sys/linux/net/hesiod.3
new file mode 100644
index 000000000..8de1f9247
--- /dev/null
+++ b/newlib/libc/sys/linux/net/hesiod.3
@@ -0,0 +1,159 @@
+.\" $NetBSD: hesiod.3,v 1.1 1999/01/25 03:43:04 lukem Exp $
+.\" $FreeBSD: src/lib/libc/net/hesiod.3,v 1.3 2001/10/01 16:08:55 ru Exp $
+.\"
+.\" from: #Id: hesiod.3,v 1.9.2.1 1997/01/03 21:02:23 ghudson Exp #
+.\"
+.\" Copyright 1988, 1996 by the Massachusetts Institute of Technology.
+.\"
+.\" Permission to use, copy, modify, and distribute this
+.\" software and its documentation for any purpose and without
+.\" fee is hereby granted, provided that the above copyright
+.\" notice appear in all copies and that both that copyright
+.\" notice and this permission notice appear in supporting
+.\" documentation, and that the name of M.I.T. not be used in
+.\" advertising or publicity pertaining to distribution of the
+.\" software without specific, written prior permission.
+.\" M.I.T. makes no representations about the suitability of
+.\" this software for any purpose. It is provided "as is"
+.\" without express or implied warranty.
+.\"
+.Dd November 30, 1996
+.Dt HESIOD 3
+.Os
+.Sh NAME
+.Nm hesiod ,
+.Nm hesiod_init ,
+.Nm hesiod_resolve ,
+.Nm hesiod_free_list ,
+.Nm hesiod_to_bind ,
+.Nm hesiod_end
+.Nd Hesiod name server interface library
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In hesiod.h
+.Ft int
+.Fn hesiod_init "void **context"
+.Ft char **
+.Fn hesiod_resolve "void *context" "const char *name" "const char *type"
+.Ft void
+.Fn hesiod_free_list "void *context" "char **list"
+.Ft char *
+.Fn hesiod_to_bind "void *context" "const char *name" "const char *type"
+.Ft void
+.Fn hesiod_end "void *context"
+.Sh DESCRIPTION
+This family of functions allows you to perform lookups of Hesiod
+information, which is stored as text records in the Domain Name
+Service.
+To perform lookups, you must first initialize a
+.Fa context ,
+an opaque object which stores information used internally by the
+library between calls.
+.Fn hesiod_init
+initializes a context, storing a pointer to the context in the
+location pointed to by the
+.Fa context
+argument.
+.Fn hesiod_end
+frees the resources used by a context.
+.Pp
+.Fn hesiod_resolve
+is the primary interface to the library.
+If successful, it returns a
+list of one or more strings giving the records matching
+.Fa name
+and
+.Fa type .
+The last element of the list is followed by a
+.Dv NULL
+pointer.
+It is the
+caller's responsibility to call
+.Fn hesiod_free_list
+to free the resources used by the returned list.
+.Pp
+.Fn hesiod_to_bind
+converts
+.Fa name
+and
+.Fa type
+into the DNS name used by
+.Fn hesiod_resolve .
+It is the caller's responsibility to free the returned string using
+.Fn free .
+.Sh RETURN VALUES
+.Rv -std hesiod_init
+On failure,
+.Fn hesiod_resolve
+and
+.Fn hesiod_to_bind
+return
+.Dv NULL
+and set the global variable
+.Va errno
+to indicate the error.
+.Sh ENVIRONMENT
+.Bl -tag -width HESIOD_CONFIG
+.It Ev HES_DOMAIN
+If the environment variable
+.Ev HES_DOMAIN
+is set, it will override the domain in the Hesiod configuration file.
+.It Ev HESIOD_CONFIG
+If the environment variable
+.Ev HESIOD_CONFIG
+is set, it specifies the location of the Hesiod configuration file.
+.El
+.Sh SEE ALSO
+.Xr hesiod.conf 5 ,
+.Xr named 8
+.Rs
+.%T "Hesiod - Project Athena Technical Plan -- Name Service"
+.Re
+.Sh ERRORS
+Hesiod calls may fail because of:
+.Bl -tag -width Er
+.It Bq Er ENOMEM
+Insufficient memory was available to carry out the requested
+operation.
+.It Bq Er ENOEXEC
+.Fn hesiod_init
+failed because the Hesiod configuration file was invalid.
+.It Bq Er ECONNREFUSED
+.Fn hesiod_resolve
+failed because no name server could be contacted to answer the query.
+.It Bq Er EMSGSIZE
+.Fn hesiod_resolve
+or
+.Fn hesiod_to_bind
+failed because the query or response was too big to fit into the
+packet buffers.
+.It Bq Er ENOENT
+.Fn hesiod_resolve
+failed because the name server had no text records matching
+.Fa name
+and
+.Fa type ,
+or
+.Fn hesiod_to_bind
+failed because the
+.Fa name
+argument had a domain extension which could not be resolved with type
+.Dq rhs\-extension
+in the local Hesiod domain.
+.El
+.Sh AUTHORS
+.An Steve Dyer ,
+IBM/Project Athena
+.An Greg Hudson ,
+MIT Team Athena
+.Pp
+Copyright 1987, 1988, 1995, 1996 by the Massachusetts Institute of Technology.
+.Sh BUGS
+The strings corresponding to the
+.Va errno
+values set by the Hesiod functions are not particularly indicative of
+what went wrong, especially for
+.Er ENOEXEC
+and
+.Er ENOENT .
diff --git a/newlib/libc/sys/linux/net/hesiod.c b/newlib/libc/sys/linux/net/hesiod.c
new file mode 100644
index 000000000..909c09440
--- /dev/null
+++ b/newlib/libc/sys/linux/net/hesiod.c
@@ -0,0 +1,600 @@
+/* $NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $ */
+
+/* Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
+ */
+
+/* Copyright 1996 by the Massachusetts Institute of Technology.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+/* This file is part of the hesiod library. It implements the core
+ * portion of the hesiod resolver.
+ *
+ * This file is loosely based on an interim version of hesiod.c from
+ * the BIND IRS library, which was in turn based on an earlier version
+ * of this file. Extensive changes have been made on each step of the
+ * path.
+ *
+ * This implementation is not truly thread-safe at the moment because
+ * it uses res_send() and accesses _res.
+ */
+
+#include <sys/cdefs.h>
+
+#if 0
+static char *orig_rcsid = "$NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $";
+#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <hesiod.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+struct hesiod_p {
+ char *lhs; /* normally ".ns" */
+ char *rhs; /* AKA the default hesiod domain */
+ int classes[2]; /* The class search order. */
+};
+
+#define MAX_HESRESP 1024
+
+static int read_config_file(struct hesiod_p *, const char *);
+static char **get_txt_records(int, const char *);
+static int init_context(void);
+static void translate_errors(void);
+
+
+/*
+ * hesiod_init --
+ * initialize a hesiod_p.
+ */
+int
+hesiod_init(context)
+ void **context;
+{
+ struct hesiod_p *ctx;
+ const char *p, *configname;
+
+ ctx = malloc(sizeof(struct hesiod_p));
+ if (ctx) {
+ *context = ctx;
+ if (!issetugid())
+ configname = getenv("HESIOD_CONFIG");
+ else
+ configname = NULL;
+ if (!configname)
+ configname = _PATH_HESIOD_CONF;
+ if (read_config_file(ctx, configname) >= 0) {
+ /*
+ * The default rhs can be overridden by an
+ * environment variable.
+ */
+ if (!issetugid())
+ p = getenv("HES_DOMAIN");
+ else
+ p = NULL;
+ if (p) {
+ if (ctx->rhs)
+ free(ctx->rhs);
+ ctx->rhs = malloc(strlen(p) + 2);
+ if (ctx->rhs) {
+ *ctx->rhs = '.';
+ strcpy(ctx->rhs + 1,
+ (*p == '.') ? p + 1 : p);
+ return 0;
+ } else
+ errno = ENOMEM;
+ } else
+ return 0;
+ }
+ } else
+ errno = ENOMEM;
+
+ if (ctx->lhs)
+ free(ctx->lhs);
+ if (ctx->rhs)
+ free(ctx->rhs);
+ if (ctx)
+ free(ctx);
+ return -1;
+}
+
+/*
+ * hesiod_end --
+ * Deallocates the hesiod_p.
+ */
+void
+hesiod_end(context)
+ void *context;
+{
+ struct hesiod_p *ctx = (struct hesiod_p *) context;
+
+ free(ctx->rhs);
+ if (ctx->lhs)
+ free(ctx->lhs);
+ free(ctx);
+}
+
+/*
+ * hesiod_to_bind --
+ * takes a hesiod (name, type) and returns a DNS
+ * name which is to be resolved.
+ */
+char *
+hesiod_to_bind(void *context, const char *name, const char *type)
+{
+ struct hesiod_p *ctx = (struct hesiod_p *) context;
+ char bindname[MAXDNAME], *p, *ret, **rhs_list = NULL;
+ const char *rhs;
+ int len;
+ size_t bindnamelen;
+
+ if (strlcpy(bindname, name, sizeof(bindname)) >= sizeof(bindname)) {
+ errno = EMSGSIZE;
+ return NULL;
+ }
+
+ /*
+ * Find the right right hand side to use, possibly
+ * truncating bindname.
+ */
+ p = strchr(bindname, '@');
+ if (p) {
+ *p++ = 0;
+ if (strchr(p, '.'))
+ rhs = name + (p - bindname);
+ else {
+ rhs_list = hesiod_resolve(context, p, "rhs-extension");
+ if (rhs_list)
+ rhs = *rhs_list;
+ else {
+ errno = ENOENT;
+ return NULL;
+ }
+ }
+ } else
+ rhs = ctx->rhs;
+
+ /* See if we have enough room. */
+ len = strlen(bindname) + 1 + strlen(type);
+ if (ctx->lhs)
+ len += strlen(ctx->lhs) + ((ctx->lhs[0] != '.') ? 1 : 0);
+ len += strlen(rhs) + ((rhs[0] != '.') ? 1 : 0);
+ if (len > sizeof(bindname) - 1) {
+ if (rhs_list)
+ hesiod_free_list(context, rhs_list);
+ errno = EMSGSIZE;
+ return NULL;
+ }
+ /* Put together the rest of the domain. */
+ strcat(bindname, ".");
+ strcat(bindname, type);
+ /* Only append lhs if it isn't empty. */
+ if (ctx->lhs && ctx->lhs[0] != '\0' ) {
+ if (ctx->lhs[0] != '.')
+ strcat(bindname, ".");
+ strcat(bindname, ctx->lhs);
+ }
+ if (rhs[0] != '.')
+ strcat(bindname, ".");
+ strcat(bindname, rhs);
+
+ /* rhs_list is no longer needed, since we're done with rhs. */
+ if (rhs_list)
+ hesiod_free_list(context, rhs_list);
+
+ /* Make a copy of the result and return it to the caller. */
+ bindnamelen = strlen (bindname) + 1;
+ ret = malloc (bindnamelen);
+ if (!ret)
+ errno = ENOMEM;
+ else
+ memcpy (ret, bindname, bindnamelen);
+ return ret;
+}
+
+/*
+ * hesiod_resolve --
+ * Given a hesiod name and type, return an array of strings returned
+ * by the resolver.
+ */
+char **
+hesiod_resolve(context, name, type)
+ void *context;
+ const char *name;
+ const char *type;
+{
+ struct hesiod_p *ctx = (struct hesiod_p *) context;
+ char *bindname, **retvec;
+
+ bindname = hesiod_to_bind(context, name, type);
+ if (!bindname)
+ return NULL;
+
+ retvec = get_txt_records(ctx->classes[0], bindname);
+ if (retvec == NULL && errno == ENOENT && ctx->classes[1])
+ retvec = get_txt_records(ctx->classes[1], bindname);
+
+ free(bindname);
+ return retvec;
+}
+
+/*ARGSUSED*/
+void
+hesiod_free_list(context, list)
+ void *context;
+ char **list;
+{
+ char **p;
+
+ if (list == NULL)
+ return;
+ for (p = list; *p; p++)
+ free(*p);
+ free(list);
+}
+
+
+/* read_config_file --
+ * Parse the /etc/hesiod.conf file. Returns 0 on success,
+ * -1 on failure. On failure, it might leave values in ctx->lhs
+ * or ctx->rhs which need to be freed by the caller.
+ */
+static int
+read_config_file(ctx, filename)
+ struct hesiod_p *ctx;
+ const char *filename;
+{
+ char *key, *data, *p, **which;
+ char buf[MAXDNAME + 7];
+ int n;
+ FILE *fp;
+
+ /* Set default query classes. */
+ ctx->classes[0] = C_IN;
+ ctx->classes[1] = C_HS;
+
+ /* Try to open the configuration file. */
+ fp = fopen(filename, "r");
+ if (!fp) {
+ size_t len;
+ /* Use compiled in default domain names. */
+ len = strlen (DEF_LHS) + 1;
+ ctx->lhs = malloc (len);
+ if (ctx->lhs) {
+ memcpy (ctx->lhs, DEF_LHS, len);
+ len = strlen (DEF_RHS) + 1;
+ ctx->rhs = malloc (len);
+ if (ctx->rhs)
+ memcpy (ctx->rhs, DEF_RHS, len);
+ }
+ if (ctx->lhs && ctx->rhs)
+ return 0;
+ else {
+ errno = ENOMEM;
+ return -1;
+ }
+ }
+ ctx->lhs = NULL;
+ ctx->rhs = NULL;
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ p = buf;
+ if (*p == '#' || *p == '\n' || *p == '\r')
+ continue;
+ while (*p == ' ' || *p == '\t')
+ p++;
+ key = p;
+ while (*p != ' ' && *p != '\t' && *p != '=')
+ p++;
+ *p++ = 0;
+
+ while (isspace(*p) || *p == '=')
+ p++;
+ data = p;
+ while (!isspace(*p))
+ p++;
+ *p = 0;
+
+ if (strcasecmp(key, "lhs") == 0 ||
+ strcasecmp(key, "rhs") == 0) {
+ size_t len;
+ which = (strcasecmp(key, "lhs") == 0)
+ ? &ctx->lhs : &ctx->rhs;
+ len = strlen (data) + 1;
+ *which = malloc (len);
+ if (!*which) {
+ errno = ENOMEM;
+ return -1;
+ }
+ else
+ memcpy (*which, data, len);
+ } else {
+ if (strcasecmp(key, "classes") == 0) {
+ n = 0;
+ while (*data && n < 2) {
+ p = data;
+ while (*p && *p != ',')
+ p++;
+ if (*p)
+ *p++ = 0;
+ if (strcasecmp(data, "IN") == 0)
+ ctx->classes[n++] = C_IN;
+ else
+ if (strcasecmp(data, "HS") == 0)
+ ctx->classes[n++] =
+ C_HS;
+ data = p;
+ }
+ while (n < 2)
+ ctx->classes[n++] = 0;
+ }
+ }
+ }
+ fclose(fp);
+
+ if (!ctx->rhs || ctx->classes[0] == 0 ||
+ ctx->classes[0] == ctx->classes[1]) {
+ errno = ENOEXEC;
+ return -1;
+ }
+ return 0;
+}
+
+/*
+ * get_txt_records --
+ * Given a DNS class and a DNS name, do a lookup for TXT records, and
+ * return a list of them.
+ */
+static char **
+get_txt_records(qclass, name)
+ int qclass;
+ const char *name;
+{
+ HEADER *hp;
+ unsigned char qbuf[PACKETSZ], abuf[MAX_HESRESP], *p, *eom, *eor;
+ char *dst, **list;
+ int ancount, qdcount, i, j, n, skip, type, class, len;
+
+ /* Make sure the resolver is initialized. */
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1)
+ return NULL;
+
+ /* Construct the query. */
+ n = res_mkquery(QUERY, name, qclass, T_TXT, NULL, 0,
+ NULL, qbuf, PACKETSZ);
+ if (n < 0)
+ return NULL;
+
+ /* Send the query. */
+ n = res_send(qbuf, n, abuf, MAX_HESRESP);
+ if (n < 0) {
+ errno = ECONNREFUSED;
+ return NULL;
+ }
+ /* Parse the header of the result. */
+ hp = (HEADER *) (void *) abuf;
+ ancount = ntohs(hp->ancount);
+ qdcount = ntohs(hp->qdcount);
+ p = abuf + sizeof(HEADER);
+ eom = abuf + n;
+
+ /*
+ * Skip questions, trying to get to the answer section
+ * which follows.
+ */
+ for (i = 0; i < qdcount; i++) {
+ skip = dn_skipname(p, eom);
+ if (skip < 0 || p + skip + QFIXEDSZ > eom) {
+ errno = EMSGSIZE;
+ return NULL;
+ }
+ p += skip + QFIXEDSZ;
+ }
+
+ /* Allocate space for the text record answers. */
+ list = malloc((ancount + 1) * sizeof(char *));
+ if (!list) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ /* Parse the answers. */
+ j = 0;
+ for (i = 0; i < ancount; i++) {
+ /* Parse the header of this answer. */
+ skip = dn_skipname(p, eom);
+ if (skip < 0 || p + skip + 10 > eom)
+ break;
+ type = p[skip + 0] << 8 | p[skip + 1];
+ class = p[skip + 2] << 8 | p[skip + 3];
+ len = p[skip + 8] << 8 | p[skip + 9];
+ p += skip + 10;
+ if (p + len > eom) {
+ errno = EMSGSIZE;
+ break;
+ }
+ /* Skip entries of the wrong class and type. */
+ if (class != qclass || type != T_TXT) {
+ p += len;
+ continue;
+ }
+ /* Allocate space for this answer. */
+ list[j] = malloc((size_t)len);
+ if (!list[j]) {
+ errno = ENOMEM;
+ break;
+ }
+ dst = list[j++];
+
+ /* Copy answer data into the allocated area. */
+ eor = p + len;
+ while (p < eor) {
+ n = (unsigned char) *p++;
+ if (p + n > eor) {
+ errno = EMSGSIZE;
+ break;
+ }
+ memcpy(dst, p, (size_t)n);
+ p += n;
+ dst += n;
+ }
+ if (p < eor) {
+ errno = EMSGSIZE;
+ break;
+ }
+ *dst = 0;
+ }
+
+ /*
+ * If we didn't terminate the loop normally, something
+ * went wrong.
+ */
+ if (i < ancount) {
+ for (i = 0; i < j; i++)
+ free(list[i]);
+ free(list);
+ return NULL;
+ }
+ if (j == 0) {
+ errno = ENOENT;
+ free(list);
+ return NULL;
+ }
+ list[j] = NULL;
+ return list;
+}
+
+ /*
+ * COMPATIBILITY FUNCTIONS
+ */
+
+static int inited = 0;
+static void *context;
+static int errval = HES_ER_UNINIT;
+
+int
+hes_init()
+{
+ init_context();
+ return errval;
+}
+
+char *
+hes_to_bind(name, type)
+ const char *name;
+ const char *type;
+{
+ static char *bindname;
+ if (init_context() < 0)
+ return NULL;
+ if (bindname)
+ free(bindname);
+ bindname = hesiod_to_bind(context, name, type);
+ if (!bindname)
+ translate_errors();
+ return bindname;
+}
+
+char **
+hes_resolve(name, type)
+ const char *name;
+ const char *type;
+{
+ static char **list;
+
+ if (init_context() < 0)
+ return NULL;
+
+ /*
+ * In the old Hesiod interface, the caller was responsible for
+ * freeing the returned strings but not the vector of strings itself.
+ */
+ if (list)
+ free(list);
+
+ list = hesiod_resolve(context, name, type);
+ if (!list)
+ translate_errors();
+ return list;
+}
+
+int
+hes_error()
+{
+ return errval;
+}
+
+void
+hes_free(hp)
+ char **hp;
+{
+ hesiod_free_list(context, hp);
+}
+
+static int
+init_context()
+{
+ if (!inited) {
+ inited = 1;
+ if (hesiod_init(&context) < 0) {
+ errval = HES_ER_CONFIG;
+ return -1;
+ }
+ errval = HES_ER_OK;
+ }
+ return 0;
+}
+
+static void
+translate_errors()
+{
+ switch (errno) {
+ case ENOENT:
+ errval = HES_ER_NOTFOUND;
+ break;
+ case ECONNREFUSED:
+ case EMSGSIZE:
+ errval = HES_ER_NET;
+ break;
+ case ENOMEM:
+ default:
+ /* Not a good match, but the best we can do. */
+ errval = HES_ER_CONFIG;
+ break;
+ }
+}
diff --git a/newlib/libc/sys/linux/net/hosts-lookup.c b/newlib/libc/sys/linux/net/hosts-lookup.c
deleted file mode 100644
index 8dff71f7c..000000000
--- a/newlib/libc/sys/linux/net/hosts-lookup.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME hosts
-#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files"
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/if_indextoname.3 b/newlib/libc/sys/linux/net/if_indextoname.3
new file mode 100644
index 000000000..4b5bff5aa
--- /dev/null
+++ b/newlib/libc/sys/linux/net/if_indextoname.3
@@ -0,0 +1,142 @@
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/if_indextoname.3,v 1.7 2001/10/01 16:08:55 ru Exp $
+.\"
+.Dd May 21, 1998
+.Dt IF_NAMETOINDEX 3
+.Os
+.Sh NAME
+.Nm if_nametoindex ,
+.Nm if_indextoname ,
+.Nm if_nameindex ,
+.Nm if_freenameindex
+.Nd convert interface index to name, and vice versa
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In net/if.h
+.Ft "unsigned int"
+.Fn if_nametoindex "const char *ifname"
+.Ft "char *"
+.Fn if_indextoname "unsigned int ifindex" "char *ifname"
+.Ft "struct if_nameindex *"
+.Fn if_nameindex "void"
+.Ft "void"
+.Fn if_freenameindex "struct if_nameindex *ptr"
+.Sh DESCRIPTION
+The functions map interface index to readable interface name
+(such as
+.Dq Li lo0 ) ,
+and vice versa.
+.Pp
+.Fn if_nametoindex
+converts readable interface name to interface index
+.Pp positive integer value .
+If the specified interface does not exist, 0 will be returned.
+.Pp
+.Fn if_indextoname
+converts interface index to readable interface name.
+The
+.Fa ifname
+argument must point to a buffer of at least
+.Dv IF_NAMESIZE
+bytes into which the interface name corresponding to the specified index is
+returned.
+.Dv ( IF_NAMESIZE
+is also defined in
+.Aq Pa net/if.h
+and its value includes a terminating null byte at the end of the
+interface name.)
+This pointer is also the return value of the function.
+If there is no interface corresponding to the specified index,
+.Dv NULL
+is returned.
+.Pp
+.Fn if_nameindex
+returns an array of
+.Fa if_nameindex
+structures.
+.Fa if_nametoindex
+is also defined in
+.Aq Pa net/if.h ,
+and is as follows:
+.Bd -literal -offset
+struct if_nameindex {
+ unsigned int if_index; /* 1, 2, ... */
+ char *if_name; /* null terminated name: "le0", ... */
+};
+.Ed
+.Pp
+The end of the array of structures is indicated by a structure with
+an
+.Fa if_index
+of 0 and an
+.Fa if_name
+of
+.Dv NULL .
+The function returns a
+.Dv NULL
+pointer upon an error.
+The memory used for this array of structures along with the interface
+names pointed to by the
+.Fa if_name
+members is obtained dynamically.
+This memory is freed by the
+.Fn if_freenameindex
+function.
+.Pp
+.Fn if_freenameindex
+takes a pointer that was returned by
+.Fn if_nameindex
+as argument
+.Pq Fa ptr ,
+and it reclaims the region allocated.
+.Sh DIAGNOSTICS
+.Fn if_nametoindex
+returns 0 on error, positive integer on success.
+.Fn if_indextoname
+and
+.Fn if_nameindex
+return
+.Dv NULL
+on errors.
+.Sh SEE ALSO
+R. Gilligan, S. Thomson, J. Bound, and W. Stevens,
+``Basic Socket Interface Extensions for IPv6,'' RFC2553, March 1999.
+.Sh HISTORY
+The implementation first appeared in WIDE Hydrangea IPv6 protocol stack kit.
+.Sh STANDARDS
+These functions are defined in ``Basic Socket Interface Extensions for IPv6''
+(RFC2533).
diff --git a/newlib/libc/sys/linux/net/ifaddrs.h b/newlib/libc/sys/linux/net/ifaddrs.h
deleted file mode 100644
index ba6a1554b..000000000
--- a/newlib/libc/sys/linux/net/ifaddrs.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ifaddrs.h -- declarations for getting network interface addresses
- Copyright (C) 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _IFADDRS_H
-#define _IFADDRS_H 1
-
-#include <features.h>
-#include <sys/socket.h>
-
-__BEGIN_DECLS
-
-/* The `getifaddrs' function generates a linked list of these structures.
- Each element of the list describes one network interface. */
-struct ifaddrs
-{
- struct ifaddrs *ifa_next; /* Pointer to the next structure. */
-
- char *ifa_name; /* Name of this network interface. */
- unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */
-
- struct sockaddr *ifa_addr; /* Network address of this interface. */
- struct sockaddr *ifa_netmask; /* Netmask of this interface. */
- union
- {
- /* At most one of the following two is valid. If the IFF_BROADCAST
- bit is set in `ifa_flags', then `ifa_broadaddr' is valid. If the
- IFF_POINTOPOINT bit is set, then `ifa_dstaddr' is valid.
- It is never the case that both these bits are set at once. */
- struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */
- struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */
- } ifa_ifu;
- /* These very same macros are defined by <net/if.h> for `struct ifaddr'.
- So if they are defined already, the existing definitions will be fine. */
-# ifndef ifa_broadaddr
-# define ifa_broadaddr ifa_ifu.ifu_broadaddr
-# endif
-# ifndef ifa_dstaddr
-# define ifa_dstaddr ifa_ifu.ifu_dstaddr
-# endif
-
- void *ifa_data; /* Address-specific data (may be unused). */
-};
-
-
-/* Create a linked list of `struct ifaddrs' structures, one for each
- network interface on the host machine. If successful, store the
- list in *IFAP and return 0. On errors, return -1 and set `errno'.
-
- The storage returned in *IFAP is allocated dynamically and can
- only be properly freed by passing it to `freeifaddrs'. */
-extern int getifaddrs (struct ifaddrs **__ifap) __THROW;
-
-/* Reclaim the storage allocated by a previous `getifaddrs' call. */
-extern void freeifaddrs (struct ifaddrs *__ifa) __THROW;
-
-__END_DECLS
-
-#endif /* ifaddrs.h */
diff --git a/newlib/libc/sys/linux/net/ifreq.c b/newlib/libc/sys/linux/net/ifreq.c
deleted file mode 100644
index 9d6a6121b..000000000
--- a/newlib/libc/sys/linux/net/ifreq.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Andreas Jaeger <aj@suse.de>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include "ifreq.h"
-
-/* Variable to signal whether SIOCGIFCONF is not available. */
-#if __ASSUME_SIOCGIFNAME == 0 || 1
-static int old_siocgifconf;
-#else
-# define old_siocgifconf 0
-#endif
-
-
-void
-__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
-{
- int fd = sockfd;
- struct ifconf ifc;
- int rq_len;
- int nifs;
-# define RQ_IFS 4
-
- if (fd < 0)
- fd = __opensock ();
- if (fd < 0)
- {
- *num_ifs = 0;
- *ifreqs = NULL;
- return;
- }
-
- ifc.ifc_buf = NULL;
-
- /* We may be able to get the needed buffer size directly, rather than
- guessing. */
- if (! old_siocgifconf)
- {
- ifc.ifc_buf = NULL;
- ifc.ifc_len = 0;
- if (ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
- {
-# if __ASSUME_SIOCGIFNAME == 0
- old_siocgifconf = 1;
-# endif
- rq_len = RQ_IFS * sizeof (struct ifreq);
- }
- else
- rq_len = ifc.ifc_len;
- }
- else
- rq_len = RQ_IFS * sizeof (struct ifreq);
-
- /* Read all the interfaces out of the kernel. */
- while (1)
- {
- ifc.ifc_len = rq_len;
- void *newp = realloc (ifc.ifc_buf, ifc.ifc_len);
- if (newp == NULL
- || (ifc.ifc_buf = newp, ioctl (fd, SIOCGIFCONF, &ifc)) < 0)
- {
- free (ifc.ifc_buf);
-
- if (fd != sockfd)
- close (fd);
-
- *num_ifs = 0;
- *ifreqs = NULL;
- return;
- }
-
- if (!old_siocgifconf || ifc.ifc_len < rq_len)
- break;
-
- rq_len *= 2;
- }
-
- nifs = ifc.ifc_len / sizeof (struct ifreq);
-
- if (fd != sockfd)
- close (fd);
-
- *num_ifs = nifs;
- *ifreqs = realloc (ifc.ifc_buf, nifs * sizeof (struct ifreq));
-}
diff --git a/newlib/libc/sys/linux/net/ifreq.h b/newlib/libc/sys/linux/net/ifreq.h
deleted file mode 100644
index ba55a39eb..000000000
--- a/newlib/libc/sys/linux/net/ifreq.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Andreas Jaeger <aj@suse.de>.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <net/if.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-
-
-extern void __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd);
-
-static inline struct ifreq *
-__if_nextreq (struct ifreq *ifr)
-{
- return ifr + 1;
-}
-
-static inline void
-__if_freereq (struct ifreq *ifreqs, int num_ifs)
-{
- free (ifreqs);
-}
diff --git a/newlib/libc/sys/linux/net/in6_addr.c b/newlib/libc/sys/linux/net/in6_addr.c
deleted file mode 100644
index a75b64ebc..000000000
--- a/newlib/libc/sys/linux/net/in6_addr.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1997, 1998, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <netinet/in.h>
-#include "libc-symbols.h"
-
-const struct in6_addr in6addr_any =
-{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
-libc_hidden_data_def (in6addr_any)
-const struct in6_addr in6addr_loopback =
-{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } };
-libc_hidden_data_def (in6addr_loopback)
diff --git a/newlib/libc/sys/linux/net/inet.3 b/newlib/libc/sys/linux/net/inet.3
new file mode 100644
index 000000000..7a6fcf370
--- /dev/null
+++ b/newlib/libc/sys/linux/net/inet.3
@@ -0,0 +1,271 @@
+.\" Copyright (c) 1983, 1990, 1991, 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.
+.\"
+.\" From: @(#)inet.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/inet.3,v 1.22 2001/12/01 03:43:01 mike Exp $
+.\"
+.Dd June 17, 1996
+.Dt INET 3
+.Os
+.Sh NAME
+.Nm inet_aton ,
+.Nm inet_addr ,
+.Nm inet_network ,
+.Nm inet_ntoa ,
+.Nm inet_ntop ,
+.Nm inet_pton ,
+.Nm inet_makeaddr ,
+.Nm inet_lnaof ,
+.Nm inet_netof
+.Nd Internet address manipulation routines
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In arpa/inet.h
+.Ft int
+.Fn inet_aton "const char *cp" "struct in_addr *pin"
+.Ft in_addr_t
+.Fn inet_addr "const char *cp"
+.Ft in_addr_t
+.Fn inet_network "const char *cp"
+.Ft char *
+.Fn inet_ntoa "struct in_addr in"
+.Ft const char *
+.Fn inet_ntop "int af" "const void *src" "char *dst" "socklen_t size"
+.Ft int
+.Fn inet_pton "int af" "const char *src" "void *dst"
+.Ft struct in_addr
+.Fn inet_makeaddr "in_addr_t net" "in_addr_t lna"
+.Ft in_addr_t
+.Fn inet_lnaof "struct in_addr in"
+.Ft in_addr_t
+.Fn inet_netof "struct in_addr in"
+.Sh DESCRIPTION
+The routines
+.Fn inet_aton ,
+.Fn inet_addr
+and
+.Fn inet_network
+interpret character strings representing
+numbers expressed in the Internet standard
+.Ql .\&
+notation.
+.Pp
+The
+.Fn inet_pton
+function converts a presentation format address (that is, printable form
+as held in a character string) to network format (usually a
+.Ft struct in_addr
+or some other internal binary representation, in network byte order).
+It returns 1 if the address was valid for the specified address family, or
+0 if the address wasn't parseable in the specified address family, or -1
+if some system error occurred (in which case
+.Va errno
+will have been set).
+This function is presently valid for
+.Dv AF_INET
+and
+.Dv AF_INET6 .
+.Pp
+The
+.Fn inet_aton
+routine interprets the specified character string as an Internet address,
+placing the address into the structure provided.
+It returns 1 if the string was successfully interpreted,
+or 0 if the string is invalid.
+The
+.Fn inet_addr
+and
+.Fn inet_network
+functions return numbers suitable for use
+as Internet addresses and Internet network
+numbers, respectively.
+.Pp
+The function
+.Fn inet_ntop
+converts an address from network format (usually a
+.Ft struct in_addr
+or some other binary form, in network byte order) to presentation format
+(suitable for external display purposes).
+It returns NULL if a system error occurs (in which case,
+.Va errno
+will have been set), or it returns a pointer to the destination string.
+This function is presently valid for
+.Dv AF_INET
+and
+.Dv AF_INET6 .
+.Pp
+The routine
+.Fn inet_ntoa
+takes an Internet address and returns an
+.Tn ASCII
+string representing the address in
+.Ql .\&
+notation. The routine
+.Fn inet_makeaddr
+takes an Internet network number and a local
+network address and constructs an Internet address
+from it. The routines
+.Fn inet_netof
+and
+.Fn inet_lnaof
+break apart Internet host addresses, returning
+the network number and local network address part,
+respectively.
+.Pp
+All Internet addresses are returned in network
+order (bytes ordered from left to right).
+All network numbers and local address parts are
+returned as machine byte order integer values.
+.Sh INTERNET ADDRESSES
+Values specified using the
+.Ql .\&
+notation take one
+of the following forms:
+.Bd -literal -offset indent
+a.b.c.d
+a.b.c
+a.b
+a
+.Ed
+.Pp
+When four parts are specified, each is interpreted
+as a byte of data and assigned, from left to right,
+to the four bytes of an Internet address. Note
+that when an Internet address is viewed as a 32-bit
+integer quantity on the
+.Tn VAX
+the bytes referred to
+above appear as
+.Dq Li d.c.b.a .
+That is,
+.Tn VAX
+bytes are
+ordered from right to left.
+.Pp
+When a three part address is specified, the last
+part is interpreted as a 16-bit quantity and placed
+in the right-most two bytes of the network address.
+This makes the three part address format convenient
+for specifying Class B network addresses as
+.Dq Li 128.net.host .
+.Pp
+When a two part address is supplied, the last part
+is interpreted as a 24-bit quantity and placed in
+the right most three bytes of the network address.
+This makes the two part address format convenient
+for specifying Class A network addresses as
+.Dq Li net.host .
+.Pp
+When only one part is given, the value is stored
+directly in the network address without any byte
+rearrangement.
+.Pp
+All numbers supplied as
+.Dq parts
+in a
+.Ql .\&
+notation
+may be decimal, octal, or hexadecimal, as specified
+in the C language (i.e., a leading 0x or 0X implies
+hexadecimal; otherwise, a leading 0 implies octal;
+otherwise, the number is interpreted as decimal).
+.Pp
+The
+.Fn inet_aton
+and
+.Fn inet_ntoa
+functions are semi-deprecated in favor of the
+.Xr addr2ascii 3
+family. However, since those functions are not yet widely implemented,
+portable programs cannot rely on their presence and will continue
+to use the
+.Xr inet 3
+functions for some time.
+.Sh DIAGNOSTICS
+The constant
+.Dv INADDR_NONE
+is returned by
+.Fn inet_addr
+and
+.Fn inet_network
+for malformed requests.
+.Sh SEE ALSO
+.Xr addr2ascii 3 ,
+.Xr byteorder 3 ,
+.Xr gethostbyname 3 ,
+.Xr getnetent 3 ,
+.Xr inet_net 3 ,
+.Xr hosts 5 ,
+.Xr networks 5
+.Rs
+.%R RFC
+.%N 2373
+.%D July 1998
+.%T "IP Version 6 Addressing Architecture"
+.Re
+.Sh STANDARDS
+The
+.Fn inet_ntop
+and
+.Fn inet_pton
+functions conform to
+.St -xns5.2 .
+Note that
+.Fn inet_pton
+does not accept 1-, 2-, or 3-part dotted addresses; all four parts
+must be specified and are interpreted only as decimal values.
+This is a narrower input set than that accepted by
+.Fn inet_aton .
+.Sh HISTORY
+These
+functions appeared in
+.Bx 4.2 .
+.Sh BUGS
+The value
+.Dv INADDR_NONE
+(0xffffffff) is a valid broadcast address, but
+.Fn inet_addr
+cannot return that value without indicating failure.
+The newer
+.Fn inet_aton
+function does not share this problem.
+The problem of host byte ordering versus network byte ordering is
+confusing.
+The string returned by
+.Fn inet_ntoa
+resides in a static memory area.
+.Pp
+Inet_addr should return a
+.Fa struct in_addr .
diff --git a/newlib/libc/sys/linux/net/inet6_option.c b/newlib/libc/sys/linux/net/inet6_option.c
deleted file mode 100644
index 182cfe942..000000000
--- a/newlib/libc/sys/linux/net/inet6_option.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <assert.h>
-#include <string.h>
-#include <netinet/in.h>
-#include <netinet/ip6.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include "libc-symbols.h"
-
-#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
-
-static void
-internal_function
-add_pad (struct cmsghdr *cmsg, int len)
-{
- unsigned char *p = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0);
-
- if (len == 1)
- /* Special handling for 1, a one-byte solution. */
- *p++ = IP6OPT_PAD1;
- else if (len != 0)
- {
- /* Multibyte padding. */
- *p++ = IP6OPT_PADN;
- *p++ = len - 2; /* Discount the two header bytes. */
- /* The rest is filled with zero. */
- memset (p, '\0', len - 2);
- p += len - 2;
- }
-
- /* Account for the bytes. */
- cmsg->cmsg_len += len;
-}
-
-
-static int
-get_opt_end (const uint8_t **result, const uint8_t *startp,
- const uint8_t *endp)
-{
- if (startp >= endp)
- /* Out of bounds. */
- return -1;
-
- if (*startp == IP6OPT_PAD1)
- {
- /* Just this one byte. */
- *result = startp + 1;
- return 0;
- }
-
- /* Now we know there must be at least two bytes. */
- if (startp + 2 > endp
- /* Now we can get the length byte. */
- || startp + startp[1] + 2 > endp)
- return -1;
-
- *result = startp + startp[1] + 2;
-
- return 0;
-}
-
-
-/* RFC 2292, 6.3.1
-
- This function returns the number of bytes required to hold an option
- when it is stored as ancillary data, including the cmsghdr structure
- at the beginning, and any padding at the end (to make its size a
- multiple of 8 bytes). The argument is the size of the structure
- defining the option, which must include any pad bytes at the
- beginning (the value y in the alignment term "xn + y"), the type
- byte, the length byte, and the option data. */
-int
-inet6_option_space (nbytes)
- int nbytes;
-{
- /* Add room for the extension header. */
- nbytes += sizeof (struct ip6_ext);
-
- return CMSG_SPACE (roundup (nbytes, 8));
-}
-
-
-/* RFC 2292, 6.3.2
-
- This function is called once per ancillary data object that will
- contain either Hop-by-Hop or Destination options. It returns 0 on
- success or -1 on an error. */
-int
-inet6_option_init (bp, cmsgp, type)
- void *bp;
- struct cmsghdr **cmsgp;
- int type;
-{
- /* Only Hop-by-Hop or Destination options allowed. */
- if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS)
- return -1;
-
- /* BP is a pointer to the previously allocated space. */
- struct cmsghdr *newp = (struct cmsghdr *) bp;
-
- /* Initialize the message header.
-
- Length: No data yet, only the cmsghdr struct. */
- newp->cmsg_len = CMSG_LEN (0);
- /* Originating protocol: obviously IPv6. */
- newp->cmsg_level = IPPROTO_IPV6;
- /* Message type. */
- newp->cmsg_type = type;
-
- /* Pass up the result. */
- *cmsgp = newp;
-
- return 0;
-}
-
-
-/* RFC 2292, 6.3.3
-
- This function appends a Hop-by-Hop option or a Destination option
- into an ancillary data object that has been initialized by
- inet6_option_init(). This function returns 0 if it succeeds or -1 on
- an error. */
-int
-inet6_option_append (cmsg, typep, multx, plusy)
- struct cmsghdr *cmsg;
- const uint8_t *typep;
- int multx;
- int plusy;
-{
- /* typep is a pointer to the 8-bit option type. It is assumed that this
- field is immediately followed by the 8-bit option data length field,
- which is then followed immediately by the option data.
-
- The option types IP6OPT_PAD1 and IP6OPT_PADN also must be handled. */
- int len = typep[0] == IP6OPT_PAD1 ? 1 : typep[1] + 2;
-
- /* Get the pointer to the space in the message. */
- uint8_t *ptr = inet6_option_alloc (cmsg, len, multx, plusy);
- if (ptr == NULL)
- /* Some problem with the parameters. */
- return -1;
-
- /* Copy the content. */
- memcpy (ptr, typep, len);
-
- return 0;
-}
-
-
-/* RFC 2292, 6.3.4
-
- This function appends a Hop-by-Hop option or a Destination option
- into an ancillary data object that has been initialized by
- inet6_option_init(). This function returns a pointer to the 8-bit
- option type field that starts the option on success, or NULL on an
- error. */
-uint8_t *
-inet6_option_alloc (cmsg, datalen, multx, plusy)
- struct cmsghdr *cmsg;
- int datalen;
- int multx;
- int plusy;
-{
- /* The RFC limits the value of the alignment values. */
- if ((multx != 1 && multx != 2 && multx != 4 && multx != 8)
- || ! (plusy >= 0 && plusy <= 7))
- return NULL;
-
- /* Current data size. */
- int dsize = cmsg->cmsg_len - CMSG_LEN (0);
-
- /* The first two bytes of the option are for the extended header. */
- if (__builtin_expect (dsize == 0, 0))
- {
- cmsg->cmsg_len += sizeof (struct ip6_ext);
- dsize = sizeof (struct ip6_ext);
- }
-
- /* First add padding. */
- add_pad (cmsg, ((multx - (dsize & (multx - 1))) & (multx - 1)) + plusy);
-
- /* Return the pointer to the start of the option space. */
- uint8_t *result = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0);
- cmsg->cmsg_len += datalen;
-
- /* The extended option header length is measured in 8-byte groups.
- To represent the current length we might have to add padding. */
- dsize = cmsg->cmsg_len - CMSG_LEN (0);
- add_pad (cmsg, (8 - (dsize & (8 - 1))) & (8 - 1));
-
- /* Record the new length of the option. */
- assert (((cmsg->cmsg_len - CMSG_LEN (0)) % 8) == 0);
- int len8b = (cmsg->cmsg_len - CMSG_LEN (0)) / 8 - 1;
- if (len8b >= 256)
- /* Too long. */
- return NULL;
-
- ((struct ip6_ext *) CMSG_DATA (cmsg))->ip6e_len = len8b;
-
- return result;
-}
-libc_hidden_def (inet6_option_alloc)
-
-
-/* RFC 2292, 6.3.5
-
- This function processes the next Hop-by-Hop option or Destination
- option in an ancillary data object. If another option remains to be
- processed, the return value of the function is 0 and *tptrp points to
- the 8-bit option type field (which is followed by the 8-bit option
- data length, followed by the option data). If no more options remain
- to be processed, the return value is -1 and *tptrp is NULL. If an
- error occurs, the return value is -1 and *tptrp is not NULL. */
-int
-inet6_option_next (cmsg, tptrp)
- const struct cmsghdr *cmsg;
- uint8_t **tptrp;
-{
- /* Make sure it is an option of the right type. */
- if (cmsg->cmsg_level != IPPROTO_IPV6
- || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS))
- return -1;
-
- /* Pointer to the extension header. We only compute the address, we
- don't access anything yet. */
- const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg);
-
- /* Make sure the message is long enough. */
- if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext))
- /* Now we can access the extension header. */
- || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8))
- /* Too small. */
- return -1;
-
- /* Determine the address of the byte past the message. */
- const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
-
- const uint8_t *result;
- if (tptrp == NULL)
- /* This is the first call, return the first option if there is one. */
- result = (const uint8_t *) (ip6e + 1);
- else
- {
- /* Make sure *TPTRP points to a beginning of a new option in
- the message. The upper limit is checked in get_opt_end. */
- if (*tptrp < (const uint8_t *) (ip6e + 1))
- return -1;
-
- /* Get the beginning of the next option. */
- if (get_opt_end (&result, *tptrp, endp) != 0)
- return -1;
- }
-
- /* We know where the next option starts. */
- *tptrp = (uint8_t *) result;
-
- /* Check the option is fully represented in the message. */
- return get_opt_end (&result, result, endp);
-}
-
-
-/* RFC 2292, 6.3.6
-
- This function is similar to the previously described
- inet6_option_next() function, except this function lets the caller
- specify the option type to be searched for, instead of always
- returning the next option in the ancillary data object. cmsg is a
- pointer to cmsghdr structure of which cmsg_level equals IPPROTO_IPV6
- and cmsg_type equals either IPV6_HOPOPTS or IPV6_DSTOPTS. */
-int
-inet6_option_find (cmsg, tptrp, type)
- const struct cmsghdr *cmsg;
- uint8_t **tptrp;
- int type;
-{
- /* Make sure it is an option of the right type. */
- if (cmsg->cmsg_level != IPPROTO_IPV6
- || (cmsg->cmsg_type != IPV6_HOPOPTS && cmsg->cmsg_type != IPV6_DSTOPTS))
- return -1;
-
- /* Pointer to the extension header. We only compute the address, we
- don't access anything yet. */
- const struct ip6_ext *ip6e = (const struct ip6_ext *) CMSG_DATA (cmsg);
-
- /* Make sure the message is long enough. */
- if (cmsg->cmsg_len < CMSG_LEN (sizeof (struct ip6_ext))
- /* Now we can access the extension header. */
- || cmsg->cmsg_len < CMSG_LEN ((ip6e->ip6e_len + 1) * 8))
- /* Too small. */
- return -1;
-
- /* Determine the address of the byte past the message. */
- const uint8_t *endp = CMSG_DATA (cmsg) + (ip6e->ip6e_len + 1) * 8;
-
- const uint8_t *next;
- if (tptrp == NULL)
- /* This is the first call, return the first option if there is one. */
- next = (const uint8_t *) (ip6e + 1);
- else
- {
- /* Make sure *TPTRP points to a beginning of a new option in
- the message. The upper limit is checked in get_opt_end. */
- if (*tptrp < (const uint8_t *) (ip6e + 1))
- return -1;
-
- /* Get the beginning of the next option. */
- if (get_opt_end (&next, *tptrp, endp) != 0)
- return -1;
- }
-
- /* Now search for the appropriate typed entry. */
- const uint8_t *result;
- do
- {
- result = next;
-
- /* Get the end of this entry. */
- if (get_opt_end (&next, result, endp) != 0)
- return -1;
- }
- while (*result != type);
-
- /* We know where the next option starts. */
- *tptrp = (uint8_t *) result;
-
- /* Success. */
- return 0;
-}
diff --git a/newlib/libc/sys/linux/net/inet6_option_space.3 b/newlib/libc/sys/linux/net/inet6_option_space.3
new file mode 100644
index 000000000..328c70f48
--- /dev/null
+++ b/newlib/libc/sys/linux/net/inet6_option_space.3
@@ -0,0 +1,445 @@
+.\" Copyright (c) 1983, 1987, 1991, 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.
+.\"
+.\" $Id$
+.\" $FreeBSD: src/lib/libc/net/inet6_option_space.3,v 1.8 2001/10/01 16:08:55 ru Exp $
+.\"
+.Dd December 10, 1999
+.Dt INET6_OPTION_SPACE 3
+.Os
+.\"
+.Sh NAME
+.Nm inet6_option_space ,
+.Nm inet6_option_init ,
+.Nm inet6_option_append ,
+.Nm inet6_option_alloc ,
+.Nm inet6_option_next ,
+.Nm inet6_option_find
+.Nd IPv6 Hop-by-Hop and Destination Options manipulation
+.\"
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.Ft "int"
+.Fn inet6_option_space "int nbytes"
+.Ft "int"
+.Fn inet6_option_init "void *bp" "struct cmsghdr **cmsgp" "int type"
+.Ft "int"
+.Fn inet6_option_append "struct cmsghdr *cmsg" "const u_int8_t *typep" "int multx" "int plusy"
+.Ft "u_int8_t *"
+.Fn inet6_option_alloc "struct cmsghdr *cmsg" "int datalen" "int multx" "int plusy"
+.Ft "int"
+.Fn inet6_option_next "const struct cmsghdr *cmsg" "u_int8_t **tptrp"
+.Ft "int"
+.Fn inet6_option_find "const struct cmsghdr *cmsg" "u_int8_t **tptrp" "int type"
+.\"
+.Sh DESCRIPTION
+.\"
+Building and parsing the Hop-by-Hop and Destination options is
+complicated due to alignment constranints, padding and
+ancillary data manipulation.
+RFC2292 defines a set of functions to help the application.
+The function prototypes for
+these functions are all in the
+.Aq Li netinet/in.h
+header.
+.\"
+.Ss inet6_option_space
+.Fn inet6_option_space
+returns the number of bytes required to hold an option when it is stored as
+ancillary data, including the
+.Li cmsghdr
+structure at the beginning,
+and any padding at the end
+(to make its size a multiple of 8 bytes).
+The argument is the size of the structure defining the option,
+which must include any pad bytes at the beginning
+(the value
+.Li y
+in the alignment term
+.Dq Li "xn + y" ) ,
+the type byte, the length byte, and the option data.
+.Pp
+Note: If multiple options are stored in a single ancillary data
+object, which is the recommended technique, this function
+overestimates the amount of space required by the size of
+.Li N-1
+.Li cmsghdr
+structures,
+where
+.Li N
+is the number of options to be stored in the object.
+This is of little consequence, since it is assumed that most
+Hop-by-Hop option headers and Destination option headers carry only
+one option
+(appendix B of [RFC-2460]).
+.\"
+.Ss inet6_option_init
+.Fn inet6_option_init
+is called once per ancillary data object that will
+contain either Hop-by-Hop or Destination options.
+It returns
+.Li 0
+on success or
+.Li -1
+on an error.
+.Pp
+.Fa bp
+is a pointer to previously allocated space that will contain the
+ancillary data object.
+It must be large enough to contain all the
+individual options to be added by later calls to
+.Fn inet6_option_append
+and
+.Fn inet6_option_alloc .
+.Pp
+.Fa cmsgp
+is a pointer to a pointer to a
+.Li cmsghdr
+structure.
+.Fa *cmsgp
+is initialized by this function to point to the
+.Li cmsghdr
+structure constructed by this function in the buffer pointed to by
+.Fa bp .
+.Pp
+.Fa type
+is either
+.Dv IPV6_HOPOPTS
+or
+.Dv IPV6_DSTOPTS .
+This
+.Fa type
+is stored in the
+.Li cmsg_type
+member of the
+.Li cmsghdr
+structure pointed to by
+.Fa *cmsgp .
+.\"
+.Ss inet6_option_append
+This function appends a Hop-by-Hop option or a Destination option
+into an ancillary data object that has been initialized by
+.Fn inet6_option_init .
+This function returns
+.Li 0
+if it succeeds or
+.Li -1
+on an error.
+.Pp
+.Fa cmsg
+is a pointer to the
+.Li cmsghdr
+structure that must have been
+initialized by
+.Fn inet6_option_init .
+.Pp
+.Fa typep
+is a pointer to the 8-bit option type.
+It is assumed that this
+field is immediately followed by the 8-bit option data length field,
+which is then followed immediately by the option data.
+The caller
+initializes these three fields
+(the type-length-value, or TLV)
+before calling this function.
+.Pp
+The option type must have a value from
+.Li 2
+to
+.Li 255 ,
+inclusive.
+.Li ( 0
+and
+.Li 1
+are reserved for the
+.Li Pad1
+and
+.Li PadN
+options, respectively.)
+.Pp
+The option data length must have a value between
+.Li 0
+and
+.Li 255 ,
+inclusive, and is the length of the option data that follows.
+.Pp
+.Fa multx
+is the value
+.Li x
+in the alignment term
+.Dq Li xn + y .
+It must have a value of
+.Li 1 ,
+.Li 2 ,
+.Li 4 ,
+or
+.Li 8 .
+.Pp
+.Fa plusy
+is the value
+.Li y
+in the alignment term
+.Dq Li xn + y .
+It must have a value between
+.Li 0
+and
+.Li 7 ,
+inclusive.
+.\"
+.Ss inet6_option_alloc
+This function appends a Hop-by-Hop option or a Destination option
+into an ancillary data object that has been initialized by
+.Fn inet6_option_init .
+This function returns a pointer to the 8-bit
+option type field that starts the option on success, or
+.Dv NULL
+on an error.
+.Pp
+The difference between this function and
+.Fn inet6_option_append
+is that the latter copies the contents of a previously built option into
+the ancillary data object while the current function returns a
+pointer to the space in the data object where the option's TLV must
+then be built by the caller.
+.Pp
+.Fa cmsg
+is a pointer to the
+.Li cmsghdr
+structure that must have been
+initialized by
+.Fn inet6_option_init .
+.Pp
+.Fa datalen
+is the value of the option data length byte for this option.
+This value is required as an argument to allow the function to
+determine if padding must be appended at the end of the option.
+(The
+.Fn inet6_option_append
+function does not need a data length argument
+since the option data length must already be stored by the caller.)
+.Pp
+.Fa multx
+is the value
+.Li x
+in the alignment term
+.Dq Li xn + y .
+It must have a value of
+.Li 1 ,
+.Li 2 ,
+.Li 4 ,
+or
+.Li 8 .
+.Pp
+.Fa plusy
+is the value
+.Li y
+in the alignment term
+.Dq Li xn + y .
+It must have a value between
+.Li 0
+and
+.Li 7 ,
+inclusive.
+.\"
+.Ss inet6_option_next
+This function processes the next Hop-by-Hop option or Destination
+option in an ancillary data object.
+If another option remains to be
+processed, the return value of the function is
+.Li 0
+and
+.Fa *tptrp
+points to
+the 8-bit option type field
+(which is followed by the 8-bit option
+data length, followed by the option data).
+If no more options remain
+to be processed, the return value is
+.Li -1
+and
+.Fa *tptrp
+is
+.Dv NULL .
+If an error occurs, the return value is
+.Li -1
+and
+.Fa *tptrp
+is not
+.Dv NULL .
+.Pp
+.Fa cmsg
+is a pointer to
+.Li cmsghdr
+structure of which
+.Li cmsg_level
+equals
+.Dv IPPROTO_IPV6
+and
+.Li cmsg_type
+equals either
+.Dv IPV6_HOPOPTS
+or
+.Dv IPV6_DSTOPTS .
+.Pp
+.Fa tptrp
+is a pointer to a pointer to an 8-bit byte and
+.Fa *tptrp
+is used
+by the function to remember its place in the ancillary data object
+each time the function is called.
+The first time this function is
+called for a given ancillary data object,
+.Fa *tptrp
+must be set to
+.Dv NULL .
+.Pp
+Each time this function returns success,
+.Fa *tptrp
+points to the 8-bit
+option type field for the next option to be processed.
+.\"
+.Ss inet6_option_find
+This function is similar to the previously described
+.Fn inet6_option_next
+function, except this function lets the caller
+specify the option type to be searched for, instead of always
+returning the next option in the ancillary data object.
+.Fa cmsg
+is a
+pointer to
+.Li cmsghdr
+structure of which
+.Li cmsg_level
+equals
+.Dv IPPROTO_IPV6
+and
+.Li cmsg_type
+equals either
+.Dv IPV6_HOPOPTS
+or
+.Dv IPV6_DSTOPTS .
+.Pp
+.Fa tptrp
+is a pointer to a pointer to an 8-bit byte and
+.Fa *tptrp
+is used
+by the function to remember its place in the ancillary data object
+each time the function is called.
+The first time this function is
+called for a given ancillary data object,
+.Fa *tptrp
+must be set to
+.Dv NULL .
+.Pa
+This function starts searching for an option of the specified type
+beginning after the value of
+.Fa *tptrp .
+If an option of the specified
+type is located, this function returns
+.Li 0
+and
+.Fa *tptrp
+points to the 8-
+bit option type field for the option of the specified type.
+If an
+option of the specified type is not located, the return value is
+.Li -1
+and
+.Fa *tptrp
+is
+.Dv NULL .
+If an error occurs, the return value is
+.Li -1
+and
+.Fa *tptrp
+is not
+.Dv NULL .
+.\"
+.Sh DIAGNOSTICS
+.Fn inet6_option_init
+and
+.Fn inet6_option_append
+return
+.Li 0
+on success or
+.Li -1
+on an error.
+.Pp
+.Fn inet6_option_alloc
+returns
+.Dv NULL
+on an error.
+.Pp
+On errors,
+.Fn inet6_option_next
+and
+.Fn inet6_option_find
+return
+.Li -1
+setting
+.Fa *tptrp
+to non
+.Dv NULL
+value.
+.\"
+.Sh EXAMPLES
+RFC2292 gives comprehensive examples in chapter 6.
+.\"
+.Sh SEE ALSO
+.Rs
+.%A W. Stevens
+.%A M. Thomas
+.%T "Advanced Sockets API for IPv6"
+.%N RFC2292
+.%D February 1998
+.Re
+.Rs
+.%A S. Deering
+.%A R. Hinden
+.%T "Internet Protocol, Version 6 (IPv6) Specification"
+.%N RFC2460
+.%D December 1998
+.Re
+.\"
+.Sh HISTORY
+The implementation first appeared in KAME advanced networking kit.
+.\"
+.Sh STANDARDS
+The functions
+are documented in
+.Dq Advanced Sockets API for IPv6
+(RFC2292).
+.\"
+.Sh BUGS
+The text was shamelessly copied from RFC2292.
diff --git a/newlib/libc/sys/linux/net/inet6_rthdr_space.3 b/newlib/libc/sys/linux/net/inet6_rthdr_space.3
new file mode 100644
index 000000000..d2c575dca
--- /dev/null
+++ b/newlib/libc/sys/linux/net/inet6_rthdr_space.3
@@ -0,0 +1,323 @@
+.\" Copyright (c) 1983, 1987, 1991, 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.
+.\"
+.\" $Id$
+.\" $FreeBSD: src/lib/libc/net/inet6_rthdr_space.3,v 1.8 2001/10/01 16:08:55 ru Exp $
+.\"
+.Dd December 10, 1999
+.Dt INET6_RTHDR_SPACE 3
+.Os
+.\"
+.Sh NAME
+.Nm inet6_rthdr_space ,
+.Nm inet6_rthdr_init ,
+.Nm inet6_rthdr_add ,
+.Nm inet6_rthdr_lasthop ,
+.Nm inet6_rthdr_reverse ,
+.Nm inet6_rthdr_segments ,
+.Nm inet6_rthdr_getaddr ,
+.Nm inet6_rthdr_getflags
+.Nd IPv6 Routing Header Options manipulation
+.\"
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.Ft size_t
+.Fn inet6_rthdr_space "int type" "int segments"
+.Ft "struct cmsghdr *"
+.Fn inet6_rthdr_init "void *bp" "int type"
+.Ft int
+.Fn inet6_rthdr_add "struct cmsghdr *cmsg" "const struct in6_addr *addr" "unsigned int flags"
+.Ft int
+.Fn inet6_rthdr_lasthop "struct cmsghdr *cmsg" "unsigned int flags"
+.Ft int
+.Fn inet6_rthdr_reverse "const struct cmsghdr *in" "struct cmsghdr *out"
+.Ft int
+.Fn inet6_rthdr_segments "const struct cmsghdr *cmsg"
+.Ft "struct in6_addr *"
+.Fn inet6_rthdr_getaddr "struct cmsghdr *cmsg" "int index"
+.Ft int
+.Fn inet6_rthdr_getflags "const struct cmsghdr *cmsg" "int index"
+.\"
+.Sh DESCRIPTION
+RFC2292 IPv6 advanced API defines eight
+functions that the application calls to build and examine a Routing
+header. Four functions build a Routing header:
+.Bl -hang
+.It Fn inet6_rthdr_space
+return #bytes required for ancillary data
+.It Fn inet6_rthdr_init
+initialize ancillary data for Routing header
+.It Fn inet6_rthdr_add
+add IPv6 address & flags to Routing header
+.It Fn inet6_rthdr_lasthop
+specify the flags for the final hop
+.El
+.Pp
+Four functions deal with a returned Routing header:
+.Bl -hang
+.It Fn inet6_rthdr_reverse
+reverse a Routing header
+.It Fn inet6_rthdr_segments
+return #segments in a Routing header
+.It Fn inet6_rthdr_getaddr
+fetch one address from a Routing header
+.It Fn inet6_rthdr_getflags
+fetch one flag from a Routing header
+.El
+.Pp
+The function prototypes for these functions are all in the
+.Aq Li netinet/in.h
+header.
+.\"
+.Ss inet6_rthdr_space
+This function returns the number of bytes required to hold a Routing
+header of the specified
+.Fa type
+containing the specified number of
+.Fa segments
+(addresses).
+For an IPv6 Type 0 Routing header, the number
+of segments must be between 1 and 23, inclusive. The return value
+includes the size of the cmsghdr structure that precedes the Routing
+header, and any required padding.
+.Pp
+If the return value is 0, then either the type of the Routing header
+is not supported by this implementation or the number of segments is
+invalid for this type of Routing header.
+.Pp
+Note: This function returns the size but does not allocate the space
+required for the ancillary data.
+This allows an application to
+allocate a larger buffer, if other ancillary data objects are
+desired, since all the ancillary data objects must be specified to
+.Xr sendmsg 2
+as a single
+.Li msg_control
+buffer.
+.\"
+.Ss inet6_rthdr_init
+This function initializes the buffer pointed to by
+.Fa bp
+to contain a
+.Li cmsghdr
+structure followed by a Routing header of the specified
+.Fa type .
+The
+.Li cmsg_len
+member of the
+.Li cmsghdr
+structure is initialized to the
+size of the structure plus the amount of space required by the
+Routing header.
+The
+.Li cmsg_level
+and
+.Li cmsg_type
+members are also initialized as required.
+.Pp
+The caller must allocate the buffer and its size can be determined by
+calling
+.Fn inet6_rthdr_space .
+.Pp
+Upon success the return value is the pointer to the
+.Li cmsghdr
+structure, and this is then used as the first argument to the next
+two functions.
+Upon an error the return value is
+.Dv NULL .
+.\"
+.Ss inet6_rthdr_add
+This function adds the address pointed to by
+.Fa addr
+to the end of the
+Routing header being constructed and sets the type of this hop to the
+value of
+.Fa flags .
+For an IPv6 Type 0 Routing header,
+.Fa flags
+must be
+either
+.Dv IPV6_RTHDR_LOOSE
+or
+.Dv IPV6_RTHDR_STRICT .
+.Pp
+If successful, the
+.Li cmsg_len
+member of the
+.Li cmsghdr
+structure is
+updated to account for the new address in the Routing header and the
+return value of the function is 0.
+Upon an error the return value of
+the function is -1.
+.\"
+.Ss inet6_rthdr_lasthop
+This function specifies the Strict/Loose flag for the final hop of a
+Routing header.
+For an IPv6 Type 0 Routing header,
+.Fa flags
+must be either
+.Dv IPV6_RTHDR_LOOSE
+or
+.Dv IPV6_RTHDR_STRICT .
+.Pp
+The return value of the function is 0 upon success, or -1 upon an error.
+.Pp
+Notice that a Routing header specifying
+.Li N
+intermediate nodes requires
+.Li N+1
+Strict/Loose flags.
+This requires
+.Li N
+calls to
+.Fn inet6_rthdr_add
+followed by one call to
+.Fn inet6_rthdr_lasthop .
+.\"
+.Ss inet6_rthdr_reverse
+This function is not yet implemented.
+When implemented, this should behave as follows.
+.Pp
+This function takes a Routing header that was received as ancillary
+data
+(pointed to by the first argument,
+.Fa in )
+and writes a new Routing
+header that sends datagrams along the reverse of that route.
+Both
+arguments are allowed to point to the same buffer
+(that is, the reversal can occur in place).
+.Pp
+The return value of the function is 0 on success, or -1 upon an
+error.
+.\"
+.Ss inet6_rthdr_segments
+This function returns the number of segments
+(addresses)
+contained in
+the Routing header described by
+.Fa cmsg .
+On success the return value is
+between 1 and 23, inclusive.
+The return value of the function is -1 upon an error.
+.\"
+.Ss inet6_rthdr_getaddr
+This function returns a pointer to the IPv6 address specified by
+.Fa index
+(which must have a value between 1 and the value returned by
+.Fn inet6_rthdr_segments )
+in the Routing header described by
+.Fa cmsg .
+An
+application should first call
+.Fn inet6_rthdr_segments
+to obtain the number of segments in the Routing header.
+.Pp
+Upon an error the return value of the function is
+.Dv NULL .
+.\"
+.Ss inet6_rthdr_getflags
+This function returns the flags value specified by
+.Fa index
+(which must
+have a value between 0 and the value returned by
+.Fn inet6_rthdr_segments )
+in the Routing header described by
+.Fa cmsg .
+For an IPv6 Type 0 Routing header the return value will be either
+.Dv IPV6_RTHDR_LOOSE
+or
+.Dv IPV6_RTHDR_STRICT .
+.Pp
+Upon an error the return value of the function is -1.
+.Pp
+Note: Addresses are indexed starting at 1, and flags starting at 0,
+to maintain consistency with the terminology and figures in RFC2460.
+.\"
+.Sh DIAGNOSTICS
+.Fn inet6_rthdr_space
+returns 0 on errors.
+.Pp
+.Fn inet6_rthdr_add ,
+.Fn inet6_rthdr_lasthop
+and
+.Fn inet6_rthdr_reverse
+return 0 on success, and returns -1 on error.
+.Pp
+.Fn inet6_rthdr_init
+and
+.Fn inet6_rthdr_getaddr
+return
+.Dv NULL
+on error.
+.Pp
+.Fn inet6_rthdr_segments
+and
+.Fn inet6_rthdr_getflags
+return -1 on error.
+.\"
+.Sh EXAMPLES
+RFC2292 gives comprehensive examples in chapter 8.
+.\"
+.Sh SEE ALSO
+.Rs
+.%A W. Stevens
+.%A M. Thomas
+.%T "Advanced Sockets API for IPv6"
+.%N RFC2292
+.%D February 1998
+.Re
+.Rs
+.%A S. Deering
+.%A R. Hinden
+.%T "Internet Protocol, Version 6 (IPv6) Specification"
+.%N RFC2460
+.%D December 1998
+.Re
+.\"
+.Sh HISTORY
+The implementation first appeared in KAME advanced networking kit.
+.\"
+.Sh STANDARDS
+The functions
+are documented in
+.Dq Advanced Sockets API for IPv6
+(RFC2292).
+.\"
+.Sh BUGS
+The text was shamelessly copied from RFC2292.
+.Pp
+.Fn inet6_rthdr_reverse
+is not implemented yet.
diff --git a/newlib/libc/sys/linux/net/inet_lnaof.c b/newlib/libc/sys/linux/net/inet_lnaof.c
index 0e115a442..c6c999dd1 100644
--- a/newlib/libc/sys/linux/net/inet_lnaof.c
+++ b/newlib/libc/sys/linux/net/inet_lnaof.c
@@ -10,6 +10,10 @@
* 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.
@@ -30,6 +34,9 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
#include <sys/param.h>
#include <netinet/in.h>
@@ -44,7 +51,7 @@ in_addr_t
inet_lnaof(in)
struct in_addr in;
{
- register u_int32_t i = ntohl(in.s_addr);
+ in_addr_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return ((i)&IN_CLASSA_HOST);
@@ -53,3 +60,10 @@ inet_lnaof(in)
else
return ((i)&IN_CLASSC_HOST);
}
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <arpa/inet.h>.
+ */
+#undef inet_lnaof
+__weak_reference(__inet_lnaof, inet_lnaof);
diff --git a/newlib/libc/sys/linux/net/inet_mkadr.c b/newlib/libc/sys/linux/net/inet_makeaddr.c
index 26d54f244..339b2d5a7 100644
--- a/newlib/libc/sys/linux/net/inet_mkadr.c
+++ b/newlib/libc/sys/linux/net/inet_makeaddr.c
@@ -10,6 +10,10 @@
* 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.
@@ -30,11 +34,13 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include "libc-symbols.h"
/*
* Formulate an Internet address from network + host. Used in
@@ -44,17 +50,23 @@ struct in_addr
inet_makeaddr(net, host)
in_addr_t net, host;
{
- struct in_addr in;
+ in_addr_t addr;
if (net < 128)
- in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
+ addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
else if (net < 65536)
- in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
+ addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
else if (net < 16777216L)
- in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
+ addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
else
- in.s_addr = net | host;
- in.s_addr = htonl(in.s_addr);
- return in;
+ addr = net | host;
+ addr = htonl(addr);
+ return (*(struct in_addr *)&addr);
}
-libc_hidden_def (inet_makeaddr)
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <arpa/inet.h>.
+ */
+#undef inet_makeaddr
+__weak_reference(__inet_makeaddr, inet_makeaddr);
diff --git a/newlib/libc/sys/linux/net/inet_net.3 b/newlib/libc/sys/linux/net/inet_net.3
new file mode 100644
index 000000000..1d43bcc1d
--- /dev/null
+++ b/newlib/libc/sys/linux/net/inet_net.3
@@ -0,0 +1,157 @@
+.\" $NetBSD: inet_net.3,v 1.4 1999/03/22 19:44:52 garbled Exp $
+.\"
+.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" 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 NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.\" $FreeBSD: src/lib/libc/net/inet_net.3,v 1.1 2001/08/31 10:54:44 ru Exp $
+.\"
+.Dd June 18, 1997
+.Dt INET_NET 3
+.Os
+.Sh NAME
+.Nm inet_net_ntop ,
+.Nm inet_net_pton
+.Nd Internet network number manipulation routines
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In netinet/in.h
+.In arpa/inet.h
+.Ft char *
+.Fn inet_net_ntop "int af" "const void *src" "int bits" "char *dst" "size_t size"
+.Ft int
+.Fn inet_net_pton "int af" "const char *src" "void *dst" "size_t size"
+.Sh DESCRIPTION
+The
+.Fn inet_net_ntop
+function converts an Internet network number from network format (usually a
+.Vt "struct in_addr"
+or some other binary form, in network byte order) to CIDR presentation format
+(suitable for external display purposes).
+.Fa bits
+is the number of bits in
+.Fa src
+that are the network number.
+It returns
+.Dv NULL
+if a system error occurs (in which case,
+.Va errno
+will have been set), or it returns a pointer to the destination string.
+.Pp
+The
+.Fn inet_net_pton
+function converts a presentation format Internet network number (that is,
+printable form as held in a character string) to network format (usually a
+.Vt "struct in_addr"
+or some other internal binary representation, in network byte order).
+It returns the number of bits (either computed based on the class, or
+specified with /CIDR), or \-1 if a failure occurred
+(in which case
+.Va errno
+will have been set.
+It will be set to
+.Er ENOENT
+if the Internet network number was not valid).
+.Pp
+The only value for
+.Fa af
+currently supported is
+.Dv AF_INET .
+.Fa size
+is the size of the result buffer
+.Fa dst .
+.Pp
+.Sh NETWORK NUMBERS (IP VERSION 4)
+Internet network numbers may be specified in one of the following forms:
+.Bd -literal -offset indent
+a.b.c.d/bits
+a.b.c.d
+a.b.c
+a.b
+a
+.Ed
+.Pp
+When four parts are specified, each is interpreted
+as a byte of data and assigned, from left to right,
+to the four bytes of an Internet network number.
+Note
+that when an Internet network number is viewed as a 32-bit
+integer quantity on a system that uses little-endian
+byte order (such as the
+.Tn Intel 386 , 486 ,
+and
+.Tn Pentium
+processors) the bytes referred to above appear as
+.Dq Li d.c.b.a .
+That is, little-endian bytes are ordered from right to left.
+.Pp
+When a three part number is specified, the last
+part is interpreted as a 16-bit quantity and placed
+in the rightmost two bytes of the Internet network number.
+This makes the three part number format convenient
+for specifying Class B network numbers as
+.Dq Li 128.net.host .
+.Pp
+When a two part number is supplied, the last part
+is interpreted as a 24-bit quantity and placed in
+the rightmost three bytes of the Internet network number.
+This makes the two part number format convenient
+for specifying Class A network numbers as
+.Dq Li net.host .
+.Pp
+When only one part is given, the value is stored
+directly in the Internet network number without any byte
+rearrangement.
+.Pp
+All numbers supplied as
+.Dq parts
+in a
+.Ql \&.
+notation
+may be decimal, octal, or hexadecimal, as specified
+in the C language (i.e., a leading 0x or 0X implies
+hexadecimal; otherwise, a leading 0 implies octal;
+otherwise, the number is interpreted as decimal).
+.Sh SEE ALSO
+.Xr byteorder 3 ,
+.Xr inet 3 ,
+.Xr networks 5
+.Sh HISTORY
+The
+.Fn inet_net_ntop
+and
+.Fn inet_net_pton
+functions appeared in BIND 4.9.4.
diff --git a/newlib/libc/sys/linux/net/inet_netof.c b/newlib/libc/sys/linux/net/inet_netof.c
index 3035f3402..e2e84d340 100644
--- a/newlib/libc/sys/linux/net/inet_netof.c
+++ b/newlib/libc/sys/linux/net/inet_netof.c
@@ -10,6 +10,10 @@
* 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.
@@ -30,11 +34,13 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include "libc-symbols.h"
/*
* Return the network number from an internet
@@ -44,7 +50,7 @@ in_addr_t
inet_netof(in)
struct in_addr in;
{
- register u_int32_t i = ntohl(in.s_addr);
+ in_addr_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return (((i)&IN_CLASSA_NET) >> IN_CLASSA_NSHIFT);
@@ -53,4 +59,10 @@ inet_netof(in)
else
return (((i)&IN_CLASSC_NET) >> IN_CLASSC_NSHIFT);
}
-libc_hidden_def (inet_netof)
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <arpa/inet.h>.
+ */
+#undef inet_netof
+__weak_reference(__inet_netof, inet_netof);
diff --git a/newlib/libc/sys/linux/net/inet_net.c b/newlib/libc/sys/linux/net/inet_network.c
index e9331c592..caf1d7869 100644
--- a/newlib/libc/sys/linux/net/inet_net.c
+++ b/newlib/libc/sys/linux/net/inet_network.c
@@ -10,6 +10,10 @@
* 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.
@@ -30,6 +34,8 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <netinet/in.h>
@@ -41,49 +47,41 @@ static char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
* The library routines call this routine to interpret
* network numbers.
*/
-u_int32_t
+in_addr_t
inet_network(cp)
- register const char *cp;
+ const char *cp;
{
- register u_int32_t val, base, n, i;
- register char c;
- u_int32_t parts[4], *pp = parts;
- int digit;
+ in_addr_t val, base, n;
+ char c;
+ in_addr_t parts[4], *pp = parts;
+ int i;
again:
- val = 0; base = 10; digit = 0;
+ val = 0; base = 10;
if (*cp == '0')
- digit = 1, base = 8, cp++;
+ base = 8, cp++;
if (*cp == 'x' || *cp == 'X')
base = 16, cp++;
while ((c = *cp) != 0) {
- if (isdigit(c)) {
- if (base == 8 && (c == '8' || c == '9'))
- return (INADDR_NONE);
+ if (isdigit((unsigned char)c)) {
val = (val * base) + (c - '0');
cp++;
- digit = 1;
continue;
}
- if (base == 16 && isxdigit(c)) {
- val = (val << 4) + (tolower (c) + 10 - 'a');
+ if (base == 16 && isxdigit((unsigned char)c)) {
+ val = (val << 4) + (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
cp++;
- digit = 1;
continue;
}
break;
}
- if (!digit)
- return (INADDR_NONE);
- if (pp >= parts + 4 || val > 0xff)
- return (INADDR_NONE);
if (*cp == '.') {
+ if (pp >= parts + 3)
+ return (INADDR_NONE);
*pp++ = val, cp++;
goto again;
}
- if (*cp && !isspace(*cp))
- return (INADDR_NONE);
- if (pp >= parts + 4 || val > 0xff)
+ if (*cp && !isspace((unsigned char)*cp))
return (INADDR_NONE);
*pp++ = val;
n = pp - parts;
@@ -93,3 +91,10 @@ again:
}
return (val);
}
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <arpa/inet.h>.
+ */
+#undef inet_network
+__weak_reference(__inet_network, inet_network);
diff --git a/newlib/libc/sys/linux/net/inet_ntoa.c b/newlib/libc/sys/linux/net/inet_ntoa.c
index b0b7a1535..dedc4768d 100644
--- a/newlib/libc/sys/linux/net/inet_ntoa.c
+++ b/newlib/libc/sys/linux/net/inet_ntoa.c
@@ -1,98 +1,67 @@
-/* Convert Inet number to ASCII representation.
- Copyright (C) 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdio.h>
-#include <stdlib.h>
+/*
+ * Copyright (c) 1983, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
#include <arpa/inet.h>
-#include <bits/libc-lock.h>
-
-/* The interface of this function is completely stupid, it requires a
- static buffer. We relax this a bit in that we allow at least one
- buffer for each thread. */
-
-/* This is the key for the thread specific memory. */
-static __libc_key_t key;
-
-/* If nonzero the key allocation failed and we should better use a
- static buffer than fail. */
-static char local_buf[18];
-static char *static_buf;
-
-/* Destructor for the thread-specific data. */
-static void init (void);
-static void free_key_mem (void *mem);
-
+#include <stdio.h>
+#include <string.h>
+/*
+ * Convert network-format internet address
+ * to base 256 d.d.d.d representation.
+ */
char *
-inet_ntoa (struct in_addr in)
+inet_ntoa(in)
+ struct in_addr in;
{
- __libc_once_define (static, once);
- char *buffer;
- unsigned char *bytes;
+ static char ret[18];
- /* If we have not yet initialized the buffer do it now. */
- __libc_once (once, init);
-
- if (static_buf != NULL)
- buffer = static_buf;
- else
- {
- /* We don't use the static buffer and so we have a key. Use it
- to get the thread-specific buffer. */
- buffer = __libc_getspecific (key);
- if (buffer == NULL)
- {
- /* No buffer allocated so far. */
- buffer = malloc (18);
- if (buffer == NULL)
- /* No more memory available. We use the static buffer. */
- buffer = local_buf;
- else
- __libc_setspecific (key, buffer);
- }
- }
-
- bytes = (unsigned char *) &in;
- snprintf (buffer, 18, "%d.%d.%d.%d",
- bytes[0], bytes[1], bytes[2], bytes[3]);
-
- return buffer;
-}
-
-
-/* Initialize buffer. */
-static void
-init (void)
-{
- if (__libc_key_create (&key, free_key_mem))
- /* Creating the key failed. This means something really went
- wrong. In any case use a static buffer which is better than
- nothing. */
- static_buf = local_buf;
+ strcpy(ret, "[inet_ntoa error]");
+ (void) inet_ntop(AF_INET, &in, ret, sizeof ret);
+ return (ret);
}
-
-/* Free the thread specific data, this is done if a thread terminates. */
-static void
-free_key_mem (void *mem)
-{
- free (mem);
- __libc_setspecific (key, NULL);
-}
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <arpa/inet.h>.
+ */
+#undef inet_ntoa
+__weak_reference(__inet_ntoa, inet_ntoa);
diff --git a/newlib/libc/sys/linux/net/innetgr-stub.c b/newlib/libc/sys/linux/net/innetgr-stub.c
new file mode 100644
index 000000000..690d82e14
--- /dev/null
+++ b/newlib/libc/sys/linux/net/innetgr-stub.c
@@ -0,0 +1,7 @@
+int
+innetgr(const char *netgroup, const char *host, const char *user,
+ const char *domain)
+{
+ return 0;
+}
+
diff --git a/newlib/libc/sys/linux/net/ip6opt.c b/newlib/libc/sys/linux/net/ip6opt.c
new file mode 100644
index 000000000..f3f51d507
--- /dev/null
+++ b/newlib/libc/sys/linux/net/ip6opt.c
@@ -0,0 +1,387 @@
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+
+#include <string.h>
+#include <stdio.h>
+
+static int ip6optlen(u_int8_t *opt, u_int8_t *lim);
+static void inet6_insert_padopt(u_char *p, int len);
+
+/*
+ * This function returns the number of bytes required to hold an option
+ * when it is stored as ancillary data, including the cmsghdr structure
+ * at the beginning, and any padding at the end (to make its size a
+ * multiple of 8 bytes). The argument is the size of the structure
+ * defining the option, which must include any pad bytes at the
+ * beginning (the value y in the alignment term "xn + y"), the type
+ * byte, the length byte, and the option data.
+ */
+int
+inet6_option_space(nbytes)
+ int nbytes;
+{
+ nbytes += 2; /* we need space for nxt-hdr and length fields */
+ return(CMSG_SPACE((nbytes + 7) & ~7));
+}
+
+/*
+ * This function is called once per ancillary data object that will
+ * contain either Hop-by-Hop or Destination options. It returns 0 on
+ * success or -1 on an error.
+ */
+int
+inet6_option_init(bp, cmsgp, type)
+ void *bp;
+ struct cmsghdr **cmsgp;
+ int type;
+{
+ struct cmsghdr *ch = (struct cmsghdr *)bp;
+
+ /* argument validation */
+ if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS)
+ return(-1);
+
+ ch->cmsg_level = IPPROTO_IPV6;
+ ch->cmsg_type = type;
+ ch->cmsg_len = CMSG_LEN(0);
+
+ *cmsgp = ch;
+ return(0);
+}
+
+/*
+ * This function appends a Hop-by-Hop option or a Destination option
+ * into an ancillary data object that has been initialized by
+ * inet6_option_init(). This function returns 0 if it succeeds or -1 on
+ * an error.
+ * multx is the value x in the alignment term "xn + y" described
+ * earlier. It must have a value of 1, 2, 4, or 8.
+ * plusy is the value y in the alignment term "xn + y" described
+ * earlier. It must have a value between 0 and 7, inclusive.
+ */
+int
+inet6_option_append(cmsg, typep, multx, plusy)
+ struct cmsghdr *cmsg;
+ const u_int8_t *typep;
+ int multx;
+ int plusy;
+{
+ int padlen, optlen, off;
+ u_char *bp = (u_char *)cmsg + cmsg->cmsg_len;
+ struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg);
+
+ /* argument validation */
+ if (multx != 1 && multx != 2 && multx != 4 && multx != 8)
+ return(-1);
+ if (plusy < 0 || plusy > 7)
+ return(-1);
+ if (typep[0] > 255)
+ return(-1);
+
+ /*
+ * If this is the first option, allocate space for the
+ * first 2 bytes(for next header and length fields) of
+ * the option header.
+ */
+ if (bp == (u_char *)eh) {
+ bp += 2;
+ cmsg->cmsg_len += 2;
+ }
+
+ /* calculate pad length before the option. */
+ off = bp - (u_char *)eh;
+ padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) -
+ (off % multx);
+ padlen += plusy;
+ /* insert padding */
+ inet6_insert_padopt(bp, padlen);
+ cmsg->cmsg_len += padlen;
+ bp += padlen;
+
+ /* copy the option */
+ if (typep[0] == IP6OPT_PAD1)
+ optlen = 1;
+ else
+ optlen = typep[1] + 2;
+ memcpy(bp, typep, optlen);
+ bp += optlen;
+ cmsg->cmsg_len += optlen;
+
+ /* calculate pad length after the option and insert the padding */
+ off = bp - (u_char *)eh;
+ padlen = ((off + 7) & ~7) - off;
+ inet6_insert_padopt(bp, padlen);
+ bp += padlen;
+ cmsg->cmsg_len += padlen;
+
+ /* update the length field of the ip6 option header */
+ eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1;
+
+ return(0);
+}
+
+/*
+ * This function appends a Hop-by-Hop option or a Destination option
+ * into an ancillary data object that has been initialized by
+ * inet6_option_init(). This function returns a pointer to the 8-bit
+ * option type field that starts the option on success, or NULL on an
+ * error.
+ * The difference between this function and inet6_option_append() is
+ * that the latter copies the contents of a previously built option into
+ * the ancillary data object while the current function returns a
+ * pointer to the space in the data object where the option's TLV must
+ * then be built by the caller.
+ *
+ */
+u_int8_t *
+inet6_option_alloc(cmsg, datalen, multx, plusy)
+ struct cmsghdr *cmsg;
+ int datalen;
+ int multx;
+ int plusy;
+{
+ int padlen, off;
+ u_int8_t *bp = (u_char *)cmsg + cmsg->cmsg_len;
+ u_int8_t *retval;
+ struct ip6_ext *eh = (struct ip6_ext *)CMSG_DATA(cmsg);
+
+ /* argument validation */
+ if (multx != 1 && multx != 2 && multx != 4 && multx != 8)
+ return(NULL);
+ if (plusy < 0 || plusy > 7)
+ return(NULL);
+
+ /*
+ * If this is the first option, allocate space for the
+ * first 2 bytes(for next header and length fields) of
+ * the option header.
+ */
+ if (bp == (u_char *)eh) {
+ bp += 2;
+ cmsg->cmsg_len += 2;
+ }
+
+ /* calculate pad length before the option. */
+ off = bp - (u_char *)eh;
+ padlen = (((off % multx) + (multx - 1)) & ~(multx - 1)) -
+ (off % multx);
+ padlen += plusy;
+ /* insert padding */
+ inet6_insert_padopt(bp, padlen);
+ cmsg->cmsg_len += padlen;
+ bp += padlen;
+
+ /* keep space to store specified length of data */
+ retval = bp;
+ bp += datalen;
+ cmsg->cmsg_len += datalen;
+
+ /* calculate pad length after the option and insert the padding */
+ off = bp - (u_char *)eh;
+ padlen = ((off + 7) & ~7) - off;
+ inet6_insert_padopt(bp, padlen);
+ bp += padlen;
+ cmsg->cmsg_len += padlen;
+
+ /* update the length field of the ip6 option header */
+ eh->ip6e_len = ((bp - (u_char *)eh) >> 3) - 1;
+
+ return(retval);
+}
+
+/*
+ * This function processes the next Hop-by-Hop option or Destination
+ * option in an ancillary data object. If another option remains to be
+ * processed, the return value of the function is 0 and *tptrp points to
+ * the 8-bit option type field (which is followed by the 8-bit option
+ * data length, followed by the option data). If no more options remain
+ * to be processed, the return value is -1 and *tptrp is NULL. If an
+ * error occurs, the return value is -1 and *tptrp is not NULL.
+ * (RFC 2292, 6.3.5)
+ */
+int
+inet6_option_next(cmsg, tptrp)
+ const struct cmsghdr *cmsg;
+ u_int8_t **tptrp;
+{
+ struct ip6_ext *ip6e;
+ int hdrlen, optlen;
+ u_int8_t *lim;
+
+ if (cmsg->cmsg_level != IPPROTO_IPV6 ||
+ (cmsg->cmsg_type != IPV6_HOPOPTS &&
+ cmsg->cmsg_type != IPV6_DSTOPTS))
+ return(-1);
+
+ /* message length validation */
+ if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext)))
+ return(-1);
+ ip6e = (struct ip6_ext *)CMSG_DATA(cmsg);
+ hdrlen = (ip6e->ip6e_len + 1) << 3;
+ if (cmsg->cmsg_len < CMSG_SPACE(hdrlen))
+ return(-1);
+
+ /*
+ * If the caller does not specify the starting point,
+ * simply return the 1st option.
+ * Otherwise, search the option list for the next option.
+ */
+ lim = (u_int8_t *)ip6e + hdrlen;
+ if (*tptrp == NULL)
+ *tptrp = (u_int8_t *)(ip6e + 1);
+ else {
+ if ((optlen = ip6optlen(*tptrp, lim)) == 0)
+ return(-1);
+
+ *tptrp = *tptrp + optlen;
+ }
+ if (*tptrp >= lim) { /* there is no option */
+ *tptrp = NULL;
+ return(-1);
+ }
+ /*
+ * Finally, checks if the next option is safely stored in the
+ * cmsg data.
+ */
+ if (ip6optlen(*tptrp, lim) == 0)
+ return(-1);
+ else
+ return(0);
+}
+
+/*
+ * This function is similar to the inet6_option_next() function,
+ * except this function lets the caller specify the option type to be
+ * searched for, instead of always returning the next option in the
+ * ancillary data object.
+ * Note: RFC 2292 says the type of tptrp is u_int8_t *, but we think
+ * it's a typo. The variable should be type of u_int8_t **.
+ */
+int
+inet6_option_find(cmsg, tptrp, type)
+ const struct cmsghdr *cmsg;
+ u_int8_t **tptrp;
+ int type;
+{
+ struct ip6_ext *ip6e;
+ int hdrlen, optlen;
+ u_int8_t *optp, *lim;
+
+ if (cmsg->cmsg_level != IPPROTO_IPV6 ||
+ (cmsg->cmsg_type != IPV6_HOPOPTS &&
+ cmsg->cmsg_type != IPV6_DSTOPTS))
+ return(-1);
+
+ /* message length validation */
+ if (cmsg->cmsg_len < CMSG_SPACE(sizeof(struct ip6_ext)))
+ return(-1);
+ ip6e = (struct ip6_ext *)CMSG_DATA(cmsg);
+ hdrlen = (ip6e->ip6e_len + 1) << 3;
+ if (cmsg->cmsg_len < CMSG_SPACE(hdrlen))
+ return(-1);
+
+ /*
+ * If the caller does not specify the starting point,
+ * search from the beginning of the option list.
+ * Otherwise, search from *the next option* of the specified point.
+ */
+ lim = (u_int8_t *)ip6e + hdrlen;
+ if (*tptrp == NULL)
+ *tptrp = (u_int8_t *)(ip6e + 1);
+ else {
+ if ((optlen = ip6optlen(*tptrp, lim)) == 0)
+ return(-1);
+
+ *tptrp = *tptrp + optlen;
+ }
+ for (optp = *tptrp; optp < lim; optp += optlen) {
+ if (*optp == type) {
+ *tptrp = optp;
+ return(0);
+ }
+ if ((optlen = ip6optlen(optp, lim)) == 0)
+ return(-1);
+ }
+
+ /* search failed */
+ *tptrp = NULL;
+ return(-1);
+}
+
+/*
+ * Calculate the length of a given IPv6 option. Also checks
+ * if the option is safely stored in user's buffer according to the
+ * calculated length and the limitation of the buffer.
+ */
+static int
+ip6optlen(opt, lim)
+ u_int8_t *opt, *lim;
+{
+ int optlen;
+
+ if (*opt == IP6OPT_PAD1)
+ optlen = 1;
+ else {
+ /* is there enough space to store type and len? */
+ if (opt + 2 > lim)
+ return(0);
+ optlen = *(opt + 1) + 2;
+ }
+ if (opt + optlen <= lim)
+ return(optlen);
+
+ return(0);
+}
+
+static void
+inet6_insert_padopt(u_char *p, int len)
+{
+ switch(len) {
+ case 0:
+ return;
+ case 1:
+ p[0] = IP6OPT_PAD1;
+ return;
+ default:
+ p[0] = IP6OPT_PADN;
+ p[1] = len - 2;
+ memset(&p[2], 0, len - 2);
+ return;
+ }
+}
diff --git a/newlib/libc/sys/linux/net/iso_addr.3 b/newlib/libc/sys/linux/net/iso_addr.3
new file mode 100644
index 000000000..dc843c315
--- /dev/null
+++ b/newlib/libc/sys/linux/net/iso_addr.3
@@ -0,0 +1,113 @@
+.\" Copyright (c) 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.
+.\"
+.\" @(#)iso_addr.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/iso_addr.3,v 1.7 2001/10/01 16:08:56 ru Exp $
+.\"
+.Dd June 4, 1993
+.Dt ISO_ADDR 3
+.Os
+.Sh NAME
+.Nm iso_addr ,
+.Nm iso_ntoa
+.Nd "elementary network address conversion routines for Open System Interconnection
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In netiso/iso.h
+.Ft struct iso_addr *
+.Fn iso_addr "char *cp"
+.Ft char *
+.Fn iso_ntoa "struct iso_addr *isoa"
+.Sh DESCRIPTION
+The routine
+.Fn iso_addr
+interprets character strings representing
+.Tn OSI
+addresses, returning binary information suitable
+for use in system calls.
+The routine
+.Fn iso_ntoa
+takes
+.Tn OSI
+addresses and returns
+.Tn ASCII
+strings representing NSAPs (network service
+access points) in a
+notation inverse to that accepted by
+.Fn iso_addr .
+.Pp
+Unfortunately, no universal standard exists for representing
+.Tn OSI
+network addresses.
+.Pp
+The format employed by
+.Fn iso_addr
+is a sequence of hexadecimal
+.Dq digits
+(optionally separated by periods),
+of the form:
+.Bd -ragged -offset indent
+<hex digits>.<hex digits>.<hex digits>
+.Ed
+.Pp
+Each pair of hexadecimal digits represents a byte
+with the leading digit indicating the higher-ordered bits.
+A period following an even number of bytes has no
+effect (but may be used to increase legibility).
+A period following an odd number of bytes has the
+effect of causing the byte of address being translated
+to have its higher order bits filled with zeros.
+.Sh RETURN VALUES
+.Fn iso_ntoa
+always returns a null terminated string.
+.Fn iso_addr
+always returns a pointer to a struct iso_addr.
+(See
+.Sx BUGS . )
+.Sh SEE ALSO
+.Xr iso 4
+.Sh HISTORY
+The
+.Fn iso_addr
+and
+.Fn iso_ntoa
+functions appeared in
+.Bx 4.3 Reno .
+.Sh BUGS
+The returned values
+reside in a static memory area.
+.Pp
+The function
+.Fn iso_addr
+should diagnose improperly formed input, and there should be an unambiguous
+way to recognize this.
diff --git a/newlib/libc/sys/linux/net/iso_addr.c b/newlib/libc/sys/linux/net/iso_addr.c
new file mode 100644
index 000000000..e943122f8
--- /dev/null
+++ b/newlib/libc/sys/linux/net/iso_addr.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)iso_addr.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <netiso/iso.h>
+#include <string.h>
+
+/* States*/
+#define VIRGIN 0
+#define GOTONE 1
+#define GOTTWO 2
+/* Inputs */
+#define DIGIT (4*0)
+#define END (4*1)
+#define DELIM (4*2)
+
+struct iso_addr *
+iso_addr(addr)
+ const char *addr;
+{
+ static struct iso_addr out_addr;
+ char *cp = out_addr.isoa_genaddr;
+ char *cplim = cp + sizeof(out_addr.isoa_genaddr);
+ int byte = 0, state = VIRGIN, new;
+
+ bzero((char *)&out_addr, sizeof(out_addr));
+ do {
+ if ((*addr >= '0') && (*addr <= '9')) {
+ new = *addr - '0';
+ } else if ((*addr >= 'a') && (*addr <= 'f')) {
+ new = *addr - 'a' + 10;
+ } else if ((*addr >= 'A') && (*addr <= 'F')) {
+ new = *addr - 'A' + 10;
+ } else if (*addr == 0)
+ state |= END;
+ else
+ state |= DELIM;
+ addr++;
+ switch (state /* | INPUT */) {
+ case GOTTWO | DIGIT:
+ *cp++ = byte; /*FALLTHROUGH*/
+ case VIRGIN | DIGIT:
+ state = GOTONE; byte = new; continue;
+ case GOTONE | DIGIT:
+ state = GOTTWO; byte = new + (byte << 4); continue;
+ default: /* | DELIM */
+ state = VIRGIN; *cp++ = byte; byte = 0; continue;
+ case GOTONE | END:
+ case GOTTWO | END:
+ *cp++ = byte; /* FALLTHROUGH */
+ case VIRGIN | END:
+ break;
+ }
+ break;
+ } while (cp < cplim);
+ out_addr.isoa_len = cp - out_addr.isoa_genaddr;
+ return (&out_addr);
+}
+
+static char hexlist[] = "0123456789abcdef";
+
+char *
+iso_ntoa(isoa)
+ const struct iso_addr *isoa;
+{
+ static char tmpbuf[sizeof(isoa->isoa_genaddr)*3];
+ const u_char *binary;
+ char *cp;
+ int i;
+
+ binary = isoa->isoa_genaddr;
+ cp = tmpbuf;
+
+ for (i = 0; i < isoa->isoa_len; i++) {
+ *cp++ = hexlist[*binary >> 4];
+ *cp++ = hexlist[*binary++ & 0xf];
+
+ if ((((i % 2) == 0) && ((i + 1) < isoa->isoa_len)))
+ *cp++ = '.';
+ }
+ *cp = '\0';
+ return tmpbuf;
+}
diff --git a/newlib/libc/sys/linux/net/key-lookup.c b/newlib/libc/sys/linux/net/key-lookup.c
deleted file mode 100644
index e2c4c14a6..000000000
--- a/newlib/libc/sys/linux/net/key-lookup.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME publickey
-#define DEFAULT_CONFIG "nis nisplus"
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/linkaddr.3 b/newlib/libc/sys/linux/net/linkaddr.3
new file mode 100644
index 000000000..1d664630b
--- /dev/null
+++ b/newlib/libc/sys/linux/net/linkaddr.3
@@ -0,0 +1,140 @@
+.\" Copyright (c) 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Donn Seeley at BSDI.
+.\"
+.\" 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.
+.\"
+.\" From: @(#)linkaddr.3 8.1 (Berkeley) 7/28/93
+.\" $FreeBSD: src/lib/libc/net/linkaddr.3,v 1.12 2001/10/01 16:08:56 ru Exp $
+.\"
+.Dd June 17, 1996
+.Dt LINK_ADDR 3
+.Os
+.Sh NAME
+.Nm link_addr ,
+.Nm link_ntoa
+.Nd elementary address specification routines for link level access
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In sys/socket.h
+.In net/if_dl.h
+.Ft void
+.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl"
+.Ft char *
+.Fn link_ntoa "const struct sockaddr_dl *sdl"
+.Sh DESCRIPTION
+The routine
+.Fn link_addr
+interprets character strings representing
+link-level addresses, returning binary information suitable
+for use in system calls.
+The routine
+.Fn link_ntoa
+takes
+a link-level
+address and returns an
+.Tn ASCII
+string representing some of the information present,
+including the link level address itself, and the interface name
+or number, if present.
+This facility is experimental and is
+still subject to change.
+.Pp
+For
+.Fn link_addr ,
+the string
+.Fa addr
+may contain
+an optional network interface identifier of the form
+.Dq "name unit-number" ,
+suitable for the first argument to
+.Xr ifconfig 8 ,
+followed in all cases by a colon and
+an interface address in the form of
+groups of hexadecimal digits
+separated by periods.
+Each group represents a byte of address;
+address bytes are filled left to right from
+low order bytes through high order bytes.
+.Pp
+.\" A regular expression may make this format clearer:
+.\" .Bd -literal -offset indent
+.\" ([a-z]+[0-9]+:)?[0-9a-f]+(\e.[0-9a-f]+)*
+.\" .Ed
+.\" .Pp
+Thus
+.Li le0:8.0.9.13.d.30
+represents an ethernet address
+to be transmitted on the first Lance ethernet interface.
+.Pp
+The direct use of these functions is deprecated in favor of the
+.Xr addr2ascii 3
+interface; however, portable programs cannot rely on the latter as it is
+not yet widely implemented.
+.Sh RETURN VALUES
+.Fn link_ntoa
+always returns a null terminated string.
+.Fn link_addr
+has no return value.
+(See
+.Sx BUGS . )
+.Sh SEE ALSO
+.Xr addr2ascii 3
+.\" .Xr iso 4
+.Sh HISTORY
+The
+.Fn link_addr
+and
+.Fn link_ntoa
+functions appeared in
+.Bx 4.3 Reno .
+.Sh BUGS
+The returned values for link_ntoa
+reside in a static memory area.
+.Pp
+The function
+.Fn link_addr
+should diagnose improperly formed input, and there should be an unambiguous
+way to recognize this.
+.Pp
+If the
+.Va sdl_len
+field of the link socket address
+.Fa sdl
+is 0,
+.Fn link_ntoa
+will not insert a colon before the interface address bytes.
+If this translated address is given to
+.Fn link_addr
+without inserting an initial colon,
+the latter will not interpret it correctly.
diff --git a/newlib/libc/sys/linux/net/linkaddr.c b/newlib/libc/sys/linux/net/linkaddr.c
new file mode 100644
index 000000000..deeaa09ea
--- /dev/null
+++ b/newlib/libc/sys/linux/net/linkaddr.c
@@ -0,0 +1,160 @@
+/*-
+ * Copyright (c) 1990, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)linkaddr.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <net/if_dl.h>
+#include <string.h>
+
+/* States*/
+#define NAMING 0
+#define GOTONE 1
+#define GOTTWO 2
+#define RESET 3
+/* Inputs */
+#define DIGIT (4*0)
+#define END (4*1)
+#define DELIM (4*2)
+#define LETTER (4*3)
+
+void
+link_addr(addr, sdl)
+ const char *addr;
+ struct sockaddr_dl *sdl;
+{
+ char *cp = sdl->sdl_data;
+ char *cplim = sdl->sdl_len + (char *)sdl;
+ int byte = 0, state = NAMING, new = 0;
+
+ bzero((char *)&sdl->sdl_family, sdl->sdl_len - 1);
+ sdl->sdl_family = AF_INET;
+ do {
+ state &= ~LETTER;
+ if ((*addr >= '0') && (*addr <= '9')) {
+ new = *addr - '0';
+ } else if ((*addr >= 'a') && (*addr <= 'f')) {
+ new = *addr - 'a' + 10;
+ } else if ((*addr >= 'A') && (*addr <= 'F')) {
+ new = *addr - 'A' + 10;
+ } else if (*addr == 0) {
+ state |= END;
+ } else if (state == NAMING &&
+ (((*addr >= 'A') && (*addr <= 'Z')) ||
+ ((*addr >= 'a') && (*addr <= 'z'))))
+ state |= LETTER;
+ else
+ state |= DELIM;
+ addr++;
+ switch (state /* | INPUT */) {
+ case NAMING | DIGIT:
+ case NAMING | LETTER:
+ *cp++ = addr[-1];
+ continue;
+ case NAMING | DELIM:
+ state = RESET;
+ sdl->sdl_nlen = cp - sdl->sdl_data;
+ continue;
+ case GOTTWO | DIGIT:
+ *cp++ = byte;
+ /* FALLTHROUGH */
+ case RESET | DIGIT:
+ state = GOTONE;
+ byte = new;
+ continue;
+ case GOTONE | DIGIT:
+ state = GOTTWO;
+ byte = new + (byte << 4);
+ continue;
+ default: /* | DELIM */
+ state = RESET;
+ *cp++ = byte;
+ byte = 0;
+ continue;
+ case GOTONE | END:
+ case GOTTWO | END:
+ *cp++ = byte;
+ /* FALLTHROUGH */
+ case RESET | END:
+ break;
+ }
+ break;
+ } while (cp < cplim);
+ sdl->sdl_alen = cp - LLADDR(sdl);
+ new = cp - (char *)sdl;
+ if (new > sizeof(*sdl))
+ sdl->sdl_len = new;
+ return;
+}
+
+static char hexlist[] = "0123456789abcdef";
+
+char *
+link_ntoa(sdl)
+ const struct sockaddr_dl *sdl;
+{
+ static char obuf[64];
+ char *out = obuf;
+ int i;
+ u_char *in = (u_char *)LLADDR(sdl);
+ u_char *inlim = in + sdl->sdl_alen;
+ int firsttime = 1;
+
+ if (sdl->sdl_nlen) {
+ bcopy(sdl->sdl_data, obuf, sdl->sdl_nlen);
+ out += sdl->sdl_nlen;
+ if (sdl->sdl_alen)
+ *out++ = ':';
+ }
+ while (in < inlim) {
+ if (firsttime)
+ firsttime = 0;
+ else
+ *out++ = '.';
+ i = *in++;
+ if (i > 0xf) {
+ out[1] = hexlist[i & 0xf];
+ i >>= 4;
+ out[0] = hexlist[i];
+ out += 2;
+ } else
+ *out++ = hexlist[i];
+ }
+ *out = 0;
+ return (obuf);
+}
diff --git a/newlib/libc/sys/linux/net/local.h b/newlib/libc/sys/linux/net/local.h
deleted file mode 100644
index 9380d7c55..000000000
--- a/newlib/libc/sys/linux/net/local.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <alloca.h>
-#include "libc-symbols.h"
-
-# define extend_alloca(buf, len, newlen) \
- (__typeof (buf)) ({ size_t __newlen = (newlen); \
- char *__newbuf = alloca (__newlen); \
- if (__newbuf > (char *)buf) \
- if ((char *)buf + len == __newbuf) { \
- len += __newlen; \
- __newbuf = buf; \
- } \
- else { \
- if (__newbuf + newlen == (char *)buf) \
- len += __newlen; \
- else \
- len = __newlen; \
- } \
- __newbuf; })
-
-#define __fsetlocking(fp, x) fp
-
-extern const char *_res_opcodes[];
-libresolv_hidden_proto (_res_opcodes)
-
diff --git a/newlib/libc/sys/linux/net/map_v4v6.c b/newlib/libc/sys/linux/net/map_v4v6.c
new file mode 100644
index 000000000..f746a8088
--- /dev/null
+++ b/newlib/libc/sys/linux/net/map_v4v6.c
@@ -0,0 +1,128 @@
+/*
+ * ++Copyright++ 1985, 1988, 1993
+ * -
+ * Copyright (c) 1985, 1988, 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.
+ * -
+ * --Copyright--
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <ctype.h>
+#include <syslog.h>
+
+typedef union {
+ int32_t al;
+ char ac;
+} align;
+
+void
+_map_v4v6_address(src, dst)
+ const char *src;
+ char *dst;
+{
+ u_char *p = (u_char *)dst;
+ char tmp[INADDRSZ];
+ int i;
+
+ /* Stash a temporary copy so our caller can update in place. */
+ bcopy(src, tmp, INADDRSZ);
+ /* Mark this ipv6 addr as a mapped ipv4. */
+ for (i = 0; i < 10; i++)
+ *p++ = 0x00;
+ *p++ = 0xff;
+ *p++ = 0xff;
+ /* Retrieve the saved copy and we're done. */
+ bcopy(tmp, (void*)p, INADDRSZ);
+}
+
+void
+_map_v4v6_hostent(hp, bpp, lenp)
+ struct hostent *hp;
+ char **bpp;
+ int *lenp;
+{
+ char **ap;
+
+ if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ)
+ return;
+ hp->h_addrtype = AF_INET6;
+ hp->h_length = IN6ADDRSZ;
+ for (ap = hp->h_addr_list; *ap; ap++) {
+ int i = sizeof(align) - ((u_long)*bpp % sizeof(align));
+
+ if (*lenp < (i + IN6ADDRSZ)) {
+ /* Out of memory. Truncate address list here. XXX */
+ *ap = NULL;
+ return;
+ }
+ *bpp += i;
+ *lenp -= i;
+ _map_v4v6_address(*ap, *bpp);
+ *ap = *bpp;
+ *bpp += IN6ADDRSZ;
+ *lenp -= IN6ADDRSZ;
+ }
+}
diff --git a/newlib/libc/sys/linux/net/name6.c b/newlib/libc/sys/linux/net/name6.c
new file mode 100644
index 000000000..f220e213c
--- /dev/null
+++ b/newlib/libc/sys/linux/net/name6.c
@@ -0,0 +1,1812 @@
+/* $KAME: name6.c,v 1.25 2000/06/26 16:44:40 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+/*
+ * ++Copyright++ 1985, 1988, 1993
+ * -
+ * Copyright (c) 1985, 1988, 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.
+ * -
+ * --Copyright--
+ */
+
+/*
+ * Atsushi Onoe <onoe@sm.sony.co.jp>
+ */
+
+/*
+ * TODO for thread safe
+ * use mutex for _hostconf, _hostconf_init.
+ * rewrite resolvers to be thread safe
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "namespace.h"
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/queue.h>
+#include <netinet/in.h>
+
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+
+#include <errno.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdarg.h>
+#include <nsswitch.h>
+#include <unistd.h>
+#include "un-namespace.h"
+
+#ifndef _PATH_HOSTS
+#define _PATH_HOSTS "/etc/hosts"
+#endif
+
+#ifndef MAXALIASES
+#define MAXALIASES 35
+#endif
+#ifndef MAXADDRS
+#define MAXADDRS 2
+#endif
+#ifndef MAXDNAME
+#define MAXDNAME 1025
+#endif
+
+#ifdef INET6
+#define ADDRLEN(af) ((af) == AF_INET6 ? sizeof(struct in6_addr) : \
+ sizeof(struct in_addr))
+#else
+#define ADDRLEN(af) sizeof(struct in_addr)
+#endif
+
+#define MAPADDR(ab, ina) \
+do { \
+ memcpy(&(ab)->map_inaddr, ina, sizeof(struct in_addr)); \
+ memset((ab)->map_zero, 0, sizeof((ab)->map_zero)); \
+ memset((ab)->map_one, 0xff, sizeof((ab)->map_one)); \
+} while (0)
+#define MAPADDRENABLED(flags) \
+ (((flags) & AI_V4MAPPED) || \
+ (((flags) & AI_V4MAPPED_CFG) && _mapped_addr_enabled()))
+
+union inx_addr {
+ struct in_addr in_addr;
+#ifdef INET6
+ struct in6_addr in6_addr;
+#endif
+ struct {
+ u_char mau_zero[10];
+ u_char mau_one[2];
+ struct in_addr mau_inaddr;
+ } map_addr_un;
+#define map_zero map_addr_un.mau_zero
+#define map_one map_addr_un.mau_one
+#define map_inaddr map_addr_un.mau_inaddr
+};
+
+u_int16_t _getshort(const u_char *src);
+
+static struct hostent *_hpcopy(struct hostent *hp, int *errp);
+static struct hostent *_hpaddr(int af, const char *name, void *addr, int *errp);
+static struct hostent *_hpmerge(struct hostent *hp1, struct hostent *hp2, int *errp);
+#ifdef INET6
+static struct hostent *_hpmapv6(struct hostent *hp, int *errp);
+#endif
+static struct hostent *_hpsort(struct hostent *hp);
+static struct hostent *_ghbyname(const char *name, int af, int flags, int *errp);
+static char *_hgetword(char **pp);
+static int _mapped_addr_enabled(void);
+
+static FILE *_files_open(int *errp);
+static int _files_ghbyname(void *, void *, va_list);
+static int _files_ghbyaddr(void *, void *, va_list);
+#if 0 // keep gcc happy
+static void _files_shent(int stayopen);
+static void _files_ehent(void);
+#endif
+#ifdef YP
+static int _nis_ghbyname(void *, void *, va_list);
+static int _nis_ghbyaddr(void *, void *, va_list);
+#endif
+static int _dns_ghbyname(void *, void *, va_list);
+static int _dns_ghbyaddr(void *, void *, va_list);
+#if 0 // keep gcc happy
+static void _dns_shent(int stayopen);
+static void _dns_ehent(void);
+#endif
+
+#ifdef ICMPNL
+static int _icmp_ghbyaddr(void *, void *, va_list);
+#endif /* ICMPNL */
+
+/* Host lookup order if nsswitch.conf is broken or nonexistant */
+static const ns_src default_src[] = {
+ { NSSRC_FILES, NS_SUCCESS },
+ { NSSRC_DNS, NS_SUCCESS },
+#ifdef ICMPNL
+#define NSSRC_ICMP "icmp"
+ { NSSRC_ICMP, NS_SUCCESS },
+#endif
+ { 0 }
+};
+
+/*
+ * Check if kernel supports mapped address.
+ * implementation dependent
+ */
+#ifdef __KAME__
+#include <sys/sysctl.h>
+#endif /* __KAME__ */
+
+static int
+_mapped_addr_enabled(void)
+{
+ /* implementation dependent check */
+#if defined(__KAME__) && defined(IPV6CTL_MAPPED_ADDR)
+ int mib[4];
+ size_t len;
+ int val;
+
+ mib[0] = CTL_NET;
+ mib[1] = PF_INET6;
+ mib[2] = IPPROTO_IPV6;
+ mib[3] = IPV6CTL_MAPPED_ADDR;
+ len = sizeof(val);
+ if (__sysctl(mib, 4, &val, &len, 0, 0) == 0 && val != 0)
+ return 1;
+#endif /* __KAME__ && IPV6CTL_MAPPED_ADDR */
+ return 0;
+}
+
+/*
+ * Functions defined in RFC2553
+ * getipnodebyname, getipnodebyaddr, freehostent
+ */
+
+static struct hostent *
+_ghbyname(const char *name, int af, int flags, int *errp)
+{
+ struct hostent *hp;
+ int rval;
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_files_ghbyname, NULL)
+ { NSSRC_DNS, _dns_ghbyname, NULL },
+ NS_NIS_CB(_nis_ghbyname, NULL)
+ { 0 }
+ };
+
+ if (flags & AI_ADDRCONFIG) {
+ int s;
+
+ /*
+ * TODO:
+ * Note that implementation dependent test for address
+ * configuration should be done everytime called
+ * (or apropriate interval),
+ * because addresses will be dynamically assigned or deleted.
+ */
+ if (af == AF_UNSPEC) {
+ if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0)
+ af = AF_INET;
+ else {
+ close(s);
+ if ((s = socket(AF_INET, SOCK_DGRAM, 0)) < 0)
+ af = AF_INET6;
+ else
+ close(s);
+ }
+
+ }
+ if (af != AF_UNSPEC) {
+ if ((s = socket(af, SOCK_DGRAM, 0)) < 0)
+ return NULL;
+ close(s);
+ }
+ }
+
+ rval = nsdispatch(&hp, dtab, NSDB_HOSTS, "ghbyname", default_src,
+ name, af, errp);
+ return (rval == NS_SUCCESS) ? hp : NULL;
+}
+
+/* getipnodebyname() internal routine for multiple query(PF_UNSPEC) support. */
+struct hostent *
+_getipnodebyname_multi(const char *name, int af, int flags, int *errp)
+{
+ struct hostent *hp;
+ union inx_addr addrbuf;
+
+ /* XXX: PF_UNSPEC is only supposed to be passed from getaddrinfo() */
+ if (af != AF_INET
+#ifdef INET6
+ && af != AF_INET6
+#endif
+ && af != PF_UNSPEC
+ )
+ {
+ *errp = NO_RECOVERY;
+ return NULL;
+ }
+
+#ifdef INET6
+ /* special case for literal address */
+ if (inet_pton(AF_INET6, name, &addrbuf) == 1) {
+ if (af != AF_INET6) {
+ *errp = HOST_NOT_FOUND;
+ return NULL;
+ }
+ return _hpaddr(af, name, &addrbuf, errp);
+ }
+#endif
+ if (inet_aton(name, (struct in_addr *)&addrbuf) == 1) {
+ if (af != AF_INET) {
+ if (MAPADDRENABLED(flags)) {
+ MAPADDR(&addrbuf, &addrbuf.in_addr);
+ } else {
+ *errp = HOST_NOT_FOUND;
+ return NULL;
+ }
+ }
+ return _hpaddr(af, name, &addrbuf, errp);
+ }
+
+ *errp = HOST_NOT_FOUND;
+ hp = _ghbyname(name, af, flags, errp);
+
+#ifdef INET6
+ if (af == AF_INET6
+ && ((flags & AI_ALL) || hp == NULL)
+ && (MAPADDRENABLED(flags))) {
+ struct hostent *hp2 = _ghbyname(name, AF_INET, flags, errp);
+ if (hp == NULL)
+ hp = _hpmapv6(hp2, errp);
+ else {
+ if (hp2 && strcmp(hp->h_name, hp2->h_name) != 0) {
+ freehostent(hp2);
+ hp2 = NULL;
+ }
+ hp = _hpmerge(hp, hp2, errp);
+ }
+ }
+#endif
+ return _hpsort(hp);
+}
+
+struct hostent *
+getipnodebyname(const char *name, int af, int flags, int *errp)
+{
+ if (af != AF_INET
+#ifdef INET6
+ && af != AF_INET6
+#endif
+ )
+ {
+ *errp = NO_RECOVERY;
+ return NULL;
+ }
+ return(_getipnodebyname_multi(name, af ,flags, errp));
+}
+
+struct hostent *
+getipnodebyaddr(const void *src, size_t len, int af, int *errp)
+{
+ struct hostent *hp;
+ int rval;
+#ifdef INET6
+ struct in6_addr addrbuf;
+#else
+ struct in_addr addrbuf;
+#endif
+
+ static const ns_dtab dtab[] = {
+ NS_FILES_CB(_files_ghbyaddr, NULL)
+ { NSSRC_DNS, _dns_ghbyaddr, NULL },
+ NS_NIS_CB(_nis_ghbyaddr, NULL)
+#ifdef ICMPNL
+ { NSSRC_ICMP, _icmp_ghbyaddr, NULL },
+#endif
+ { 0 }
+ };
+
+ *errp = HOST_NOT_FOUND;
+
+ switch (af) {
+ case AF_INET:
+ if (len != sizeof(struct in_addr)) {
+ *errp = NO_RECOVERY;
+ return NULL;
+ }
+ if ((long)src & ~(sizeof(struct in_addr) - 1)) {
+ memcpy(&addrbuf, src, len);
+ src = &addrbuf;
+ }
+ if (((struct in_addr *)src)->s_addr == 0)
+ return NULL;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ if (len != sizeof(struct in6_addr)) {
+ *errp = NO_RECOVERY;
+ return NULL;
+ }
+ if ((long)src & ~(sizeof(struct in6_addr) / 2 - 1)) { /*XXX*/
+ memcpy(&addrbuf, src, len);
+ src = &addrbuf;
+ }
+ if (IN6_IS_ADDR_UNSPECIFIED((struct in6_addr *)src))
+ return NULL;
+ if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)src)
+ || IN6_IS_ADDR_V4COMPAT((struct in6_addr *)src)) {
+ src = (char *)src +
+ (sizeof(struct in6_addr) - sizeof(struct in_addr));
+ af = AF_INET;
+ len = sizeof(struct in_addr);
+ }
+ break;
+#endif
+ default:
+ *errp = NO_RECOVERY;
+ return NULL;
+ }
+
+ rval = nsdispatch(&hp, dtab, NSDB_HOSTS, "ghbyaddr", default_src,
+ src, len, af, errp);
+ return (rval == NS_SUCCESS) ? hp : NULL;
+}
+
+void
+freehostent(struct hostent *ptr)
+{
+ free(ptr);
+}
+
+#if 0
+
+/* XXX: should be deprecated */
+struct hostent *
+getnodebyname(const char *name, int af, int flags)
+{
+ return getipnodebyname(name, af, flags, &h_errno);
+}
+
+#ifdef __warn_references
+__warn_references(getnodebyname,
+ "warning: getnodebyname() deprecated, "
+ "should use getaddrinfo() or getipnodebyname()");
+#endif
+
+struct hostent *
+getnodebyaddr(const void *src, size_t len, int af)
+{
+ return getipnodebyaddr(src, len, af, &h_errno);
+}
+
+#ifdef __warn_references
+__warn_references(getnodebyaddr,
+ "warning: getnodebyaddr() deprecated, "
+ "should use getnameinfo() or getipnodebyaddr()");
+#endif
+
+#endif
+
+/*
+ * Private utility functions
+ */
+
+/*
+ * _hpcopy: allocate and copy hostent structure
+ */
+static struct hostent *
+_hpcopy(struct hostent *hp, int *errp)
+{
+ struct hostent *nhp;
+ char *cp, **pp;
+ int size, addrsize;
+ int nalias = 0, naddr = 0;
+ int al_off;
+ int i;
+
+ if (hp == NULL)
+ return hp;
+
+ /* count size to be allocated */
+ size = sizeof(struct hostent);
+ if (hp->h_name != NULL)
+ size += strlen(hp->h_name) + 1;
+ if ((pp = hp->h_aliases) != NULL) {
+ for (i = 0; *pp != NULL; i++, pp++) {
+ if (**pp != '\0') {
+ size += strlen(*pp) + 1;
+ nalias++;
+ }
+ }
+ }
+ /* adjust alignment */
+#ifdef ALIGN
+ size = ALIGN(size);
+#endif
+ al_off = size;
+ size += sizeof(char *) * (nalias + 1);
+#ifdef ALIGN
+ addrsize = ALIGN(hp->h_length);
+#else
+ addrsize = hp->h_length;
+#endif
+
+ if ((pp = hp->h_addr_list) != NULL) {
+ while (*pp++ != NULL)
+ naddr++;
+ }
+ size += addrsize * naddr;
+ size += sizeof(char *) * (naddr + 1);
+
+ /* copy */
+ if ((nhp = (struct hostent *)malloc(size)) == NULL) {
+ *errp = TRY_AGAIN;
+ return NULL;
+ }
+ cp = (char *)&nhp[1];
+ if (hp->h_name != NULL) {
+ nhp->h_name = cp;
+ strcpy(cp, hp->h_name);
+ cp += strlen(cp) + 1;
+ } else
+ nhp->h_name = NULL;
+ nhp->h_aliases = (char **)((char *)nhp + al_off);
+ if ((pp = hp->h_aliases) != NULL) {
+ for (i = 0; *pp != NULL; pp++) {
+ if (**pp != '\0') {
+ nhp->h_aliases[i++] = cp;
+ strcpy(cp, *pp);
+ cp += strlen(cp) + 1;
+ }
+ }
+ }
+ nhp->h_aliases[nalias] = NULL;
+ cp = (char *)&nhp->h_aliases[nalias + 1];
+ nhp->h_addrtype = hp->h_addrtype;
+ nhp->h_length = hp->h_length;
+ nhp->h_addr_list = (char **)cp;
+ if ((pp = hp->h_addr_list) != NULL) {
+ cp = (char *)&nhp->h_addr_list[naddr + 1];
+ for (i = 0; *pp != NULL; pp++) {
+ nhp->h_addr_list[i++] = cp;
+ memcpy(cp, *pp, hp->h_length);
+ cp += addrsize;
+ }
+ }
+ nhp->h_addr_list[naddr] = NULL;
+ return nhp;
+}
+
+/*
+ * _hpaddr: construct hostent structure with one address
+ */
+static struct hostent *
+_hpaddr(int af, const char *name, void *addr, int *errp)
+{
+ struct hostent *hp, hpbuf;
+ char *addrs[2];
+
+ hp = &hpbuf;
+ hp->h_name = (char *)name;
+ hp->h_aliases = NULL;
+ hp->h_addrtype = af;
+ hp->h_length = ADDRLEN(af);
+ hp->h_addr_list = addrs;
+ addrs[0] = (char *)addr;
+ addrs[1] = NULL;
+ return _hpcopy(hp, errp);
+}
+
+/*
+ * _hpmerge: merge 2 hostent structure, arguments will be freed
+ */
+static struct hostent *
+_hpmerge(struct hostent *hp1, struct hostent *hp2, int *errp)
+{
+ int i, j;
+ int naddr, nalias;
+ char **pp;
+ struct hostent *hp, hpbuf;
+ char *aliases[MAXALIASES + 1], *addrs[MAXADDRS + 1];
+ union inx_addr addrbuf[MAXADDRS];
+
+ if (hp1 == NULL)
+ return hp2;
+ if (hp2 == NULL)
+ return hp1;
+
+#define HP(i) (i == 1 ? hp1 : hp2)
+ hp = &hpbuf;
+ hp->h_name = (hp1->h_name != NULL ? hp1->h_name : hp2->h_name);
+ hp->h_aliases = aliases;
+ nalias = 0;
+ for (i = 1; i <= 2; i++) {
+ if ((pp = HP(i)->h_aliases) == NULL)
+ continue;
+ for (; nalias < MAXALIASES && *pp != NULL; pp++) {
+ /* check duplicates */
+ for (j = 0; j < nalias; j++)
+ if (strcasecmp(*pp, aliases[j]) == 0)
+ break;
+ if (j == nalias)
+ aliases[nalias++] = *pp;
+ }
+ }
+ aliases[nalias] = NULL;
+#ifdef INET6
+ if (hp1->h_length != hp2->h_length) {
+ hp->h_addrtype = AF_INET6;
+ hp->h_length = sizeof(struct in6_addr);
+ } else {
+#endif
+ hp->h_addrtype = hp1->h_addrtype;
+ hp->h_length = hp1->h_length;
+#ifdef INET6
+ }
+#endif
+ hp->h_addr_list = addrs;
+ naddr = 0;
+ for (i = 1; i <= 2; i++) {
+ if ((pp = HP(i)->h_addr_list) == NULL)
+ continue;
+ if (HP(i)->h_length == hp->h_length) {
+ while (naddr < MAXADDRS && *pp != NULL)
+ addrs[naddr++] = *pp++;
+ } else {
+ /* copy IPv4 addr as mapped IPv6 addr */
+ while (naddr < MAXADDRS && *pp != NULL) {
+ MAPADDR(&addrbuf[naddr], *pp++);
+ addrs[naddr] = (char *)&addrbuf[naddr];
+ naddr++;
+ }
+ }
+ }
+ addrs[naddr] = NULL;
+ hp = _hpcopy(hp, errp);
+ freehostent(hp1);
+ freehostent(hp2);
+ return hp;
+}
+
+/*
+ * _hpmapv6: convert IPv4 hostent into IPv4-mapped IPv6 addresses
+ */
+#ifdef INET6
+static struct hostent *
+_hpmapv6(struct hostent *hp, int *errp)
+{
+ struct hostent *hp6;
+
+ if (hp == NULL)
+ return NULL;
+ if (hp->h_addrtype == AF_INET6)
+ return hp;
+
+ /* make dummy hostent to convert IPv6 address */
+ if ((hp6 = (struct hostent *)malloc(sizeof(struct hostent))) == NULL) {
+ *errp = TRY_AGAIN;
+ return NULL;
+ }
+ hp6->h_name = NULL;
+ hp6->h_aliases = NULL;
+ hp6->h_addrtype = AF_INET6;
+ hp6->h_length = sizeof(struct in6_addr);
+ hp6->h_addr_list = NULL;
+ return _hpmerge(hp6, hp, errp);
+}
+#endif
+
+/*
+ * _hpsort: sort address by sortlist
+ */
+static struct hostent *
+_hpsort(struct hostent *hp)
+{
+ int i, j, n;
+ u_char *ap, *sp, *mp, **pp;
+ char t;
+ char order[MAXADDRS];
+ int nsort = _res.nsort;
+
+ if (hp == NULL || hp->h_addr_list[1] == NULL || nsort == 0)
+ return hp;
+ for (i = 0; (ap = (u_char *)hp->h_addr_list[i]); i++) {
+ for (j = 0; j < nsort; j++) {
+#ifdef INET6
+ if (_res_ext.sort_list[j].af != hp->h_addrtype)
+ continue;
+ sp = (u_char *)&_res_ext.sort_list[j].addr;
+ mp = (u_char *)&_res_ext.sort_list[j].mask;
+#else
+ sp = (u_char *)&_res.sort_list[j].addr;
+ mp = (u_char *)&_res.sort_list[j].mask;
+#endif
+ for (n = 0; n < hp->h_length; n++) {
+ if ((ap[n] & mp[n]) != sp[n])
+ break;
+ }
+ if (n == hp->h_length)
+ break;
+ }
+ order[i] = j;
+ }
+ n = i;
+ pp = (u_char **)hp->h_addr_list;
+ for (i = 0; i < n - 1; i++) {
+ for (j = i + 1; j < n; j++) {
+ if (order[i] > order[j]) {
+ ap = pp[i];
+ pp[i] = pp[j];
+ pp[j] = ap;
+ t = order[i];
+ order[i] = order[j];
+ order[j] = t;
+ }
+ }
+ }
+ return hp;
+}
+
+static char *
+_hgetword(char **pp)
+{
+ char c, *p, *ret;
+ const char *sp;
+ static const char sep[] = "# \t\n";
+
+ ret = NULL;
+ for (p = *pp; (c = *p) != '\0'; p++) {
+ for (sp = sep; *sp != '\0'; sp++) {
+ if (c == *sp)
+ break;
+ }
+ if (c == '#')
+ p[1] = '\0'; /* ignore rest of line */
+ if (ret == NULL) {
+ if (*sp == '\0')
+ ret = p;
+ } else {
+ if (*sp != '\0') {
+ *p++ = '\0';
+ break;
+ }
+ }
+ }
+ *pp = p;
+ if (ret == NULL || *ret == '\0')
+ return NULL;
+ return ret;
+}
+
+/*
+ * FILES (/etc/hosts)
+ */
+
+static FILE *
+_files_open(int *errp)
+{
+ FILE *fp;
+ fp = fopen(_PATH_HOSTS, "r");
+ if (fp == NULL)
+ *errp = NO_RECOVERY;
+ return fp;
+}
+
+static int
+_files_ghbyname(void *rval, void *cb_data, va_list ap)
+{
+ const char *name;
+ int af;
+ int *errp;
+ int match, nalias;
+ char *p, *line, *addrstr, *cname;
+ FILE *fp;
+ struct hostent *rethp, *hp, hpbuf;
+ char *aliases[MAXALIASES + 1], *addrs[2];
+ union inx_addr addrbuf;
+ char buf[BUFSIZ];
+ int af0;
+
+ name = va_arg(ap, const char *);
+ af = va_arg(ap, int);
+ errp = va_arg(ap, int *);
+
+ *(struct hostent **)rval = NULL;
+
+ if ((fp = _files_open(errp)) == NULL)
+ return NS_UNAVAIL;
+ rethp = hp = NULL;
+
+ af0 = af;
+ while (fgets(buf, sizeof(buf), fp)) {
+ line = buf;
+ if ((addrstr = _hgetword(&line)) == NULL
+ || (cname = _hgetword(&line)) == NULL)
+ continue;
+ match = (strcasecmp(cname, name) == 0);
+ nalias = 0;
+ while ((p = _hgetword(&line)) != NULL) {
+ if (!match)
+ match = (strcasecmp(p, name) == 0);
+ if (nalias < MAXALIASES)
+ aliases[nalias++] = p;
+ }
+ if (!match)
+ continue;
+ switch (af0) {
+ case AF_INET:
+ if (inet_aton(addrstr, (struct in_addr *)&addrbuf)
+ != 1) {
+ *errp = NO_DATA; /* name found */
+ continue;
+ }
+ af = af0;
+ break;
+#ifdef INET6
+ case AF_INET6:
+ if (inet_pton(af, addrstr, &addrbuf) != 1) {
+ *errp = NO_DATA; /* name found */
+ continue;
+ }
+ af = af0;
+ break;
+#endif
+ case AF_UNSPEC:
+ if (inet_aton(addrstr, (struct in_addr *)&addrbuf)
+ == 1) {
+ af = AF_INET;
+ break;
+ }
+#ifdef INET6
+ if (inet_pton(AF_INET6, addrstr, &addrbuf) == 1) {
+ af = AF_INET6;
+ break;
+ }
+#endif
+ *errp = NO_DATA; /* name found */
+ continue;
+ /* NOTREACHED */
+ }
+ hp = &hpbuf;
+ hp->h_name = cname;
+ hp->h_aliases = aliases;
+ aliases[nalias] = NULL;
+ hp->h_addrtype = af;
+ hp->h_length = ADDRLEN(af);
+ hp->h_addr_list = addrs;
+ addrs[0] = (char *)&addrbuf;
+ addrs[1] = NULL;
+ hp = _hpcopy(hp, errp);
+ rethp = _hpmerge(rethp, hp, errp);
+ }
+ fclose(fp);
+ *(struct hostent **)rval = rethp;
+ return (rethp != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+
+static int
+_files_ghbyaddr(void *rval, void *cb_data, va_list ap)
+{
+ const void *addr;
+ int addrlen;
+ int af;
+ int *errp;
+ int nalias;
+ char *p, *line;
+ FILE *fp;
+ struct hostent *hp, hpbuf;
+ char *aliases[MAXALIASES + 1], *addrs[2];
+ union inx_addr addrbuf;
+ char buf[BUFSIZ];
+
+ addr = va_arg(ap, const void *);
+ addrlen = va_arg(ap, int);
+ af = va_arg(ap, int);
+ errp = va_arg(ap, int *);
+
+ *(struct hostent**)rval = NULL;
+
+ if ((fp = _files_open(errp)) == NULL)
+ return NS_UNAVAIL;
+ hp = NULL;
+ while (fgets(buf, sizeof(buf), fp)) {
+ line = buf;
+ if ((p = _hgetword(&line)) == NULL
+ || (af == AF_INET
+ ? inet_aton(p, (struct in_addr *)&addrbuf)
+ : inet_pton(af, p, &addrbuf)) != 1
+ || memcmp(addr, &addrbuf, addrlen) != 0
+ || (p = _hgetword(&line)) == NULL)
+ continue;
+ hp = &hpbuf;
+ hp->h_name = p;
+ hp->h_aliases = aliases;
+ nalias = 0;
+ while ((p = _hgetword(&line)) != NULL) {
+ if (nalias < MAXALIASES)
+ aliases[nalias++] = p;
+ }
+ aliases[nalias] = NULL;
+ hp->h_addrtype = af;
+ hp->h_length = addrlen;
+ hp->h_addr_list = addrs;
+ addrs[0] = (char *)&addrbuf;
+ addrs[1] = NULL;
+ hp = _hpcopy(hp, errp);
+ break;
+ }
+ fclose(fp);
+ *(struct hostent **)rval = hp;
+ return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+
+#ifdef YP
+/*
+ * NIS
+ *
+ * XXX actually a hack, these are INET4 specific.
+ */
+static int
+_nis_ghbyname(void *rval, void *cb_data, va_list ap)
+{
+ const char *name;
+ int af;
+ int *errp;
+ struct hostent *hp = NULL;
+
+ name = va_arg(ap, const char *);
+ af = va_arg(ap, int);
+ errp = va_arg(ap, int *);
+
+ if (af == AF_UNSPEC)
+ af = AF_INET;
+ if (af == AF_INET) {
+ hp = _gethostbynisname(name, af);
+ if (hp != NULL)
+ hp = _hpcopy(hp, errp);
+ }
+
+ *(struct hostent **)rval = hp;
+ return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+
+}
+
+static int
+_nis_ghbyaddr(void *rval, void *cb_data, va_list ap)
+{
+ const void *addr;
+ int addrlen;
+ int af;
+ int *errp;
+ struct hostent *hp = NULL;
+
+ addr = va_arg(ap, const void *);
+ addrlen = va_arg(ap, int);
+ af = va_arg(ap, int);
+
+ if (af == AF_INET) {
+ hp = _gethostbynisaddr(addr, addrlen, af);
+ if (hp != NULL)
+ hp = _hpcopy(hp, errp);
+ }
+ *(struct hostent **)rval = hp;
+ return (hp != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+#endif
+typedef struct __res_type_list res_type_list;
+
+struct __res_type_list {
+ res_type_list * rtl_entry;
+ int rtl_type;
+};
+
+#if PACKETSZ > 1024
+#define MAXPACKET PACKETSZ
+#else
+#define MAXPACKET 1024
+#endif
+
+typedef union {
+ HEADER hdr;
+ u_char buf[MAXPACKET];
+} querybuf;
+
+static struct hostent *getanswer(const querybuf *, int, const char *, int,
+ struct hostent *, int *);
+
+/*
+ * we don't need to take care about sorting, nor IPv4 mapped address here.
+ */
+static struct hostent *
+getanswer(answer, anslen, qname, qtype, template, errp)
+ const querybuf *answer;
+ int anslen;
+ const char *qname;
+ int qtype;
+ struct hostent *template;
+ int *errp;
+{
+ const HEADER *hp;
+ const u_char *cp;
+ int n;
+ const u_char *eom, *erdata;
+ char *bp, **ap, **hap;
+ int type, class, buflen, ancount, qdcount;
+ int haveanswer, had_error;
+ char tbuf[MAXDNAME];
+ const char *tname;
+ int (*name_ok)(const char *);
+ static char *h_addr_ptrs[MAXADDRS + 1];
+ static char *host_aliases[MAXALIASES];
+ static char hostbuf[8*1024];
+
+#define BOUNDED_INCR(x) \
+ do { \
+ cp += x; \
+ if (cp > eom) { \
+ *errp = NO_RECOVERY; \
+ return (NULL); \
+ } \
+ } while (0)
+
+#define BOUNDS_CHECK(ptr, count) \
+ do { \
+ if ((ptr) + (count) > eom) { \
+ *errp = NO_RECOVERY; \
+ return (NULL); \
+ } \
+ } while (0)
+
+/* XXX do {} while (0) cannot be put here */
+#define DNS_ASSERT(x) \
+ { \
+ if (!(x)) { \
+ cp += n; \
+ continue; \
+ } \
+ }
+
+/* XXX do {} while (0) cannot be put here */
+#define DNS_FATAL(x) \
+ { \
+ if (!(x)) { \
+ had_error++; \
+ continue; \
+ } \
+ }
+
+ tname = qname;
+ template->h_name = NULL;
+ eom = answer->buf + anslen;
+ switch (qtype) {
+ case T_A:
+ case T_AAAA:
+ name_ok = res_hnok;
+ break;
+ case T_PTR:
+ name_ok = res_dnok;
+ break;
+ default:
+ return (NULL); /* XXX should be abort(); */
+ }
+ /*
+ * find first satisfactory answer
+ */
+ hp = &answer->hdr;
+ ancount = ntohs(hp->ancount);
+ qdcount = ntohs(hp->qdcount);
+ bp = hostbuf;
+ buflen = sizeof hostbuf;
+ cp = answer->buf;
+ BOUNDED_INCR(HFIXEDSZ);
+ if (qdcount != 1) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ if ((n < 0) || !(*name_ok)(bp)) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ BOUNDED_INCR(n + QFIXEDSZ);
+ if (qtype == T_A || qtype == T_AAAA) {
+ /* res_send() has already verified that the query name is the
+ * same as the one we sent; this just gets the expanded name
+ * (i.e., with the succeeding search-domain tacked on).
+ */
+ n = strlen(bp) + 1; /* for the \0 */
+ if (n >= MAXHOSTNAMELEN) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ template->h_name = bp;
+ bp += n;
+ buflen -= n;
+ /* The qname can be abbreviated, but h_name is now absolute. */
+ qname = template->h_name;
+ }
+ ap = host_aliases;
+ *ap = NULL;
+ template->h_aliases = host_aliases;
+ hap = h_addr_ptrs;
+ *hap = NULL;
+ template->h_addr_list = h_addr_ptrs;
+ haveanswer = 0;
+ had_error = 0;
+ while (ancount-- > 0 && cp < eom && !had_error) {
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ DNS_FATAL(n >= 0);
+ DNS_FATAL((*name_ok)(bp));
+ cp += n; /* name */
+ BOUNDS_CHECK(cp, 3 * INT16SZ + INT32SZ);
+ type = _getshort(cp);
+ cp += INT16SZ; /* type */
+ class = _getshort(cp);
+ cp += INT16SZ + INT32SZ; /* class, TTL */
+ n = _getshort(cp);
+ cp += INT16SZ; /* len */
+ BOUNDS_CHECK(cp, n);
+ erdata = cp + n;
+ DNS_ASSERT(class == C_IN);
+ if ((qtype == T_A || qtype == T_AAAA) && type == T_CNAME) {
+ if (ap >= &host_aliases[MAXALIASES-1])
+ continue;
+ n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
+ DNS_FATAL(n >= 0);
+ DNS_FATAL((*name_ok)(tbuf));
+ cp += n;
+ if (cp != erdata) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ /* Store alias. */
+ *ap++ = bp;
+ n = strlen(bp) + 1; /* for the \0 */
+ DNS_FATAL(n < MAXHOSTNAMELEN);
+ bp += n;
+ buflen -= n;
+ /* Get canonical name. */
+ n = strlen(tbuf) + 1; /* for the \0 */
+ DNS_FATAL(n <= buflen);
+ DNS_FATAL(n < MAXHOSTNAMELEN);
+ strcpy(bp, tbuf);
+ template->h_name = bp;
+ bp += n;
+ buflen -= n;
+ continue;
+ }
+ if (qtype == T_PTR && type == T_CNAME) {
+ n = dn_expand(answer->buf, eom, cp, tbuf, sizeof tbuf);
+ if (n < 0 || !res_dnok(tbuf)) {
+ had_error++;
+ continue;
+ }
+ cp += n;
+ if (cp != erdata) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ /* Get canonical name. */
+ n = strlen(tbuf) + 1; /* for the \0 */
+ if (n > buflen || n >= MAXHOSTNAMELEN) {
+ had_error++;
+ continue;
+ }
+ strcpy(bp, tbuf);
+ tname = bp;
+ bp += n;
+ buflen -= n;
+ continue;
+ }
+ DNS_ASSERT(type == qtype);
+ switch (type) {
+ case T_PTR:
+ DNS_ASSERT(strcasecmp(tname, bp) == 0);
+ n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ DNS_FATAL(n >= 0);
+ DNS_FATAL(res_hnok(bp));
+#if MULTI_PTRS_ARE_ALIASES
+ cp += n;
+ if (cp != erdata) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ if (!haveanswer)
+ template->h_name = bp;
+ else if (ap < &host_aliases[MAXALIASES-1])
+ *ap++ = bp;
+ else
+ n = -1;
+ if (n != -1) {
+ n = strlen(bp) + 1; /* for the \0 */
+ if (n >= MAXHOSTNAMELEN) {
+ had_error++;
+ break;
+ }
+ bp += n;
+ buflen -= n;
+ }
+ break;
+#else
+ template->h_name = bp;
+ *errp = NETDB_SUCCESS;
+ return (template);
+#endif
+ case T_A:
+ case T_AAAA:
+ DNS_ASSERT(strcasecmp(template->h_name, bp) == 0);
+ DNS_ASSERT(n == template->h_length);
+ if (!haveanswer) {
+ int nn;
+
+ template->h_name = bp;
+ nn = strlen(bp) + 1; /* for the \0 */
+ bp += nn;
+ buflen -= nn;
+ }
+#ifdef ALIGN
+ bp = (char *)ALIGN(bp);
+#else
+ bp = (char *)(bp);
+#endif
+
+ DNS_FATAL(bp + n < &hostbuf[sizeof hostbuf]);
+ DNS_ASSERT(hap < &h_addr_ptrs[MAXADDRS-1]);
+#ifdef FILTER_V4MAPPED
+ if (type == T_AAAA) {
+ struct in6_addr in6;
+ memcpy(&in6, cp, sizeof(in6));
+ DNS_ASSERT(IN6_IS_ADDR_V4MAPPED(&in6) == 0);
+ }
+#endif
+ bcopy(cp, *hap++ = bp, n);
+ bp += n;
+ buflen -= n;
+ cp += n;
+ if (cp != erdata) {
+ *errp = NO_RECOVERY;
+ return (NULL);
+ }
+ break;
+ default:
+ abort();
+ }
+ if (!had_error)
+ haveanswer++;
+ }
+ if (haveanswer) {
+ *ap = NULL;
+ *hap = NULL;
+ if (!template->h_name) {
+ n = strlen(qname) + 1; /* for the \0 */
+ if (n > buflen || n >= MAXHOSTNAMELEN)
+ goto no_recovery;
+ strcpy(bp, qname);
+ template->h_name = bp;
+ bp += n;
+ buflen -= n;
+ }
+ *errp = NETDB_SUCCESS;
+ return (template);
+ }
+ no_recovery:
+ *errp = NO_RECOVERY;
+ return (NULL);
+
+#undef BOUNDED_INCR
+#undef BOUNDS_CHECK
+#undef DNS_ASSERT
+#undef DNS_FATAL
+}
+
+/* res_search() variant with multiple query support. */
+static struct hostent *
+_res_search_multi(name, rtl, errp)
+ const char *name; /* domain name */
+ struct __res_type_list *rtl; /* list of query types */
+ int *errp;
+{
+ const char *cp, * const *domain;
+ struct hostent *hp0 = NULL, *hp;
+ struct hostent hpbuf;
+ u_int dots;
+ int trailing_dot, ret, saved_herrno;
+ int got_nodata = 0, got_servfail = 0, tried_as_is = 0;
+ struct __res_type_list *rtl0 = rtl;
+ querybuf buf;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ *errp = NETDB_INTERNAL;
+ return (NULL);
+ }
+ dots = 0;
+ for (cp = name; *cp; cp++)
+ dots += (*cp == '.');
+ trailing_dot = 0;
+ if (cp > name && *--cp == '.')
+ trailing_dot++;
+
+ /* If there aren't any dots, it could be a user-level alias */
+ if (!dots && (cp = hostalias(name)) != NULL) {
+ for(rtl = rtl0; rtl != NULL;
+ rtl = rtl->rtl_entry) {
+ ret = res_query(cp, C_IN, rtl->rtl_type, buf.buf,
+ sizeof(buf.buf));
+ if (ret > 0) {
+ hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA)
+ ? AF_INET6 : AF_INET;
+ hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype);
+ hp = getanswer(&buf, ret, name, rtl->rtl_type,
+ &hpbuf, errp);
+ if (!hp)
+ continue;
+ hp = _hpcopy(&hpbuf, errp);
+ hp0 = _hpmerge(hp0, hp, errp);
+ }
+ }
+ return (hp0);
+ }
+
+ /*
+ * If there are dots in the name already, let's just give it a try
+ * 'as is'. The threshold can be set with the "ndots" option.
+ */
+ saved_herrno = -1;
+ if (dots >= _res.ndots) {
+ for(rtl = rtl0; rtl != NULL;
+ rtl = rtl->rtl_entry) {
+ ret = res_querydomain(name, NULL, C_IN, rtl->rtl_type,
+ buf.buf, sizeof(buf.buf));
+ if (ret > 0) {
+ hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA)
+ ? AF_INET6 : AF_INET;
+ hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype);
+ hp = getanswer(&buf, ret, name, rtl->rtl_type,
+ &hpbuf, errp);
+ if (!hp)
+ continue;
+ hp = _hpcopy(&hpbuf, errp);
+ hp0 = _hpmerge(hp0, hp, errp);
+ }
+ }
+ if (hp0 != NULL)
+ return (hp0);
+ saved_herrno = *errp;
+ tried_as_is++;
+ }
+
+ /*
+ * We do at least one level of search if
+ * - there is no dot and RES_DEFNAME is set, or
+ * - there is at least one dot, there is no trailing dot,
+ * and RES_DNSRCH is set.
+ */
+ if ((!dots && (_res.options & RES_DEFNAMES)) ||
+ (dots && !trailing_dot && (_res.options & RES_DNSRCH))) {
+ int done = 0;
+
+ for (domain = (const char * const *)_res.dnsrch;
+ *domain && !done;
+ domain++) {
+
+ for(rtl = rtl0; rtl != NULL;
+ rtl = rtl->rtl_entry) {
+ ret = res_querydomain(name, *domain, C_IN,
+ rtl->rtl_type,
+ buf.buf, sizeof(buf.buf));
+ if (ret > 0) {
+ hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA)
+ ? AF_INET6 : AF_INET;
+ hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype);
+ hp = getanswer(&buf, ret, name,
+ rtl->rtl_type, &hpbuf, errp);
+ if (!hp)
+ continue;
+ hp = _hpcopy(&hpbuf, errp);
+ hp0 = _hpmerge(hp0, hp, errp);
+ }
+ }
+ if (hp0 != NULL)
+ return (hp0);
+
+ /*
+ * If no server present, give up.
+ * If name isn't found in this domain,
+ * keep trying higher domains in the search list
+ * (if that's enabled).
+ * On a NO_DATA error, keep trying, otherwise
+ * a wildcard entry of another type could keep us
+ * from finding this entry higher in the domain.
+ * If we get some other error (negative answer or
+ * server failure), then stop searching up,
+ * but try the input name below in case it's
+ * fully-qualified.
+ */
+ if (errno == ECONNREFUSED) {
+ *errp = TRY_AGAIN;
+ return (NULL);
+ }
+
+ switch (*errp) {
+ case NO_DATA:
+ got_nodata++;
+ /* FALLTHROUGH */
+ case HOST_NOT_FOUND:
+ /* keep trying */
+ break;
+ case TRY_AGAIN:
+ if (buf.hdr.rcode == SERVFAIL) {
+ /* try next search element, if any */
+ got_servfail++;
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ /* anything else implies that we're done */
+ done++;
+ }
+
+ /* if we got here for some reason other than DNSRCH,
+ * we only wanted one iteration of the loop, so stop.
+ */
+ if (!(_res.options & RES_DNSRCH))
+ done++;
+ }
+ }
+
+ /*
+ * If we have not already tried the name "as is", do that now.
+ * note that we do this regardless of how many dots were in the
+ * name or whether it ends with a dot unless NOTLDQUERY is set.
+ */
+ if (!tried_as_is && (dots || !(_res.options & RES_NOTLDQUERY))) {
+ for(rtl = rtl0; rtl != NULL;
+ rtl = rtl->rtl_entry) {
+ ret = res_querydomain(name, NULL, C_IN, rtl->rtl_type,
+ buf.buf, sizeof(buf.buf));
+ if (ret > 0) {
+ hpbuf.h_addrtype = (rtl->rtl_type == T_AAAA)
+ ? AF_INET6 : AF_INET;
+ hpbuf.h_length = ADDRLEN(hpbuf.h_addrtype);
+ hp = getanswer(&buf, ret, name, rtl->rtl_type,
+ &hpbuf, errp);
+ if (!hp)
+ continue;
+ hp = _hpcopy(&hpbuf, errp);
+ hp0 = _hpmerge(hp0, hp, errp);
+ }
+ }
+ if (hp0 != NULL)
+ return (hp0);
+ }
+
+ /* if we got here, we didn't satisfy the search.
+ * if we did an initial full query, return that query's h_errno
+ * (note that we wouldn't be here if that query had succeeded).
+ * else if we ever got a nodata, send that back as the reason.
+ * else send back meaningless h_errno, that being the one from
+ * the last DNSRCH we did.
+ */
+ if (saved_herrno != -1)
+ *errp = saved_herrno;
+ else if (got_nodata)
+ *errp = NO_DATA;
+ else if (got_servfail)
+ *errp = TRY_AGAIN;
+ return (NULL);
+}
+
+static int
+_dns_ghbyname(void *rval, void *cb_data, va_list ap)
+{
+ const char *name;
+ int af;
+ int *errp;
+ res_type_list *rtl, rtl4;
+#ifdef INET6
+ res_type_list rtl6;
+#endif
+
+ name = va_arg(ap, const char *);
+ af = va_arg(ap, int);
+ errp = va_arg(ap, int *);
+
+#ifdef INET6
+ switch (af) {
+ case AF_UNSPEC:
+ rtl4.rtl_entry = NULL; rtl4.rtl_type = T_A;
+ rtl6.rtl_entry = &rtl4; rtl6.rtl_type = T_AAAA;
+ rtl = &rtl6;
+ break;
+ case AF_INET6:
+ rtl6.rtl_entry = NULL; rtl6.rtl_type = T_AAAA;
+ rtl = &rtl6;
+ break;
+ case AF_INET:
+ rtl4.rtl_entry = NULL; rtl4.rtl_type = T_A;
+ rtl = &rtl4;
+ break;
+ }
+#else
+ (&rtl4)->rtl_entry = NULL;
+ rtl4.rtl_type = T_A;
+ rtl = &rtl4;
+#endif
+ *(struct hostent **)rval = _res_search_multi(name, rtl, errp);
+ return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND;
+}
+
+static int
+_dns_ghbyaddr(void *rval, void *cb_data, va_list ap)
+{
+ const void *addr;
+ int addrlen;
+ int af;
+ int *errp;
+ int n;
+ struct hostent *hp;
+ u_char c, *cp;
+ char *bp;
+ struct hostent hbuf;
+ int na;
+#ifdef INET6
+ static const char hex[] = "0123456789abcdef";
+#endif
+ querybuf buf;
+ char qbuf[MAXDNAME+1];
+ char *hlist[2];
+
+ addr = va_arg(ap, const void *);
+ addrlen = va_arg(ap, int);
+ af = va_arg(ap, int);
+ errp = va_arg(ap, int *);
+
+ *(struct hostent **)rval = NULL;
+
+#ifdef INET6
+ /* XXX */
+ if (af == AF_INET6 && IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)addr))
+ return NS_NOTFOUND;
+#endif
+
+ if ((_res.options & RES_INIT) == 0) {
+ if (res_init() < 0) {
+ *errp = h_errno;
+ return NS_UNAVAIL;
+ }
+ }
+ memset(&hbuf, 0, sizeof(hbuf));
+ hbuf.h_name = NULL;
+ hbuf.h_addrtype = af;
+ hbuf.h_length = addrlen;
+ na = 0;
+
+ /* XXX assumes that MAXDNAME is big enough */
+ n = 0;
+ bp = qbuf;
+ cp = (u_char *)addr+addrlen-1;
+ switch (af) {
+#ifdef INET6
+ case AF_INET6:
+ for (; n < addrlen; n++, cp--) {
+ c = *cp;
+ *bp++ = hex[c & 0xf];
+ *bp++ = '.';
+ *bp++ = hex[c >> 4];
+ *bp++ = '.';
+ }
+ strcpy(bp, "ip6.int");
+ break;
+#endif
+ default:
+ for (; n < addrlen; n++, cp--) {
+ c = *cp;
+ if (c >= 100)
+ *bp++ = '0' + c / 100;
+ if (c >= 10)
+ *bp++ = '0' + (c % 100) / 10;
+ *bp++ = '0' + c % 10;
+ *bp++ = '.';
+ }
+ strcpy(bp, "in-addr.arpa");
+ break;
+ }
+
+ n = res_query(qbuf, C_IN, T_PTR, buf.buf, sizeof buf.buf);
+ if (n < 0) {
+ *errp = h_errno;
+ return NS_UNAVAIL;
+ }
+ hp = getanswer(&buf, n, qbuf, T_PTR, &hbuf, errp);
+ if (!hp)
+ return NS_NOTFOUND;
+ hbuf.h_addrtype = af;
+ hbuf.h_length = addrlen;
+ hbuf.h_addr_list = hlist;
+ hlist[0] = (char *)addr;
+ hlist[1] = NULL;
+ *(struct hostent **)rval = _hpcopy(&hbuf, errp);
+ return NS_SUCCESS;
+}
+
+#if 0 // keep gcc happy
+static void
+_dns_shent(int stayopen)
+{
+ if ((_res.options & RES_INIT) == 0) {
+ if (res_init() < 0)
+ return;
+ }
+ if (stayopen)
+ _res.options |= RES_STAYOPEN | RES_USEVC;
+}
+
+static void
+_dns_ehent(void)
+{
+ _res.options &= ~(RES_STAYOPEN | RES_USEVC);
+ res_close();
+}
+#endif
+
+#ifdef ICMPNL
+
+/*
+ * experimental:
+ * draft-ietf-ipngwg-icmp-namelookups-02.txt
+ * ifindex is assumed to be encoded in addr.
+ */
+#include <sys/uio.h>
+#include <netinet/ip6.h>
+#include <netinet/icmp6.h>
+
+struct _icmp_host_cache {
+ struct _icmp_host_cache *hc_next;
+ int hc_ifindex;
+ struct in6_addr hc_addr;
+ char *hc_name;
+};
+
+static char *
+_icmp_fqdn_query(const struct in6_addr *addr, int ifindex)
+{
+ int s;
+ struct icmp6_filter filter;
+ struct msghdr msg;
+ struct cmsghdr *cmsg;
+ struct in6_pktinfo *pkt;
+ char cbuf[256];
+ char buf[1024];
+ int cc;
+ struct icmp6_fqdn_query *fq;
+ struct icmp6_fqdn_reply *fr;
+ struct _icmp_host_cache *hc;
+ struct sockaddr_in6 sin6;
+ struct iovec iov;
+ fd_set s_fds, fds;
+ struct timeval tout;
+ int len;
+ char *name;
+ static int pid;
+ static struct _icmp_host_cache *hc_head;
+
+ for (hc = hc_head; hc; hc = hc->hc_next) {
+ if (hc->hc_ifindex == ifindex
+ && IN6_ARE_ADDR_EQUAL(&hc->hc_addr, addr))
+ return hc->hc_name;
+ }
+
+ if (pid == 0)
+ pid = getpid();
+
+ ICMP6_FILTER_SETBLOCKALL(&filter);
+ ICMP6_FILTER_SETPASS(ICMP6_FQDN_REPLY, &filter);
+
+ FD_ZERO(&s_fds);
+ tout.tv_sec = 0;
+ tout.tv_usec = 200000; /*XXX: 200ms*/
+
+ fq = (struct icmp6_fqdn_query *)buf;
+ fq->icmp6_fqdn_type = ICMP6_FQDN_QUERY;
+ fq->icmp6_fqdn_code = 0;
+ fq->icmp6_fqdn_cksum = 0;
+ fq->icmp6_fqdn_id = (u_short)pid;
+ fq->icmp6_fqdn_unused = 0;
+ fq->icmp6_fqdn_cookie[0] = 0;
+ fq->icmp6_fqdn_cookie[1] = 0;
+
+ memset(&sin6, 0, sizeof(sin6));
+ sin6.sin6_family = AF_INET6;
+ sin6.sin6_addr = *addr;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_name = (caddr_t)&sin6;
+ msg.msg_namelen = sizeof(sin6);
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+ iov.iov_base = (caddr_t)buf;
+ iov.iov_len = sizeof(struct icmp6_fqdn_query);
+
+ if (ifindex) {
+ msg.msg_control = cbuf;
+ msg.msg_controllen = sizeof(cbuf);
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
+ cmsg->cmsg_level = IPPROTO_IPV6;
+ cmsg->cmsg_type = IPV6_PKTINFO;
+ pkt = (struct in6_pktinfo *)&cmsg[1];
+ memset(&pkt->ipi6_addr, 0, sizeof(struct in6_addr));
+ pkt->ipi6_ifindex = ifindex;
+ cmsg = CMSG_NXTHDR(&msg, cmsg);
+ msg.msg_controllen = (char *)cmsg - cbuf;
+ }
+
+ if ((s = socket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) < 0)
+ return NULL;
+ (void)setsockopt(s, IPPROTO_ICMPV6, ICMP6_FILTER,
+ (char *)&filter, sizeof(filter));
+ cc = _sendmsg(s, &msg, 0);
+ if (cc < 0) {
+ close(s);
+ return NULL;
+ }
+ FD_SET(s, &s_fds);
+ for (;;) {
+ fds = s_fds;
+ if (select(s + 1, &fds, NULL, NULL, &tout) <= 0) {
+ close(s);
+ return NULL;
+ }
+ len = sizeof(sin6);
+ cc = _recvfrom(s, buf, sizeof(buf), 0,
+ (struct sockaddr *)&sin6, &len);
+ if (cc <= 0) {
+ close(s);
+ return NULL;
+ }
+ if (cc < sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr))
+ continue;
+ if (!IN6_ARE_ADDR_EQUAL(addr, &sin6.sin6_addr))
+ continue;
+ fr = (struct icmp6_fqdn_reply *)(buf + sizeof(struct ip6_hdr));
+ if (fr->icmp6_fqdn_type == ICMP6_FQDN_REPLY)
+ break;
+ }
+ close(s);
+ if (fr->icmp6_fqdn_cookie[1] != 0) {
+ /* rfc1788 type */
+ name = buf + sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) + 4;
+ len = (buf + cc) - name;
+ } else {
+ len = fr->icmp6_fqdn_namelen;
+ name = fr->icmp6_fqdn_name;
+ }
+ if (len <= 0)
+ return NULL;
+ name[len] = 0;
+
+ if ((hc = (struct _icmp_host_cache *)malloc(sizeof(*hc))) == NULL)
+ return NULL;
+ /* XXX: limit number of cached entries */
+ hc->hc_ifindex = ifindex;
+ hc->hc_addr = *addr;
+ hc->hc_name = strdup(name);
+ hc->hc_next = hc_head;
+ hc_head = hc;
+ return hc->hc_name;
+}
+
+static struct hostent *
+_icmp_ghbyaddr(const void *addr, int addrlen, int af, int *errp)
+{
+ char *hname;
+ int ifindex;
+ struct in6_addr addr6;
+
+ if (af != AF_INET6) {
+ /*
+ * Note: rfc1788 defines Who Are You for IPv4,
+ * but no one implements it.
+ */
+ return NULL;
+ }
+
+ memcpy(&addr6, addr, addrlen);
+ ifindex = (addr6.s6_addr[2] << 8) | addr6.s6_addr[3];
+ addr6.s6_addr[2] = addr6.s6_addr[3] = 0;
+
+ if (!IN6_IS_ADDR_LINKLOCAL(&addr6))
+ return NULL; /*XXX*/
+
+ if ((hname = _icmp_fqdn_query(&addr6, ifindex)) == NULL)
+ return NULL;
+ return _hpaddr(af, hname, &addr6, errp);
+}
+#endif /* ICMPNL */
diff --git a/newlib/libc/sys/linux/net/namespace.h b/newlib/libc/sys/linux/net/namespace.h
new file mode 100644
index 000000000..291aad580
--- /dev/null
+++ b/newlib/libc/sys/linux/net/namespace.h
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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.
+ *
+ * $FreeBSD: src/lib/libc/include/namespace.h,v 1.9 2002/03/29 22:43:42 markm Exp $
+ */
+
+#ifndef _NAMESPACE_H_
+#define _NAMESPACE_H_
+
+/*
+ * Adjust names so that headers declare "hidden" names.
+ */
+
+/*
+ * ISO C (C90) section. Most names in libc aren't in ISO C, so they
+ * should be here. Most aren't here...
+ */
+#define err _err
+#define warn _warn
+
+/*
+ * Prototypes for syscalls/functions that need to be overridden
+ * in libc_r/libpthread.
+ */
+#define accept _accept
+#define __acl_aclcheck_fd ___acl_aclcheck_fd
+#define __acl_delete_fd ___acl_delete_fd
+#define __acl_get_fd ___acl_get_fd
+#define __acl_set_fd ___acl_set_fd
+#define bind _bind
+#define __cap_get_fd ___cap_get_fd
+#define __cap_set_fd ___cap_set_fd
+#define close _close
+#define connect _connect
+#define dup _dup
+#define dup2 _dup2
+#define execve _execve
+#define fcntl _fcntl
+/*#define flock _flock */
+#define fstat _fstat
+#define fstatfs _fstatfs
+#define fsync _fsync
+#define getdirentries _getdirentries
+#define getlogin _getlogin
+#define getpeername _getpeername
+#define getprogname _getprogname
+#define getsockname _getsockname
+#define getsockopt _getsockopt
+#define ioctl _ioctl
+#define listen _listen
+#define nanosleep _nanosleep
+#define open _open
+#define poll _poll
+#define pthread_cond_signal _pthread_cond_signal
+#define pthread_cond_wait _pthread_cond_wait
+#define pthread_cond_init _pthread_cond_init
+#define pthread_exit _pthread_exit
+#define pthread_getspecific _pthread_getspecific
+#define pthread_key_create _pthread_key_create
+#define pthread_key_delete _pthread_key_delete
+#define pthread_main_np _pthread_main_np
+#define pthread_mutex_destroy _pthread_mutex_destroy
+#define pthread_mutex_init _pthread_mutex_init
+#define pthread_mutex_lock _pthread_mutex_lock
+#define pthread_mutex_trylock _pthread_mutex_trylock
+#define pthread_mutex_unlock _pthread_mutex_unlock
+#define pthread_mutexattr_init _pthread_mutexattr_init
+#define pthread_mutexattr_destroy _pthread_mutexattr_destroy
+#define pthread_mutexattr_settype _pthread_mutexattr_settype
+#define pthread_once _pthread_once
+#define pthread_rwlock_init _pthread_rwlock_init
+#define pthread_rwlock_rdlock _pthread_rwlock_rdlock
+#define pthread_rwlock_wrlock _pthread_rwlock_wrlock
+#define pthread_rwlock_unlock _pthread_rwlock_unlock
+#define pthread_self _pthread_self
+#define pthread_setspecific _pthread_setspecific
+#define pthread_sigmask _pthread_sigmask
+#define read _read
+#define readv _readv
+#define recvfrom _recvfrom
+#define recvmsg _recvmsg
+#define select _select
+#define sendmsg _sendmsg
+#define sendto _sendto
+#define setsockopt _setsockopt
+/*#define sigaction _sigaction*/
+#define sigprocmask _sigprocmask
+#define sigsuspend _sigsuspend
+#define socket _socket
+#define socketpair _socketpair
+#define wait4 _wait4
+#define write _write
+#define writev _writev
+
+
+/*
+ * Other hidden syscalls/functions that libc_r needs to override
+ * but are not used internally by libc.
+ *
+ * XXX - When modifying libc to use one of the following, remove
+ * the prototype from below and place it in the list above.
+ */
+#if 0
+#define creat _creat
+#define fchflags _fchflags
+#define fchmod _fchmod
+#define fpathconf _fpathconf
+#define msync _msync
+#define nfssvc _nfssvc
+#define pause _pause
+#define pthread_rwlock_destroy _pthread_rwlock_destroy
+#define pthread_rwlock_tryrdlock _pthread_rwlock_tryrdlock
+#define pthread_rwlock_trywrlock _pthread_rwlock_trywrlock
+#define pthread_rwlockattr_init _pthread_rwlockattr_init
+#define pthread_rwlockattr_destroy _pthread_rwlockattr_destroy
+#define sched_yield _sched_yield
+#define sendfile _sendfile
+#define shutdown _shutdown
+#define sigaltstack _sigaltstack
+#define sigpending _sigpending
+#define sigreturn _sigreturn
+#define sigsetmask _sigsetmask
+#define sleep _sleep
+#define system _system
+#define tcdrain _tcdrain
+#define wait _wait
+#define waitpid _waitpid
+#endif
+
+#endif /* _NAMESPACE_H_ */
diff --git a/newlib/libc/sys/linux/net/netgroup.h b/newlib/libc/sys/linux/net/netgroup.h
deleted file mode 100644
index c6b77ba52..000000000
--- a/newlib/libc/sys/linux/net/netgroup.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Internal header for netgroup related functions.
- Copyright (C) 1996, 1997, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _NETGROUP_H
-#define _NETGROUP_H 1
-
-#include <nsswitch.h>
-
-/* A netgroup can consist of names of other netgroups. We have to
- track which netgroups were read and which still have to be read. */
-struct name_list
-{
- struct name_list *next;
- char name[0];
-};
-
-
-/* Dataset for iterating netgroups. */
-struct __netgrent
-{
- enum { triple_val, group_val } type;
-
- union
- {
- struct
- {
- const char *host;
- const char *user;
- const char *domain;
- }
- triple;
-
- const char *group;
- } val;
-
- /* Room for the data kept between the calls to the netgroup
- functions. We must avoid global variables. */
- char *data;
- size_t data_size;
- union
- {
- char *cursor;
- unsigned long int position;
- };
- int first;
-
- struct name_list *known_groups;
- struct name_list *needed_groups;
-
- /* This handle for the NSS data base is shared between all
- set/get/endXXXent functions. */
- service_user *nip;
-};
-
-
-/* The internal netgroup handling functions might be called from outside. */
-extern int __internal_setnetgrent (const char *group,
- struct __netgrent *datap);
-extern void __internal_endnetgrent (struct __netgrent *datap);
-extern int __internal_getnetgrent_r (char **hostp, char **userp,
- char **domainp, struct __netgrent *datap,
- char *buffer, size_t buflen, int *errnop);
-
-#endif /* netgroup.h */
diff --git a/newlib/libc/sys/linux/net/netgrp-lookup.c b/newlib/libc/sys/linux/net/netgrp-lookup.c
deleted file mode 100644
index 526755a53..000000000
--- a/newlib/libc/sys/linux/net/netgrp-lookup.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME netgroup
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/network-lookup.c b/newlib/libc/sys/linux/net/network-lookup.c
deleted file mode 100644
index 8bfaab8dd..000000000
--- a/newlib/libc/sys/linux/net/network-lookup.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME networks
-#define DEFAULT_CONFIG "dns [!UNAVAIL=return] files"
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/not-cancel.h b/newlib/libc/sys/linux/net/not-cancel.h
deleted file mode 100644
index 9dd7d30bb..000000000
--- a/newlib/libc/sys/linux/net/not-cancel.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Uncancelable versions of cancelable interfaces. Linux version.
- Copyright (C) 2003 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <machine/syscall.h>
-
-/* Uncancelable open. */
-#define open_not_cancel(name, flags, mode) open((name), (flags), (mode))
-#define open_not_cancel_2(name, flags) open((name), (flags))
-
-/* Uncancelable close. */
-#define close_not_cancel(fd) close((fd))
-#define close_not_cancel_no_status(fd) (void)close((fd))
-
-/* Uncancelable read. */
-#define read_not_cancel(fd, buf, n) read((fd), (buf), (n))
-
-/* Uncancelable write. */
-#define write_not_cancel(fd, buf, n) write((fd), (buf), (n))
-
-/* Uncancelable writev. */
-#define writev_not_cancel_no_status(fd, iov, n) \
- (void) writev((fd), (iov), (n))
-
-/* Uncancelable fcntl. */
-#define fcntl_not_cancel(fd, cmd, val) fcntl((fd), (cmd), (val))
-
-/* Uncancelable waitpid. */
-#ifdef __NR_waitpid
-# define waitpid_not_cancel(pid, stat_loc, options) \
- waitpid((pid), (stat_loc), (options))
-#else
-# define waitpid_not_cancel(pid, stat_loc, options) \
- wait4((pid), (stat_loc), (options), NULL)
-#endif
diff --git a/newlib/libc/sys/linux/net/ns.3 b/newlib/libc/sys/linux/net/ns.3
new file mode 100644
index 000000000..be8d155c3
--- /dev/null
+++ b/newlib/libc/sys/linux/net/ns.3
@@ -0,0 +1,133 @@
+.\" Copyright (c) 1986, 1991, 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.
+.\"
+.\" @(#)ns.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/ns.3,v 1.10 2001/10/01 16:08:56 ru Exp $
+.\"
+.Dd June 4, 1993
+.Dt NS 3
+.Os
+.Sh NAME
+.Nm ns_addr ,
+.Nm ns_ntoa
+.Nd Xerox
+.Tn NS Ns (tm)
+address conversion routines
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In netns/ns.h
+.Ft struct ns_addr
+.Fn ns_addr "char *cp"
+.Ft char *
+.Fn ns_ntoa "struct ns_addr ns"
+.Sh DESCRIPTION
+The routine
+.Fn ns_addr
+interprets character strings representing
+.Tn XNS
+addresses, returning binary information suitable
+for use in system calls.
+The routine
+.Fn ns_ntoa
+takes
+.Tn XNS
+addresses and returns
+.Tn ASCII
+strings representing the address in a
+notation in common use in the Xerox Development Environment:
+.Bd -ragged -offset indent
+<network number>.<host number>.<port number>
+.Ed
+.Pp
+Trailing zero fields are suppressed, and each number is printed in hexadecimal,
+in a format suitable for input to
+.Fn ns_addr .
+Any fields lacking super-decimal digits will have a
+trailing
+.Ql H
+appended.
+.Pp
+Unfortunately, no universal standard exists for representing
+.Tn XNS
+addresses.
+An effort has been made to insure that
+.Fn ns_addr
+be compatible with most formats in common use.
+It will first separate an address into 1 to 3 fields using a single delimiter
+chosen from
+period
+.Ql \&. ,
+colon
+.Ql \&:
+or pound-sign
+.Ql \&# .
+Each field is then examined for byte separators (colon or period).
+If there are byte separators, each subfield separated is taken to be
+a small hexadecimal number, and the entirety is taken as a network-byte-ordered
+quantity to be zero extended in the high-network-order bytes.
+Next, the field is inspected for hyphens, in which case
+the field is assumed to be a number in decimal notation
+with hyphens separating the millenia.
+Next, the field is assumed to be a number:
+It is interpreted
+as hexadecimal if there is a leading
+.Ql 0x
+(as in C),
+a trailing
+.Ql H
+(as in Mesa), or there are any super-decimal digits present.
+It is interpreted as octal is there is a leading
+.Ql 0
+and there are no super-octal digits.
+Otherwise, it is converted as a decimal number.
+.Sh RETURN VALUES
+None. (See
+.Sx BUGS . )
+.Sh SEE ALSO
+.Xr hosts 5 ,
+.Xr networks 5
+.Sh HISTORY
+The
+.Fn ns_addr
+and
+.Fn ns_toa
+functions appeared in
+.Bx 4.3 .
+.Sh BUGS
+The string returned by
+.Fn ns_ntoa
+resides in a static memory area.
+The function
+.Fn ns_addr
+should diagnose improperly formed input, and there should be an unambiguous
+way to recognize this.
diff --git a/newlib/libc/sys/linux/net/ns_addr.c b/newlib/libc/sys/linux/net/ns_addr.c
new file mode 100644
index 000000000..a86cf31b7
--- /dev/null
+++ b/newlib/libc/sys/linux/net/ns_addr.c
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * J.Q. Johnson.
+ *
+ * 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ns_addr.c 8.1 (Berkeley) 6/7/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <arpa/inet.h>
+#include <netns/ns.h>
+#include <stdio.h>
+#include <string.h>
+
+static struct ns_addr addr, zero_addr;
+
+static void Field(), cvtbase();
+
+struct ns_addr
+ns_addr(name)
+ const char *name;
+{
+ char separator;
+ char *hostname, *socketname, *cp;
+ char buf[50];
+
+ (void)strncpy(buf, name, sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
+
+ /*
+ * First, figure out what he intends as a field separtor.
+ * Despite the way this routine is written, the preferred
+ * form 2-272.AA001234H.01777, i.e. XDE standard.
+ * Great efforts are made to insure backward compatibility.
+ */
+ if ((hostname = strchr(buf, '#')) != NULL)
+ separator = '#';
+ else {
+ hostname = strchr(buf, '.');
+ if ((cp = strchr(buf, ':')) &&
+ ((hostname && cp < hostname) || (hostname == 0))) {
+ hostname = cp;
+ separator = ':';
+ } else
+ separator = '.';
+ }
+ if (hostname)
+ *hostname++ = 0;
+
+ addr = zero_addr;
+ Field(buf, addr.x_net.c_net, 4);
+ if (hostname == 0)
+ return (addr); /* No separator means net only */
+
+ socketname = strchr(hostname, separator);
+ if (socketname) {
+ *socketname++ = 0;
+ Field(socketname, (u_char *)&addr.x_port, 2);
+ }
+
+ Field(hostname, addr.x_host.c_host, 6);
+
+ return (addr);
+}
+
+static void
+Field(buf, out, len)
+ char *buf;
+ u_char *out;
+ int len;
+{
+ char *bp = buf;
+ int i, ibase, base16 = 0, base10 = 0, clen = 0;
+ int hb[6], *hp;
+
+ /*
+ * first try 2-273#2-852-151-014#socket
+ */
+ if ((*buf != '-') &&
+ (1 < (i = sscanf(buf, "%d-%d-%d-%d-%d",
+ &hb[0], &hb[1], &hb[2], &hb[3], &hb[4])))) {
+ cvtbase(1000L, 256, hb, i, out, len);
+ return;
+ }
+ /*
+ * try form 8E1#0.0.AA.0.5E.E6#socket
+ */
+ if (1 < (i = sscanf(buf,"%x.%x.%x.%x.%x.%x",
+ &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) {
+ cvtbase(256L, 256, hb, i, out, len);
+ return;
+ }
+ /*
+ * try form 8E1#0:0:AA:0:5E:E6#socket
+ */
+ if (1 < (i = sscanf(buf,"%x:%x:%x:%x:%x:%x",
+ &hb[0], &hb[1], &hb[2], &hb[3], &hb[4], &hb[5]))) {
+ cvtbase(256L, 256, hb, i, out, len);
+ return;
+ }
+ /*
+ * This is REALLY stretching it but there was a
+ * comma notation separting shorts -- definitely non standard
+ */
+ if (1 < (i = sscanf(buf,"%x,%x,%x",
+ &hb[0], &hb[1], &hb[2]))) {
+ hb[0] = htons(hb[0]); hb[1] = htons(hb[1]);
+ hb[2] = htons(hb[2]);
+ cvtbase(65536L, 256, hb, i, out, len);
+ return;
+ }
+
+ /* Need to decide if base 10, 16 or 8 */
+ while (*bp) switch (*bp++) {
+
+ case '0': case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '-':
+ break;
+
+ case '8': case '9':
+ base10 = 1;
+ break;
+
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ base16 = 1;
+ break;
+
+ case 'x': case 'X':
+ *--bp = '0';
+ base16 = 1;
+ break;
+
+ case 'h': case 'H':
+ base16 = 1;
+ /* fall into */
+
+ default:
+ *--bp = 0; /* Ends Loop */
+ }
+ if (base16) {
+ ibase = 4096;
+ } else if (base10 == 0 && *buf == '0') {
+ ibase = 512;
+ } else {
+ base10 = 1;
+ ibase = 1000;
+ }
+
+ for (bp = buf; *bp++; ) clen++;
+ if (clen == 0) clen++;
+ if (clen > 18) clen = 18;
+ i = ((clen - 1) / 3) + 1;
+ bp = clen + buf - 3;
+ hp = hb + i - 1;
+
+ while (hp > hb) {
+ if (base16)
+ (void)sscanf(bp, "%3x", hp);
+ else if (base10)
+ (void)sscanf(bp, "%3d", hp);
+ else
+ (void)sscanf(bp, "%3o", hp);
+
+ bp[0] = 0;
+ hp--;
+ bp -= 3;
+ }
+ if (base16)
+ (void)sscanf(buf, "%3x", hp);
+ else if (base10)
+ (void)sscanf(buf, "%3d", hp);
+ else
+ (void)sscanf(buf, "%3o", hp);
+
+ cvtbase((long)ibase, 256, hb, i, out, len);
+}
+
+static void
+cvtbase(oldbase,newbase,input,inlen,result,reslen)
+ long oldbase;
+ int newbase;
+ int input[];
+ int inlen;
+ unsigned char result[];
+ int reslen;
+{
+ int d, e;
+ long sum;
+
+ e = 1;
+ while (e > 0 && reslen > 0) {
+ d = 0; e = 0; sum = 0;
+ /* long division: input=input/newbase */
+ while (d < inlen) {
+ sum = sum*oldbase + (long) input[d];
+ e += (sum > 0);
+ input[d++] = sum / newbase;
+ sum %= newbase;
+ }
+ result[--reslen] = sum; /* accumulate remainder */
+ }
+ for (d=0; d < reslen; d++)
+ result[d] = 0;
+}
diff --git a/newlib/libc/sys/linux/net/ns_name.c b/newlib/libc/sys/linux/net/ns_name.c
index d6c4cc8b5..609df14f5 100644
--- a/newlib/libc/sys/linux/net/ns_name.c
+++ b/newlib/libc/sys/linux/net/ns_name.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996,1999 by Internet Software Consortium.
+ * Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,25 +15,21 @@
* SOFTWARE.
*/
-#if !defined(_LIBC) && !defined(lint)
-static const char rcsid[] = "$BINDId: ns_name.c,v 8.15 2000/03/30 22:53:46 vixie Exp $";
-#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
-#include <ctype.h>
#include <errno.h>
#include <resolv.h>
#include <string.h>
-#include <ctype.h>
-#include "libc-symbols.h"
/* Data. */
-static const char digits[] = "0123456789";
+static char digits[] = "0123456789";
/* Forward. */
@@ -66,57 +62,34 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
eom = dst + dstsiz;
while ((n = *cp++) != 0) {
- if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) {
+ if ((n & NS_CMPRSFLGS) != 0) {
/* Some kind of compression pointer. */
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
if (dn != dst) {
if (dn >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*dn++ = '.';
}
-
- if (n == 0x41) {
- n = *cp++ / 8;
- if (dn + n * 2 + 4 >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *dn++ = '\\';
- *dn++ = '[';
- *dn++ = 'x';
-
- while (n-- > 0) {
- c = *cp++;
- unsigned u = c >> 4;
- *dn++ = u > 9 ? 'a' + u - 10 : '0' + u;
- u = c & 0xf;
- *dn++ = u > 9 ? 'a' + u - 10 : '0' + u;
- }
-
- *dn++ = ']';
- continue;
- }
-
if (dn + n >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
for ((void)NULL; n > 0; n--) {
c = *cp++;
if (special(c)) {
if (dn + 1 >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*dn++ = '\\';
*dn++ = (char)c;
} else if (!printable(c)) {
if (dn + 3 >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*dn++ = '\\';
@@ -125,7 +98,7 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
*dn++ = digits[c % 10];
} else {
if (dn >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*dn++ = (char)c;
@@ -134,19 +107,18 @@ ns_name_ntop(const u_char *src, char *dst, size_t dstsiz) {
}
if (dn == dst) {
if (dn >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*dn++ = '.';
}
if (dn >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*dn++ = '\0';
return (dn - dst);
}
-libresolv_hidden_def (ns_name_ntop)
/*
* ns_name_pton(src, dst, dstsiz)
@@ -176,56 +148,21 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
n = (cp - digits) * 100;
if ((c = *src++) == 0 ||
(cp = strchr(digits, c)) == NULL) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
n += (cp - digits) * 10;
if ((c = *src++) == 0 ||
(cp = strchr(digits, c)) == NULL) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
n += (cp - digits);
if (n > 255) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
c = n;
- } else if (c == '[' && label == bp - 1 && *src == 'x') {
- /* Theoretically we would have to handle \[o
- as well but we do not since we do not need
- it internally. */
- *label = 0x41;
- label = bp++;
- ++src;
- while (isxdigit (*src)) {
- n = *src > '9' ? *src - 'a' + 10 : *src - '0';
- ++src;
- if (! isxdigit(*src)) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- n <<= 4;
- n += *src > '9' ? *src - 'a' + 10 : *src - '0';
- if (bp + 1 >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *bp++ = n;
- ++src;
- }
- *label = (bp - label - 1) * 8;
- if (*src++ != ']' || *src++ != '.') {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- escaped = 0;
- label = bp++;
- if (bp >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- continue;
}
escaped = 0;
} else if (c == '\\') {
@@ -234,11 +171,11 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
} else if (c == '.') {
c = (bp - label - 1);
if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
if (label >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*label = c;
@@ -246,98 +183,55 @@ ns_name_pton(const char *src, u_char *dst, size_t dstsiz) {
if (*src == '\0') {
if (c != 0) {
if (bp >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*bp++ = '\0';
}
if ((bp - dst) > MAXCDNAME) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
return (1);
}
- if (c == 0 || *src == '.') {
- __set_errno (EMSGSIZE);
+ if (c == 0) {
+ errno = EMSGSIZE;
return (-1);
}
label = bp++;
continue;
}
if (bp >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*bp++ = (u_char)c;
}
c = (bp - label - 1);
if ((c & NS_CMPRSFLGS) != 0) { /* Label too big. */
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
if (label >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*label = c;
if (c != 0) {
if (bp >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*bp++ = 0;
}
if ((bp - dst) > MAXCDNAME) { /* src too big */
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
return (0);
}
/*
- * ns_name_ntol(src, dst, dstsiz)
- * Convert a network strings labels into all lowercase.
- * return:
- * Number of bytes written to buffer, or -1 (with errno set)
- * notes:
- * Enforces label and domain length limits.
- */
-
-int
-ns_name_ntol(const u_char *src, u_char *dst, size_t dstsiz) {
- const u_char *cp;
- u_char *dn, *eom;
- u_char c;
- u_int n;
-
- cp = src;
- dn = dst;
- eom = dst + dstsiz;
-
- while ((n = *cp++) != 0) {
- if ((n & NS_CMPRSFLGS) != 0) {
- /* Some kind of compression pointer. */
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *dn++ = n;
- if (dn + n >= eom) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- for ((void)NULL; n > 0; n--) {
- c = *cp++;
- if (isupper(c))
- *dn++ = tolower(c);
- else
- *dn++ = c;
- }
- }
- *dn++ = '\0';
- return (dn - dst);
-}
-
-/*
* ns_name_unpack(msg, eom, src, dst, dstsiz)
* Unpack a domain name from a message, source may be compressed.
* return:
@@ -357,48 +251,36 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
srcp = src;
dstlim = dst + dstsiz;
if (srcp < msg || srcp >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
/* Fetch next label in domain name. */
while ((n = *srcp++) != 0) {
/* Check for indirection. */
switch (n & NS_CMPRSFLGS) {
- case 0x40:
- if (n == 0x41) {
- if (dstp + 1 >= dstlim) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- *dstp++ = 0x41;
- n = *srcp++ / 8;
- ++checked;
- } else {
- __set_errno (EMSGSIZE);
- return (-1); /* flag error */
- }
- /* FALLTHROUGH */
case 0:
/* Limit checks. */
if (dstp + n + 1 >= dstlim || srcp + n >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
checked += n + 1;
- dstp = mempcpy(dstp, srcp - 1, n + 1);
+ *dstp++ = n;
+ memcpy(dstp, srcp, n);
+ dstp += n;
srcp += n;
break;
case NS_CMPRSFLGS:
if (srcp >= eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
if (len < 0)
len = srcp - src + 1;
srcp = msg + (((n & 0x3f) << 8) | (*srcp & 0xff));
if (srcp < msg || srcp >= eom) { /* Out of range. */
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
checked += 2;
@@ -408,13 +290,13 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
* there must be a loop.
*/
if (checked >= eom - msg) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
break;
default:
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1); /* flag error */
}
}
@@ -423,7 +305,6 @@ ns_name_unpack(const u_char *msg, const u_char *eom, const u_char *src,
len = srcp - src;
return (len);
}
-libresolv_hidden_def (ns_name_unpack)
/*
* ns_name_pack(src, dst, dstsiz, dnptrs, lastdnptr)
@@ -449,7 +330,7 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
u_char *dstp;
const u_char **cpp, **lpp, *eob, *msg;
const u_char *srcp;
- int n, l, first = 1;
+ int n, l;
srcp = src;
dstp = dst;
@@ -468,31 +349,29 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
l = 0;
do {
n = *srcp;
- if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) {
- __set_errno (EMSGSIZE);
+ if ((n & NS_CMPRSFLGS) != 0) {
+ errno = EMSGSIZE;
return (-1);
}
- if (n == 0x41)
- n = *++srcp / 8;
l += n + 1;
if (l > MAXCDNAME) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
srcp += n + 1;
} while (n != 0);
- /* from here on we need to reset compression pointer array on error */
srcp = src;
do {
/* Look to see if we can use pointers. */
n = *srcp;
- if (n != 0 && n != 0x41 && msg != NULL) {
+ if (n != 0 && msg != NULL) {
l = dn_find(srcp, msg, (const u_char * const *)dnptrs,
(const u_char * const *)lpp);
if (l >= 0) {
if (dstp + 1 >= eob) {
- goto cleanup;
+ errno = EMSGSIZE;
+ return (-1);
}
*dstp++ = (l >> 8) | NS_CMPRSFLGS;
*dstp++ = l % 256;
@@ -500,24 +379,19 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
}
/* Not found, save it. */
if (lastdnptr != NULL && cpp < lastdnptr - 1 &&
- (dstp - msg) < 0x4000 && first) {
+ (dstp - msg) < 0x4000) {
*cpp++ = dstp;
*cpp = NULL;
- first = 0;
}
}
/* copy label to buffer */
- if ((n & NS_CMPRSFLGS) != 0 && n != 0x41) { /* Should not happen. */
- goto cleanup;
- }
- if (n == 0x41) {
- n = *++srcp / 8;
- if (dstp + 1 >= eob)
- goto cleanup;
- *dstp++ = 0x41;
+ if (n & NS_CMPRSFLGS) { /* Should not happen. */
+ errno = EMSGSIZE;
+ return (-1);
}
if (dstp + 1 + n >= eob) {
- goto cleanup;
+ errno = EMSGSIZE;
+ return (-1);
}
memcpy(dstp, srcp, n + 1);
srcp += n + 1;
@@ -525,12 +399,11 @@ ns_name_pack(const u_char *src, u_char *dst, int dstsiz,
} while (n != 0);
if (dstp > eob) {
-cleanup:
if (msg != NULL)
*lpp = NULL;
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
- }
+ }
return (dstp - dst);
}
@@ -548,7 +421,7 @@ ns_name_uncompress(const u_char *msg, const u_char *eom, const u_char *src,
{
u_char tmp[NS_MAXCDNAME];
int n;
-
+
if ((n = ns_name_unpack(msg, eom, src, tmp, sizeof tmp)) == -1)
return (-1);
if (ns_name_ntop(tmp, dst, dstsiz) == -1)
@@ -582,23 +455,6 @@ ns_name_compress(const char *src, u_char *dst, size_t dstsiz,
}
/*
- * Reset dnptrs so that there are no active references to pointers at or
- * after src.
- */
-void
-ns_name_rollback(const u_char *src, const u_char **dnptrs,
- const u_char **lastdnptr)
-{
- while (dnptrs < lastdnptr && *dnptrs != NULL) {
- if (*dnptrs >= src) {
- *dnptrs = NULL;
- break;
- }
- dnptrs++;
- }
-}
-
-/*
* ns_name_skip(ptrptr, eom)
* Advance *ptrptr to skip over the compressed name it points at.
* return:
@@ -620,13 +476,13 @@ ns_name_skip(const u_char **ptrptr, const u_char *eom) {
cp++;
break;
default: /* illegal type */
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
break;
}
if (cp > eom) {
- __set_errno (EMSGSIZE);
+ errno = EMSGSIZE;
return (-1);
}
*ptrptr = cp;
@@ -700,49 +556,37 @@ dn_find(const u_char *domain, const u_char *msg,
u_int n;
for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
- sp = *cpp;
- /*
- * terminate search on:
- * root label
- * compression pointer
- * unusable offset
- */
- while (*sp != 0 && (*sp & NS_CMPRSFLGS) == 0 &&
- (sp - msg) < 0x4000) {
- dn = domain;
- cp = sp;
- while ((n = *cp++) != 0) {
- /*
- * check for indirection
- */
- switch (n & NS_CMPRSFLGS) {
- case 0: /* normal case, n == len */
- if (n != *dn++)
- goto next;
- for ((void)NULL; n > 0; n--)
- if (mklower(*dn++) !=
- mklower(*cp++))
- goto next;
- /* Is next root for both ? */
- if (*dn == '\0' && *cp == '\0')
- return (sp - msg);
- if (*dn)
- continue;
+ dn = domain;
+ sp = cp = *cpp;
+ while ((n = *cp++) != 0) {
+ /*
+ * check for indirection
+ */
+ switch (n & NS_CMPRSFLGS) {
+ case 0: /* normal case, n == len */
+ if (n != *dn++)
goto next;
-
- case NS_CMPRSFLGS: /* indirection */
- cp = msg + (((n & 0x3f) << 8) | *cp);
- break;
-
- default: /* illegal type */
- __set_errno (EMSGSIZE);
- return (-1);
- }
+ for ((void)NULL; n > 0; n--)
+ if (mklower(*dn++) != mklower(*cp++))
+ goto next;
+ /* Is next root for both ? */
+ if (*dn == '\0' && *cp == '\0')
+ return (sp - msg);
+ if (*dn)
+ continue;
+ goto next;
+
+ case NS_CMPRSFLGS: /* indirection */
+ cp = msg + (((n & 0x3f) << 8) | *cp);
+ break;
+
+ default: /* illegal type */
+ errno = EMSGSIZE;
+ return (-1);
}
- next:
- sp += *sp + 1;
}
+ next: ;
}
- __set_errno (ENOENT);
+ errno = ENOENT;
return (-1);
}
diff --git a/newlib/libc/sys/linux/net/ns_netint.c b/newlib/libc/sys/linux/net/ns_netint.c
index 16282e5a1..18c9cccd6 100644
--- a/newlib/libc/sys/linux/net/ns_netint.c
+++ b/newlib/libc/sys/linux/net/ns_netint.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996,1999 by Internet Software Consortium.
+ * Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,17 +15,16 @@
* SOFTWARE.
*/
-#if !defined(_LIBC) && !defined(lint)
-static const char rcsid[] = "$BINDId: ns_netint.c,v 8.4 1999/10/13 16:39:35 vixie Exp $";
-#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
/* Import. */
-#include <arpa/nameser.h>
-#include <resolv.h>
-#include "libc-symbols.h"
+#include <sys/types.h>
+#include <sys/socket.h>
-/* Public. */
+#include <netinet/in.h>
+#include <arpa/nameser.h>
u_int
ns_get16(const u_char *src) {
@@ -34,7 +33,6 @@ ns_get16(const u_char *src) {
NS_GET16(dst, src);
return (dst);
}
-libresolv_hidden_def (ns_get16)
u_long
ns_get32(const u_char *src) {
@@ -43,7 +41,6 @@ ns_get32(const u_char *src) {
NS_GET32(dst, src);
return (dst);
}
-libresolv_hidden_def (ns_get32)
void
ns_put16(u_int src, u_char *dst) {
diff --git a/newlib/libc/sys/linux/net/ns_ntoa.c b/newlib/libc/sys/linux/net/ns_ntoa.c
new file mode 100644
index 000000000..b6a6c4c22
--- /dev/null
+++ b/newlib/libc/sys/linux/net/ns_ntoa.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1986, 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)ns_ntoa.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
+
+#include <sys/param.h>
+#include <arpa/inet.h>
+#include <netns/ns.h>
+#include <stdio.h>
+
+static char *spectHex(char *p0);
+
+char *
+ns_ntoa(addr)
+ struct ns_addr addr;
+{
+ static char obuf[40];
+ union { union ns_net net_e; u_long long_e; } net;
+ u_short port = htons(addr.x_port);
+ char *cp;
+ char *cp2;
+ u_char *up = addr.x_host.c_host;
+ u_char *uplim = up + 6;
+
+ net.net_e = addr.x_net;
+ sprintf(obuf, "%lx", (u_long)ntohl(net.long_e));
+ cp = spectHex(obuf);
+ cp2 = cp + 1;
+ while (*up==0 && up < uplim) up++;
+ if (up == uplim) {
+ if (port) {
+ sprintf(cp, ".0");
+ cp += 2;
+ }
+ } else {
+ sprintf(cp, ".%x", *up++);
+ while (up < uplim) {
+ while (*cp) cp++;
+ sprintf(cp, "%02x", *up++);
+ }
+ cp = spectHex(cp2);
+ }
+ if (port) {
+ sprintf(cp, ".%x", port);
+ spectHex(cp + 1);
+ }
+ return (obuf);
+}
+
+static char *
+spectHex(p0)
+ char *p0;
+{
+ int ok = 0;
+ int nonzero = 0;
+ char *p = p0;
+ for (; *p; p++) switch (*p) {
+
+ case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+ *p += ('A' - 'a');
+ /* fall into . . . */
+ case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+ ok = 1;
+ case '1': case '2': case '3': case '4': case '5':
+ case '6': case '7': case '8': case '9':
+ nonzero = 1;
+ }
+ if (nonzero && !ok) { *p++ = 'H'; *p = 0; }
+ return (p);
+}
diff --git a/newlib/libc/sys/linux/net/ns_parse.c b/newlib/libc/sys/linux/net/ns_parse.c
index 5311e2496..38a684b87 100644
--- a/newlib/libc/sys/linux/net/ns_parse.c
+++ b/newlib/libc/sys/linux/net/ns_parse.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996,1999 by Internet Software Consortium.
+ * Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,11 +15,8 @@
* SOFTWARE.
*/
-#if !defined(_LIBC) && !defined(lint)
-static const char rcsid[] = "$BINDId: ns_parse.c,v 8.13 1999/10/13 16:39:35 vixie Exp $";
-#endif
-
-/* Import. */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
@@ -30,18 +27,6 @@ static const char rcsid[] = "$BINDId: ns_parse.c,v 8.13 1999/10/13 16:39:35 vixi
#include <resolv.h>
#include <string.h>
-#include "libc-symbols.h"
-
-/* Forward. */
-
-static void setsection(ns_msg *msg, ns_sect sect);
-
-/* Macros. */
-
-#define RETERR(err) do { __set_errno (err); return (-1); } while (0)
-
-/* Public. */
-
/* These need to be in the same order as the nres.h:ns_flag enum. */
struct _ns_flagdata _ns_flagdata[16] = {
{ 0x8000, 15 }, /* qr. */
@@ -62,8 +47,8 @@ struct _ns_flagdata _ns_flagdata[16] = {
{ 0x0000, 0 }, /* expansion (6/6). */
};
-int
-ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
+static int
+skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
const u_char *optr = ptr;
for ((void)NULL; count > 0; count--) {
@@ -71,19 +56,24 @@ ns_skiprr(const u_char *ptr, const u_char *eom, ns_sect section, int count) {
b = dn_skipname(ptr, eom);
if (b < 0)
- RETERR(EMSGSIZE);
+ goto emsgsize;
ptr += b/*Name*/ + NS_INT16SZ/*Type*/ + NS_INT16SZ/*Class*/;
if (section != ns_s_qd) {
- if (ptr + NS_INT32SZ + NS_INT16SZ > eom)
- RETERR(EMSGSIZE);
+ if (ptr + NS_INT32SZ > eom)
+ goto emsgsize;
ptr += NS_INT32SZ/*TTL*/;
+ if (ptr + NS_INT16SZ > eom)
+ goto emsgsize;
NS_GET16(rdlength, ptr);
ptr += rdlength/*RData*/;
}
}
if (ptr > eom)
- RETERR(EMSGSIZE);
+ goto emsgsize;
return (ptr - optr);
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
}
int
@@ -95,22 +85,22 @@ ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
handle->_msg = msg;
handle->_eom = eom;
if (msg + NS_INT16SZ > eom)
- RETERR(EMSGSIZE);
+ goto emsgsize;
NS_GET16(handle->_id, msg);
if (msg + NS_INT16SZ > eom)
- RETERR(EMSGSIZE);
+ goto emsgsize;
NS_GET16(handle->_flags, msg);
for (i = 0; i < ns_s_max; i++) {
if (msg + NS_INT16SZ > eom)
- RETERR(EMSGSIZE);
+ goto emsgsize;
NS_GET16(handle->_counts[i], msg);
}
for (i = 0; i < ns_s_max; i++)
if (handle->_counts[i] == 0)
handle->_sections[i] = NULL;
else {
- int b = ns_skiprr(msg, eom, (ns_sect)i,
- handle->_counts[i]);
+ int b = skiprr(msg, eom, (ns_sect)i,
+ handle->_counts[i]);
if (b < 0)
return (-1);
@@ -118,9 +108,14 @@ ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
msg += b;
}
if (msg != eom)
- RETERR(EMSGSIZE);
- setsection(handle, ns_s_max);
+ goto emsgsize;
+ handle->_sect = ns_s_max;
+ handle->_rrnum = -1;
+ handle->_ptr = NULL;
return (0);
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
}
int
@@ -129,26 +124,29 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
/* Make section right. */
if (section < 0 || section >= ns_s_max)
- RETERR(ENODEV);
- if (section != handle->_sect)
- setsection(handle, section);
+ goto enodev;
+ if ((int)section != (int)handle->_sect) {
+ handle->_sect = section;
+ handle->_rrnum = 0;
+ handle->_ptr = handle->_sections[(int)section];
+ }
/* Make rrnum right. */
if (rrnum == -1)
rrnum = handle->_rrnum;
if (rrnum < 0 || rrnum >= handle->_counts[(int)section])
- RETERR(ENODEV);
- if (rrnum < handle->_rrnum)
- setsection(handle, section);
- if (rrnum > handle->_rrnum) {
- b = ns_skiprr(handle->_ptr, handle->_eom, section,
- rrnum - handle->_rrnum);
-
- if (b < 0)
- return (-1);
- handle->_ptr += b;
- handle->_rrnum = rrnum;
+ goto enodev;
+ if (rrnum < handle->_rrnum) {
+ handle->_rrnum = 0;
+ handle->_ptr = handle->_sections[(int)section];
}
+
+ b = skiprr(handle->_msg, handle->_eom, section,
+ rrnum - handle->_rrnum);
+ if (b < 0)
+ return (-1);
+ handle->_ptr += b;
+ handle->_rrnum = rrnum;
/* Do the parse. */
b = dn_expand(handle->_msg, handle->_eom,
@@ -156,41 +154,36 @@ ns_parserr(ns_msg *handle, ns_sect section, int rrnum, ns_rr *rr) {
if (b < 0)
return (-1);
handle->_ptr += b;
- if (handle->_ptr + NS_INT16SZ + NS_INT16SZ > handle->_eom)
- RETERR(EMSGSIZE);
+ if (handle->_ptr + NS_INT16SZ > handle->_eom)
+ goto emsgsize;
NS_GET16(rr->type, handle->_ptr);
+ if (handle->_ptr + NS_INT16SZ > handle->_eom)
+ goto emsgsize;
NS_GET16(rr->rr_class, handle->_ptr);
if (section == ns_s_qd) {
rr->ttl = 0;
rr->rdlength = 0;
rr->rdata = NULL;
} else {
- if (handle->_ptr + NS_INT32SZ + NS_INT16SZ > handle->_eom)
- RETERR(EMSGSIZE);
+ if (handle->_ptr + NS_INT32SZ > handle->_eom)
+ goto emsgsize;
NS_GET32(rr->ttl, handle->_ptr);
+ if (handle->_ptr + NS_INT16SZ > handle->_eom)
+ goto emsgsize;
NS_GET16(rr->rdlength, handle->_ptr);
if (handle->_ptr + rr->rdlength > handle->_eom)
- RETERR(EMSGSIZE);
+ goto emsgsize;
rr->rdata = handle->_ptr;
handle->_ptr += rr->rdlength;
}
- if (++handle->_rrnum > handle->_counts[(int)section])
- setsection(handle, (ns_sect)((int)section + 1));
+ handle->_rrnum++;
/* All done. */
return (0);
-}
-
-/* Private. */
-
-static void
-setsection(ns_msg *msg, ns_sect sect) {
- msg->_sect = sect;
- if (sect == ns_s_max) {
- msg->_rrnum = -1;
- msg->_ptr = NULL;
- } else {
- msg->_rrnum = 0;
- msg->_ptr = msg->_sections[(int)sect];
- }
+ enodev:
+ errno = ENODEV;
+ return (-1);
+ emsgsize:
+ errno = EMSGSIZE;
+ return (-1);
}
diff --git a/newlib/libc/sys/linux/net/ns_print.c b/newlib/libc/sys/linux/net/ns_print.c
index bc11aa362..7cce6d7aa 100644
--- a/newlib/libc/sys/linux/net/ns_print.c
+++ b/newlib/libc/sys/linux/net/ns_print.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,9 +15,10 @@
* SOFTWARE.
*/
-#if !defined(_LIBC) && !defined(lint)
-static const char rcsid[] = "$BINDId: ns_print.c,v 8.18 2000/02/29 05:48:12 vixie Exp $";
-#endif
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
/* Import. */
@@ -34,13 +35,7 @@ static const char rcsid[] = "$BINDId: ns_print.c,v 8.18 2000/02/29 05:48:12 vixi
#include <string.h>
#include <ctype.h>
-#include "libc-symbols.h"
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
+#define SPRINTF(x) ((size_t)sprintf x)
/* Forward. */
@@ -56,12 +51,6 @@ static int addstr(const char *src, size_t len,
static int addtab(size_t len, size_t target, int spaced,
char **buf, size_t *buflen);
-/* Proto. */
-
-#ifndef _LIBC
-u_int16_t dst_s_dns_key_id(const u_char *, const int);
-#endif
-
/* Macros. */
#define T(x) \
@@ -119,7 +108,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
/*
* Owner.
*/
- if (name_ctx != NULL && ns_samename(name_ctx, name) == 1) {
+ if (name_ctx != NULL && strcasecmp(name_ctx, name) == 0) {
T(addstr("\t\t\t", 3, &buf, &buflen));
} else {
len = prune_origin(name, origin);
@@ -127,10 +116,9 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
T(addstr("@\t\t\t", 4, &buf, &buflen));
} else {
T(addstr(name, len, &buf, &buflen));
- /* Origin not used or not root, and no trailing dot? */
- if (((origin == NULL || origin[0] == '\0') ||
- (origin[0] != '.' && origin[1] != '\0' &&
- name[len] == '\0')) && name[len - 1] != '.') {
+ /* Origin not used and no trailing dot? */
+ if ((!origin || !origin[0] || name[len] == '\0') &&
+ name[len - 1] != '.') {
T(addstr(".", 1, &buf, &buflen));
len++;
}
@@ -176,11 +164,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
rdata += len;
T(addstr(" ", 1, &buf, &buflen));
-
- /* Second word, optional in ISDN records. */
- if (type == ns_t_isdn && rdata == edata)
- break;
-
+ /* Second word. */
T(len = charstr(rdata, edata, &buf, &buflen));
if (len == 0)
goto formerr;
@@ -311,9 +295,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
break;
case ns_t_nsap: {
- /* 2*255 for hex digits, 128 for '.' and '\0', 2 for
- 0x if inet_nsap_ntoa starts using it. */
- char t[255*2 + 128 + 2];
+ char t[255*3];
(void) inet_nsap_ntoa(rdlen, rdata, t);
T(addstr(t, strlen(t), &buf, &buflen));
@@ -449,9 +431,8 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
}
case ns_t_key: {
-#ifndef _LIBC
char base64_key[NS_MD5RSA_MAX_BASE64];
- u_int keyflags, protocol, algorithm, key_id;
+ u_int keyflags, protocol, algorithm;
const char *leader;
int n;
@@ -459,7 +440,6 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
goto formerr;
/* Key flags, Protocol, Algorithm. */
- key_id = dst_s_dns_key_id(rdata, edata-rdata);
keyflags = ns_get16(rdata); rdata += NS_INT16SZ;
protocol = *rdata++;
algorithm = *rdata++;
@@ -485,15 +465,11 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
}
if (len > 15)
T(addstr(" )", 2, &buf, &buflen));
- n = SPRINTF((tmp, " ; key_tag= %u", key_id));
- T(addstr(tmp, n, &buf, &buflen));
-#endif /* !_LIBC */
break;
}
case ns_t_sig: {
-#ifndef _LIBC
char base64_key[NS_MD5RSA_MAX_BASE64];
u_int type, algorithm, labels, footprint;
const char *leader;
@@ -508,10 +484,10 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
algorithm = *rdata++;
labels = *rdata++;
t = ns_get32(rdata); rdata += NS_INT32SZ;
- len = SPRINTF((tmp, "%s %d %d %lu ",
- p_type(type), algorithm, labels, t));
+ len = SPRINTF((tmp, " %s %d %lu ",
+ p_type(type), algorithm, t));
T(addstr(tmp, len, &buf, &buflen));
- if (labels > (u_int)dn_count_labels(name))
+ if (labels != (u_int)dn_count_labels(name))
goto formerr;
/* Signature expiry. */
@@ -550,7 +526,7 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
}
if (len > 15)
T(addstr(" )", 2, &buf, &buflen));
-#endif /* !_LIBC */
+
break;
}
@@ -570,63 +546,6 @@ ns_sprintrrf(const u_char *msg, size_t msglen,
break;
}
- case ns_t_cert: {
- u_int c_type, key_tag, alg;
- int n, siz;
- char base64_cert[8192], *leader, tmp[40];
-
- c_type = ns_get16(rdata); rdata += NS_INT16SZ;
- key_tag = ns_get16(rdata); rdata += NS_INT16SZ;
- alg = (u_int) *rdata++;
-
- len = SPRINTF((tmp, "%d %d %d ", c_type, key_tag, alg));
- T(addstr(tmp, len, &buf, &buflen));
- siz = (edata-rdata)*4/3 + 4; /* "+4" accounts for trailing \0 */
- if (siz > sizeof(base64_cert) * 3/4) {
- char *str = "record too long to print";
- T(addstr(str, strlen(str), &buf, &buflen));
- }
- else {
- len = b64_ntop(rdata, edata-rdata, base64_cert, siz);
-
- if (len < 0)
- goto formerr;
- else if (len > 15) {
- T(addstr(" (", 2, &buf, &buflen));
- leader = "\n\t\t";
- spaced = 0;
- }
- else
- leader = " ";
-
- for (n = 0; n < len; n += 48) {
- T(addstr(leader, strlen(leader),
- &buf, &buflen));
- T(addstr(base64_cert + n, MIN(len - n, 48),
- &buf, &buflen));
- }
- if (len > 15)
- T(addstr(" )", 2, &buf, &buflen));
- }
- break;
- }
-
- case ns_t_tsig: {
- /* BEW - need to complete this */
- int n;
-
- T(len = addname(msg, msglen, &rdata, origin, &buf, &buflen));
- T(addstr(" ", 1, &buf, &buflen));
- rdata += 8; /* time */
- n = ns_get16(rdata); rdata += INT16SZ;
- rdata += n; /* sig */
- n = ns_get16(rdata); rdata += INT16SZ; /* original id */
- sprintf(buf, "%d", ns_get16(rdata));
- rdata += INT16SZ;
- addlen(strlen(buf), &buf, &buflen);
- break;
- }
-
default:
comment = "unknown RR type";
goto hexify;
@@ -682,7 +601,7 @@ prune_origin(const char *name, const char *origin) {
const char *oname = name;
while (*name != '\0') {
- if (origin != NULL && ns_samename(name, origin) == 1)
+ if (origin != NULL && strcasecmp(name, origin) == 0)
return (name - oname - (name > oname));
while (*name != '\0') {
if (*name == '\\') {
@@ -739,7 +658,7 @@ charstr(const u_char *rdata, const u_char *edata, char **buf, size_t *buflen) {
goto enospc;
return (rdata - odata);
enospc:
- __set_errno (ENOSPC);
+ errno = ENOSPC;
*buf = save_buf;
*buflen = save_buflen;
return (-1);
@@ -758,29 +677,27 @@ addname(const u_char *msg, size_t msglen,
if (n < 0)
goto enospc; /* Guess. */
newlen = prune_origin(*buf, origin);
+ if ((origin == NULL || origin[0] == '\0' || (*buf)[newlen] == '\0') &&
+ (newlen == 0 || (*buf)[newlen - 1] != '.')) {
+ /* No trailing dot. */
+ if (newlen + 2 > *buflen)
+ goto enospc; /* No room for ".\0". */
+ (*buf)[newlen++] = '.';
+ (*buf)[newlen] = '\0';
+ }
if (newlen == 0) {
/* Use "@" instead of name. */
if (newlen + 2 > *buflen)
goto enospc; /* No room for "@\0". */
(*buf)[newlen++] = '@';
(*buf)[newlen] = '\0';
- } else {
- if (((origin == NULL || origin[0] == '\0') ||
- (origin[0] != '.' && origin[1] != '\0' &&
- (*buf)[newlen] == '\0')) && (*buf)[newlen - 1] != '.') {
- /* No trailing dot. */
- if (newlen + 2 > *buflen)
- goto enospc; /* No room for ".\0". */
- (*buf)[newlen++] = '.';
- (*buf)[newlen] = '\0';
- }
}
*pp += n;
addlen(newlen, buf, buflen);
**buf = '\0';
return (newlen);
enospc:
- __set_errno (ENOSPC);
+ errno = ENOSPC;
*buf = save_buf;
*buflen = save_buflen;
return (-1);
@@ -795,8 +712,8 @@ addlen(size_t len, char **buf, size_t *buflen) {
static int
addstr(const char *src, size_t len, char **buf, size_t *buflen) {
- if (len >= *buflen) {
- __set_errno (ENOSPC);
+ if (len > *buflen) {
+ errno = ENOSPC;
return (-1);
}
memcpy(*buf, src, len);
diff --git a/newlib/libc/sys/linux/net/ns_samedomain.c b/newlib/libc/sys/linux/net/ns_samedomain.c
deleted file mode 100644
index 964863719..000000000
--- a/newlib/libc/sys/linux/net/ns_samedomain.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 1995,1999 by Internet Software Consortium.
- *
- * 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.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#if !defined(_LIBC) && !defined(lint)
-static const char rcsid[] = "$BINDId: ns_samedomain.c,v 8.9 1999/10/15 21:06:51 vixie Exp $";
-#endif
-
-#include <sys/types.h>
-#include <arpa/nameser.h>
-#include <errno.h>
-#include <string.h>
-
-#include "libc-symbols.h"
-
-/*
- * int
- * ns_samedomain(a, b)
- * Check whether a name belongs to a domain.
- * Inputs:
- * a - the domain whose ancestory is being verified
- * b - the potential ancestor we're checking against
- * Return:
- * boolean - is a at or below b?
- * Notes:
- * Trailing dots are first removed from name and domain.
- * Always compare complete subdomains, not only whether the
- * domain name is the trailing string of the given name.
- *
- * "host.foobar.top" lies in "foobar.top" and in "top" and in ""
- * but NOT in "bar.top"
- */
-
-int
-ns_samedomain(const char *a, const char *b) {
- size_t la, lb;
- int diff, i, escaped;
- const char *cp;
-
- la = strlen(a);
- lb = strlen(b);
-
- /* Ignore a trailing label separator (i.e. an unescaped dot) in 'a'. */
- if (la != 0 && a[la - 1] == '.') {
- escaped = 0;
- /* Note this loop doesn't get executed if la==1. */
- for (i = la - 2; i >= 0; i--)
- if (a[i] == '\\') {
- if (escaped)
- escaped = 0;
- else
- escaped = 1;
- } else
- break;
- if (!escaped)
- la--;
- }
-
- /* Ignore a trailing label separator (i.e. an unescaped dot) in 'b'. */
- if (lb != 0 && b[lb - 1] == '.') {
- escaped = 0;
- /* note this loop doesn't get executed if lb==1 */
- for (i = lb - 2; i >= 0; i--)
- if (b[i] == '\\') {
- if (escaped)
- escaped = 0;
- else
- escaped = 1;
- } else
- break;
- if (!escaped)
- lb--;
- }
-
- /* lb == 0 means 'b' is the root domain, so 'a' must be in 'b'. */
- if (lb == 0)
- return (1);
-
- /* 'b' longer than 'a' means 'a' can't be in 'b'. */
- if (lb > la)
- return (0);
-
- /* 'a' and 'b' being equal at this point indicates sameness. */
- if (lb == la)
- return (strncasecmp(a, b, lb) == 0);
-
- /* Ok, we know la > lb. */
-
- diff = la - lb;
-
- /*
- * If 'a' is only 1 character longer than 'b', then it can't be
- * a subdomain of 'b' (because of the need for the '.' label
- * separator).
- */
- if (diff < 2)
- return (0);
-
- /*
- * If the character before the last 'lb' characters of 'b'
- * isn't '.', then it can't be a match (this lets us avoid
- * having "foobar.com" match "bar.com").
- */
- if (a[diff - 1] != '.')
- return (0);
-
- /*
- * We're not sure about that '.', however. It could be escaped
- * and thus not a really a label separator.
- */
- escaped = 0;
- for (i = diff - 2; i >= 0; i--)
- if (a[i] == '\\')
- if (escaped)
- escaped = 0;
- else
- escaped = 1;
- else
- break;
- if (escaped)
- return (0);
-
- /* Now compare aligned trailing substring. */
- cp = a + diff;
- return (strncasecmp(cp, b, lb) == 0);
-}
-
-/*
- * int
- * ns_subdomain(a, b)
- * is "a" a subdomain of "b"?
- */
-int
-ns_subdomain(const char *a, const char *b) {
- return (ns_samename(a, b) != 1 && ns_samedomain(a, b));
-}
-
-/*
- * int
- * ns_makecanon(src, dst, dstsize)
- * make a canonical copy of domain name "src"
- * notes:
- * foo -> foo.
- * foo. -> foo.
- * foo.. -> foo.
- * foo\. -> foo\..
- * foo\\. -> foo\\.
- */
-
-int
-ns_makecanon(const char *src, char *dst, size_t dstsize) {
- size_t n = strlen(src);
-
- if (n + sizeof "." > dstsize) {
- __set_errno (EMSGSIZE);
- return (-1);
- }
- strcpy(dst, src);
- while (n > 0 && dst[n - 1] == '.') /* Ends in "." */
- if (n > 1 && dst[n - 2] == '\\' && /* Ends in "\." */
- (n < 2 || dst[n - 3] != '\\')) /* But not "\\." */
- break;
- else
- dst[--n] = '\0';
- dst[n++] = '.';
- dst[n] = '\0';
- return (0);
-}
-
-/*
- * int
- * ns_samename(a, b)
- * determine whether domain name "a" is the same as domain name "b"
- * return:
- * -1 on error
- * 0 if names differ
- * 1 if names are the same
- */
-
-int
-ns_samename(const char *a, const char *b) {
- char ta[NS_MAXDNAME], tb[NS_MAXDNAME];
-
- if (ns_makecanon(a, ta, sizeof ta) < 0 ||
- ns_makecanon(b, tb, sizeof tb) < 0)
- return (-1);
- if (strcasecmp(ta, tb) == 0)
- return (1);
- else
- return (0);
-}
diff --git a/newlib/libc/sys/linux/net/ns_ttl.c b/newlib/libc/sys/linux/net/ns_ttl.c
index 87cd7b1ed..63dbefb59 100644
--- a/newlib/libc/sys/linux/net/ns_ttl.c
+++ b/newlib/libc/sys/linux/net/ns_ttl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996,1999 by Internet Software Consortium.
+ * Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,9 +15,8 @@
* SOFTWARE.
*/
-#if !defined(_LIBC) && !defined(lint)
-static const char rcsid[] = "$BINDId: ns_ttl.c,v 8.8 1999/10/13 16:39:36 vixie Exp $";
-#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
/* Import. */
@@ -28,13 +27,7 @@ static const char rcsid[] = "$BINDId: ns_ttl.c,v 8.8 1999/10/13 16:39:36 vixie E
#include <stdio.h>
#include <string.h>
-#include "libc-symbols.h"
-
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) ((size_t)sprintf x)
-#endif
+#define SPRINTF(x) ((size_t)sprintf x)
/* Forward. */
@@ -91,9 +84,6 @@ ns_format_ttl(u_long src, char *dst, size_t dstlen) {
return (dst - odst);
}
-#ifndef SHARED
-// Seems not to be needed. It's not exported from the DSO. Some libresolv.a
-// might depend on it so we let it in.
int
ns_parse_ttl(const char *src, u_long *dst) {
u_long ttl, tmp;
@@ -139,10 +129,9 @@ ns_parse_ttl(const char *src, u_long *dst) {
return (0);
einval:
- __set_errno (EINVAL);
+ errno = EINVAL;
return (-1);
}
-#endif
/* Private. */
diff --git a/newlib/libc/sys/linux/net/nsap_addr.c b/newlib/libc/sys/linux/net/nsap_addr.c
index 5c0855f60..b6651488b 100644
--- a/newlib/libc/sys/linux/net/nsap_addr.c
+++ b/newlib/libc/sys/linux/net/nsap_addr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,30 +15,31 @@
* SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$BINDId: nsap_addr.c,v 8.10 1999/10/13 16:39:28 vixie Exp $";
-#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
-
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
-
#include <ctype.h>
#include <resolv.h>
-#include "libc-symbols.h"
-
static char
-xtob(int c) {
+xtob(c)
+ int c;
+{
return (c - (((c >= '0') && (c <= '9')) ? '0' : '7'));
}
u_int
-inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
+inet_nsap_addr(ascii, binary, maxlen)
+ const char *ascii;
+ u_char *binary;
+ int maxlen;
+{
u_char c, nib;
u_int len = 0;
@@ -47,7 +48,8 @@ inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
continue;
if (!isascii(c))
return (0);
- c = toupper(c);
+ if (islower(c))
+ c = toupper(c);
if (isxdigit(c)) {
nib = xtob(c);
c = *ascii++;
@@ -69,10 +71,14 @@ inet_nsap_addr(const char *ascii, u_char *binary, int maxlen) {
}
char *
-inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
+inet_nsap_ntoa(binlen, binary, ascii)
+ int binlen;
+ const u_char *binary;
+ char *ascii;
+{
int nib;
int i;
- static char tmpbuf[255*2 + 128];
+ static char tmpbuf[255*3];
char *start;
if (ascii)
@@ -96,3 +102,12 @@ inet_nsap_ntoa(int binlen, const u_char *binary, char *ascii) {
*ascii = '\0';
return (start);
}
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <arpa/inet.h>.
+ */
+#undef inet_nsap_addr
+__weak_reference(__inet_nsap_addr, inet_nsap_addr);
+#undef inet_nsap_ntoa
+__weak_reference(__inet_nsap_ntoa, inet_nsap_ntoa);
diff --git a/newlib/libc/sys/linux/net/nscd-types.h b/newlib/libc/sys/linux/net/nscd-types.h
deleted file mode 100644
index dbe43b8bc..000000000
--- a/newlib/libc/sys/linux/net/nscd-types.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Types for the NSCD implementation. Generic version.
- Copyright (c) 2000 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <stdint.h>
-
-typedef int32_t nscd_ssize_t;
diff --git a/newlib/libc/sys/linux/net/nscd/nscd-client.h b/newlib/libc/sys/linux/net/nscd/nscd-client.h
deleted file mode 100644
index 0ba8a2198..000000000
--- a/newlib/libc/sys/linux/net/nscd/nscd-client.h
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Copyright (c) 1998, 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* This file defines everything that client code should need to
- know to talk to the nscd daemon. */
-
-#ifndef _NSCD_CLIENT_H
-#define _NSCD_CLIENT_H 1
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <machine/atomic.h>
-#include <nscd-types.h>
-
-
-/* Version number of the daemon interface */
-#define NSCD_VERSION 2
-
-/* Path of the file where the PID of the running system is stored. */
-#define _PATH_NSCDPID "/var/run/nscd/nscd.pid"
-
-/* Path for the Unix domain socket. */
-#define _PATH_NSCDSOCKET "/var/run/nscd/socket"
-
-/* Path for the configuration file. */
-#define _PATH_NSCDCONF "/etc/nscd.conf"
-
-
-/* Available services. */
-typedef enum
-{
- GETPWBYNAME,
- GETPWBYUID,
- GETGRBYNAME,
- GETGRBYGID,
- GETHOSTBYNAME,
- GETHOSTBYNAMEv6,
- GETHOSTBYADDR,
- GETHOSTBYADDRv6,
- LASTDBREQ = GETHOSTBYADDRv6,
- SHUTDOWN, /* Shut the server down. */
- GETSTAT, /* Get the server statistic. */
- INVALIDATE, /* Invalidate one special cache. */
- GETFDPW,
- GETFDGR,
- GETFDHST,
- GETAI,
- INITGROUPS,
- LASTREQ
-} request_type;
-
-
-/* Header common to all requests */
-typedef struct
-{
- int32_t version; /* Version number of the daemon interface. */
- request_type type; /* Service requested. */
- int32_t key_len; /* Key length. */
-} request_header;
-
-
-/* Structure sent in reply to password query. Note that this struct is
- sent also if the service is disabled or there is no record found. */
-typedef struct
-{
- int32_t version;
- int32_t found;
- nscd_ssize_t pw_name_len;
- nscd_ssize_t pw_passwd_len;
- uid_t pw_uid;
- gid_t pw_gid;
- nscd_ssize_t pw_gecos_len;
- nscd_ssize_t pw_dir_len;
- nscd_ssize_t pw_shell_len;
-} pw_response_header;
-
-
-/* Structure sent in reply to group query. Note that this struct is
- sent also if the service is disabled or there is no record found. */
-typedef struct
-{
- int32_t version;
- int32_t found;
- nscd_ssize_t gr_name_len;
- nscd_ssize_t gr_passwd_len;
- gid_t gr_gid;
- nscd_ssize_t gr_mem_cnt;
-} gr_response_header;
-
-
-/* Structure sent in reply to host query. Note that this struct is
- sent also if the service is disabled or there is no record found. */
-typedef struct
-{
- int32_t version;
- int32_t found;
- nscd_ssize_t h_name_len;
- nscd_ssize_t h_aliases_cnt;
- int32_t h_addrtype;
- int32_t h_length;
- nscd_ssize_t h_addr_list_cnt;
- int32_t error;
-} hst_response_header;
-
-
-/* Structure sent in reply to addrinfo query. Note that this struct is
- sent also if the service is disabled or there is no record found. */
-typedef struct
-{
- int32_t version;
- int32_t found;
- nscd_ssize_t naddrs;
- nscd_ssize_t addrslen;
- nscd_ssize_t canonlen;
- int32_t error;
-} ai_response_header;
-
-/* Structure filled in by __nscd_getai. */
-struct nscd_ai_result
-{
- int naddrs;
- char *canon;
- uint8_t *family;
- char *addrs;
-};
-
-/* Structure sent in reply to initgroups query. Note that this struct is
- sent also if the service is disabled or there is no record found. */
-typedef struct
-{
- int32_t version;
- int32_t found;
- nscd_ssize_t ngrps;
-} initgr_response_header;
-
-
-/* Type for offsets in data part of database. */
-typedef uint32_t ref_t;
-/* Value for invalid/no reference. */
-#define ENDREF UINT32_MAX
-
-/* Timestamp type. */
-typedef uint64_t nscd_time_t;
-
-/* Alignment requirement of the beginning of the data region. */
-#define ALIGN 16
-
-
-/* Head of record in data part of database. */
-struct datahead
-{
- nscd_ssize_t allocsize; /* Allocated Bytes. */
- nscd_ssize_t recsize; /* Size of the record. */
- nscd_time_t timeout; /* Time when this entry becomes invalid. */
- uint8_t notfound; /* Nonzero if data has not been found. */
- uint8_t nreloads; /* Reloads without use. */
- uint8_t usable; /* False if the entry must be ignored. */
- uint64_t :40; /* Alignment. */
-
- /* We need to have the following element aligned for the response
- header data types and their use in the 'struct dataset' types
- defined in the XXXcache.c files. */
- union
- {
- pw_response_header pwdata;
- gr_response_header grdata;
- hst_response_header hstdata;
- ai_response_header aidata;
- initgr_response_header initgrdata;
- nscd_ssize_t align1;
- nscd_time_t align2;
- } data[0];
-};
-
-
-/* Structure for one hash table entry. */
-struct hashentry
-{
- request_type type:8; /* Which type of dataset. */
- bool first; /* True if this was the original key. */
- nscd_ssize_t len; /* Length of key. */
- ref_t key; /* Pointer to key. */
- int32_t owner; /* If secure table, this is the owner. */
- ref_t next; /* Next entry in this hash bucket list. */
- ref_t packet; /* Records for the result. */
- union
- {
- struct hashentry *dellist; /* Next record to be deleted. This can be a
- pointer since only nscd uses this field. */
- ref_t *prevp; /* Pointer to field containing forward
- reference. */
- };
-};
-
-
-/* Current persistent database version. */
-#define DB_VERSION 1
-
-/* Maximum time allowed between updates of the timestamp. */
-#define MAPPING_TIMEOUT (5 * 60)
-
-
-/* Header of persistent database file. */
-struct database_pers_head
-{
- int32_t version;
- int32_t header_size;
- volatile int32_t gc_cycle;
- volatile int32_t nscd_certainly_running;
- volatile nscd_time_t timestamp;
-
- nscd_ssize_t module;
- nscd_ssize_t data_size;
-
- nscd_ssize_t first_free; /* Offset of first free byte in data area. */
-
- nscd_ssize_t nentries;
- nscd_ssize_t maxnentries;
- nscd_ssize_t maxnsearched;
-
- uint64_t poshit;
- uint64_t neghit;
- uint64_t posmiss;
- uint64_t negmiss;
-
- uint64_t rdlockdelayed;
- uint64_t wrlockdelayed;
-
- uint64_t addfailed;
-
- ref_t array[0];
-};
-
-
-/* Mapped database record. */
-struct mapped_database
-{
- const struct database_pers_head *head;
- const char *data;
- size_t mapsize;
- int counter; /* > 0 indicates it is usable. */
-};
-#define NO_MAPPING ((struct mapped_database *) -1l)
-
-struct locked_map_ptr
-{
- int lock;
- struct mapped_database *mapped;
-};
-#define libc_locked_map_ptr(class, name) class struct locked_map_ptr name
-
-
-/* Open socket connection to nscd server. */
-extern int __nscd_open_socket (const char *key, size_t keylen,
- request_type type, void *response,
- size_t responselen) attribute_hidden;
-
-/* Get reference of mapping. */
-extern struct mapped_database *__nscd_get_map_ref (request_type type,
- const char *name,
- struct locked_map_ptr *mapptr,
- int *gc_cyclep);
-
-/* Unmap database. */
-extern void __nscd_unmap (struct mapped_database *mapped);
-
-/* Drop reference of mapping. */
-static inline int __nscd_drop_map_ref (struct mapped_database *map,
- int *gc_cycle)
-{
- if (map != NO_MAPPING)
- {
- int now_cycle = map->head->gc_cycle;
- if (__builtin_expect (now_cycle != *gc_cycle, 0))
- {
- /* We might have read inconsistent data. */
- *gc_cycle = now_cycle;
- return -1;
- }
-
- if (atomic_decrement_and_test (&map->counter) == 0)
- __nscd_unmap (map);
- }
-
- return 0;
-}
-
-
-/* Search the mapped database. */
-extern const struct datahead *__nscd_cache_search (request_type type,
- const char *key,
- size_t keylen,
- const struct mapped_database *mapped);
-
-#endif /* nscd.h */
diff --git a/newlib/libc/sys/linux/net/nscd/nscd_proto.h b/newlib/libc/sys/linux/net/nscd/nscd_proto.h
deleted file mode 100644
index 64d9bd004..000000000
--- a/newlib/libc/sys/linux/net/nscd/nscd_proto.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (C) 1998, 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Thorsten Kukuk <kukuk@suse.de>, 1998.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _NSCD_PROTO_H
-#define _NSCD_PROTO_H 1
-
-#include <grp.h>
-#include <netdb.h>
-#include <pwd.h>
-
-/* Interval in which we transfer retry to contact the NSCD. */
-#define NSS_NSCD_RETRY 100
-
-/* Type needed in the interfaces. */
-struct nscd_ai_result;
-
-
-/* Variables for communication between NSCD handler functions and NSS. */
-extern int __nss_not_use_nscd_passwd attribute_hidden;
-extern int __nss_not_use_nscd_group attribute_hidden;
-extern int __nss_not_use_nscd_hosts attribute_hidden;
-
-extern int __nscd_getpwnam_r (const char *name, struct passwd *resultbuf,
- char *buffer, size_t buflen,
- struct passwd **result);
-extern int __nscd_getpwuid_r (uid_t uid, struct passwd *resultbuf,
- char *buffer, size_t buflen,
- struct passwd **result);
-extern int __nscd_getgrnam_r (const char *name, struct group *resultbuf,
- char *buffer, size_t buflen,
- struct group **result);
-extern int __nscd_getgrgid_r (gid_t gid, struct group *resultbuf,
- char *buffer, size_t buflen,
- struct group **result);
-extern int __nscd_gethostbyname_r (const char *name,
- struct hostent *resultbuf,
- char *buffer, size_t buflen,
- struct hostent **result, int *h_errnop);
-extern int __nscd_gethostbyname2_r (const char *name, int af,
- struct hostent *resultbuf,
- char *buffer, size_t buflen,
- struct hostent **result, int *h_errnop);
-extern int __nscd_gethostbyaddr_r (const void *addr, socklen_t len, int type,
- struct hostent *resultbuf,
- char *buffer, size_t buflen,
- struct hostent **result, int *h_errnop);
-extern int __nscd_getai (const char *key, struct nscd_ai_result **result,
- int *h_errnop);
-extern int __nscd_getgrouplist (const char *user, gid_t group, long int *size,
- gid_t **groupsp, long int limit);
-#endif /* _NSCD_PROTO_H */
diff --git a/newlib/libc/sys/linux/net/nsdispatch.3 b/newlib/libc/sys/linux/net/nsdispatch.3
new file mode 100644
index 000000000..708f97cba
--- /dev/null
+++ b/newlib/libc/sys/linux/net/nsdispatch.3
@@ -0,0 +1,231 @@
+.\" $NetBSD: nsdispatch.3,v 1.8 1999/03/22 19:44:53 garbled Exp $
+.\" $FreeBSD: src/lib/libc/net/nsdispatch.3,v 1.5 2001/10/01 16:08:56 ru Exp $
+.\"
+.\" Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" 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 NetBSD
+.\" Foundation, Inc. and its contributors.
+.\" 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+.\"
+.Dd January 19, 1999
+.Dt NSDISPATCH 3
+.Os
+.Sh NAME
+.Nm nsdispatch
+.Nd name-service switch dispatcher routine
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In nsswitch.h
+.Ft int
+.Fo nsdispatch
+.Fa "void *retval"
+.Fa "const ns_dtab dtab[]"
+.Fa "const char *database"
+.Fa "const char *method"
+.Fa "const ns_src defaults[]"
+.Fa "..."
+.Fc
+.Sh DESCRIPTION
+The
+.Fn nsdispatch
+function invokes the callback functions specified in
+.Va dtab
+in the order given in
+.Pa /etc/nsswitch.conf
+for the database
+.Va database
+until a successful entry is found.
+.Pp
+.Va retval
+is passed to each callback function to modify as necessary
+(to pass back to the caller of
+.Fn nsdispatch )
+.Pp
+.Va dtab
+is an array of
+.Va ns_dtab
+structures, which have the following format:
+.Bd -literal -offset indent
+typedef struct {
+ const char *src;
+ int (*cb)(void *retval, void *cb_data, va_list ap);
+ void *cb_data;
+} ns_dtab;
+.Ed
+.Pp
+.Bd -ragged -offset indent
+For each source type that is implemented, an entry with
+.Va src
+set to the name of the source,
+.Va cb
+defined as a function which handles that source, and
+.Va cb_data
+is used to pass arbritrary data to the callback function.
+The last entry in
+.Va dtab
+should contain
+.Dv NULL
+values for
+.Va src ,
+.Va cb ,
+and
+.Va cb_data .
+.Ed
+.Pp
+.Va method
+is usually the name of the function calling
+.Fn nsdispatch .
+When dynamic loading is supported, a symbol constructed from
+.Va database ,
+the current source, and
+.Va method
+will be used as the name to invoke the dynamically loaded function.
+.Pp
+.Va defaults
+contains a list of default sources to try in the case of
+a missing or corrupt
+.Xr nsswitch.conf 5 ,
+or if there isn't a relevant entry for
+.Va database .
+It is an array of
+.Va ns_src
+structures, which have the following format:
+.Bd -literal -offset indent
+typedef struct {
+ const char *src;
+ u_int32_t flags;
+} ns_src;
+.Ed
+.Pp
+.Bd -ragged -offset indent
+For each default source type, an entry with
+.Va src
+set to the name of the source, and
+.Va flags
+set to the relevant flags
+(usually
+.Dv NS_SUCCESS ;
+refer to
+.Sx Callback return values
+for more information).
+The last entry in
+.Va defaults
+should have
+.Va src
+set to
+.Dv NULL
+and
+.Va flags
+set to 0.
+.Pp
+For convenience, a global variable defined as:
+.Dl extern const ns_src __nsdefaultsrc[];
+exists which contains a single default entry for
+.Sq files
+for use by callers which don't require complicated default rules.
+.Ed
+.Pp
+.Sq Va ...
+are optional extra arguments, which
+are passed to the appropriate callback function as a variable argument
+list of the type
+.Va va_list .
+.Ss Valid source types
+Whilst there is support for arbitrary sources, the following
+#defines for commonly implementated sources are available:
+.Bl -column NS_COMPAT COMPAT -offset indent
+.It Sy "#define value"
+.It "NSSRC_FILES ""files"""
+.It "NSSRC_DNS ""dns"""
+.It "NSSRC_NIS ""nis"""
+.It "NSSRC_COMPAT ""compat"""
+.El
+.Pp
+Refer to
+.Xr nsswitch.conf 5
+for a complete description of what each source type is.
+.Pp
+.Ss Callback return values
+The callback functions should return one of the following values
+depending upon status of the lookup:
+.Bl -column NS_NOTFOUND -offset indent
+.It Sy "Return value Status code"
+.It "NS_SUCCESS success"
+.It "NS_NOTFOUND notfound"
+.It "NS_UNAVAIL unavail"
+.It "NS_TRYAGAIN tryagain"
+.El
+.Pp
+Refer to
+.Xr nsswitch.conf 5
+for a complete description of what each status code is.
+.Pp
+.Nm
+returns the value of the callback that caused the dispatcher to finish,
+or NS_NOTFOUND otherwise.
+.Sh SEE ALSO
+.Xr hesiod 3 ,
+.Xr stdarg 3 ,
+.Xr ypclnt 3 ,
+.Xr nsswitch.conf 5
+.Sh HISTORY
+The
+.Nm
+routines first appeared in
+.Fx 4.1 .
+They were imported from the
+.Nx
+Project,
+where they appeared first in
+.Nx 1.4 .
+.Sh AUTHORS
+Luke Mewburn
+.Aq lukem@netbsd.org
+wrote this freely distributable name-service switch implementation,
+using ideas from the
+.Tn ULTRIX
+.Xr svc.conf 5
+and
+.Tn Solaris
+.Xr nsswitch.conf 4
+manual pages.
+.Sh BUGS
+The
+.Nm
+routines are not thread safe.
+This will be rectified in the future.
+.Pp
+Currently there is no support for dynamically loadable dispatcher callback
+functions.
+It is anticipated that this will be added in the future in the back-end
+without requiring changes to code that invokes
+.Fn nsdispatch .
diff --git a/newlib/libc/sys/linux/net/nsdispatch.c b/newlib/libc/sys/linux/net/nsdispatch.c
new file mode 100644
index 000000000..ea5fc6d4b
--- /dev/null
+++ b/newlib/libc/sys/linux/net/nsdispatch.c
@@ -0,0 +1,266 @@
+/* $NetBSD: nsdispatch.c,v 1.9 1999/01/25 00:16:17 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <fcntl.h>
+#define _NS_PRIVATE
+#include <nsswitch.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+/*
+ * default sourcelist: `files'
+ */
+const ns_src __nsdefaultsrc[] = {
+ { NSSRC_FILES, NS_SUCCESS },
+ { 0 },
+};
+
+
+static int _nsmapsize = 0;
+static ns_dbt *_nsmap = NULL;
+
+/*
+ * size of dynamic array chunk for _nsmap and _nsmap[x].srclist
+ */
+#define NSELEMSPERCHUNK 8
+
+
+int _nscmp(const void *, const void *);
+
+
+int
+_nscmp(a, b)
+ const void *a;
+ const void *b;
+{
+ return (strcasecmp(((const ns_dbt *)a)->name,
+ ((const ns_dbt *)b)->name));
+}
+
+
+void
+_nsdbtaddsrc(dbt, src)
+ ns_dbt *dbt;
+ const ns_src *src;
+{
+ if ((dbt->srclistsize % NSELEMSPERCHUNK) == 0) {
+ dbt->srclist = (ns_src *)realloc(dbt->srclist,
+ (dbt->srclistsize + NSELEMSPERCHUNK) * sizeof(ns_src));
+ if (dbt->srclist == NULL)
+ printf("nsdispatch: memory allocation failure\n");
+ }
+ memmove(&dbt->srclist[dbt->srclistsize++], src, sizeof(ns_src));
+}
+
+
+void
+_nsdbtdump(dbt)
+ const ns_dbt *dbt;
+{
+ int i;
+
+ printf("%s (%d source%s):", dbt->name, dbt->srclistsize,
+ dbt->srclistsize == 1 ? "" : "s");
+ for (i = 0; i < dbt->srclistsize; i++) {
+ printf(" %s", dbt->srclist[i].name);
+ if (!(dbt->srclist[i].flags &
+ (NS_UNAVAIL|NS_NOTFOUND|NS_TRYAGAIN)) &&
+ (dbt->srclist[i].flags & NS_SUCCESS))
+ continue;
+ printf(" [");
+ if (!(dbt->srclist[i].flags & NS_SUCCESS))
+ printf(" SUCCESS=continue");
+ if (dbt->srclist[i].flags & NS_UNAVAIL)
+ printf(" UNAVAIL=return");
+ if (dbt->srclist[i].flags & NS_NOTFOUND)
+ printf(" NOTFOUND=return");
+ if (dbt->srclist[i].flags & NS_TRYAGAIN)
+ printf(" TRYAGAIN=return");
+ printf(" ]");
+ }
+ printf("\n");
+}
+
+
+const ns_dbt *
+_nsdbtget(name)
+ const char *name;
+{
+ static time_t confmod;
+
+ struct stat statbuf;
+ ns_dbt dbt;
+
+ extern FILE *_nsyyin;
+ extern int _nsyyparse(void);
+
+ dbt.name = name;
+
+ if (confmod) {
+ if (stat(_PATH_NS_CONF, &statbuf) == -1)
+ return (NULL);
+ if (confmod < statbuf.st_mtime) {
+ int i, j;
+
+ for (i = 0; i < _nsmapsize; i++) {
+ for (j = 0; j < _nsmap[i].srclistsize; j++) {
+ if (_nsmap[i].srclist[j].name != NULL) {
+ /*LINTED const cast*/
+ free((void *)
+ _nsmap[i].srclist[j].name);
+ }
+ }
+ if (_nsmap[i].srclist)
+ free(_nsmap[i].srclist);
+ if (_nsmap[i].name) {
+ /*LINTED const cast*/
+ free((void *)_nsmap[i].name);
+ }
+ }
+ if (_nsmap)
+ free(_nsmap);
+ _nsmap = NULL;
+ _nsmapsize = 0;
+ confmod = 0;
+ }
+ }
+ if (!confmod) {
+ if (stat(_PATH_NS_CONF, &statbuf) == -1)
+ return (NULL);
+ _nsyyin = fopen(_PATH_NS_CONF, "r");
+ if (_nsyyin == NULL)
+ return (NULL);
+ _nsyyparse();
+ (void)fclose(_nsyyin);
+ qsort(_nsmap, (size_t)_nsmapsize, sizeof(ns_dbt), _nscmp);
+ confmod = statbuf.st_mtime;
+ }
+ return (bsearch(&dbt, _nsmap, (size_t)_nsmapsize, sizeof(ns_dbt),
+ _nscmp));
+}
+
+
+void
+_nsdbtput(dbt)
+ const ns_dbt *dbt;
+{
+ int i;
+
+ for (i = 0; i < _nsmapsize; i++) {
+ if (_nscmp(dbt, &_nsmap[i]) == 0) {
+ /* overwrite existing entry */
+ if (_nsmap[i].srclist != NULL)
+ free(_nsmap[i].srclist);
+ memmove(&_nsmap[i], dbt, sizeof(ns_dbt));
+ return;
+ }
+ }
+
+ if ((_nsmapsize % NSELEMSPERCHUNK) == 0) {
+ _nsmap = (ns_dbt *)realloc(_nsmap,
+ (_nsmapsize + NSELEMSPERCHUNK) * sizeof(ns_dbt));
+ if (_nsmap == NULL)
+ printf("nsdispatch: memory allocation failure\n");
+ }
+ memmove(&_nsmap[_nsmapsize++], dbt, sizeof(ns_dbt));
+}
+
+
+int
+#if __STDC__
+nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database,
+ const char *method, const ns_src defaults[], ...)
+#else
+nsdispatch(retval, disp_tab, database, method, defaults, va_alist)
+ void *retval;
+ const ns_dtab disp_tab[];
+ const char *database;
+ const char *method;
+ const ns_src defaults[];
+ va_dcl
+#endif
+{
+ va_list ap;
+ int i, curdisp, result;
+ const ns_dbt *dbt;
+ const ns_src *srclist;
+ int srclistsize;
+
+ dbt = _nsdbtget(database);
+ if (dbt != NULL) {
+ srclist = dbt->srclist;
+ srclistsize = dbt->srclistsize;
+ } else {
+ srclist = defaults;
+ srclistsize = 0;
+ while (srclist[srclistsize].name != NULL)
+ srclistsize++;
+ }
+ result = 0;
+
+ for (i = 0; i < srclistsize; i++) {
+ for (curdisp = 0; disp_tab[curdisp].src != NULL; curdisp++)
+ if (strcasecmp(disp_tab[curdisp].src,
+ srclist[i].name) == 0)
+ break;
+ result = 0;
+ if (disp_tab[curdisp].callback) {
+#if __STDC__
+ va_start(ap, defaults);
+#else
+ va_start(ap);
+#endif
+ result = disp_tab[curdisp].callback(retval,
+ disp_tab[curdisp].cb_data, ap);
+ va_end(ap);
+ if (result & srclist[i].flags) {
+ break;
+ }
+ }
+ }
+ return (result ? result : NS_NOTFOUND);
+}
diff --git a/newlib/libc/sys/linux/net/nslexer.c b/newlib/libc/sys/linux/net/nslexer.c
new file mode 100644
index 000000000..3f6ba4dcd
--- /dev/null
+++ b/newlib/libc/sys/linux/net/nslexer.c
@@ -0,0 +1,1712 @@
+#define yy_create_buffer _nsyy_create_buffer
+#define yy_delete_buffer _nsyy_delete_buffer
+#define yy_scan_buffer _nsyy_scan_buffer
+#define yy_scan_string _nsyy_scan_string
+#define yy_scan_bytes _nsyy_scan_bytes
+#define yy_flex_debug _nsyy_flex_debug
+#define yy_init_buffer _nsyy_init_buffer
+#define yy_flush_buffer _nsyy_flush_buffer
+#define yy_load_buffer_state _nsyy_load_buffer_state
+#define yy_switch_to_buffer _nsyy_switch_to_buffer
+#define yyin _nsyyin
+#define yyleng _nsyyleng
+#define yylex _nsyylex
+#define yyout _nsyyout
+#define yyrestart _nsyyrestart
+#define yytext _nsyytext
+#define yylineno _nsyylineno
+#define yywrap _nsyywrap
+
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header$
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index. If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition. This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state. The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 1024
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ *yy_cp = yy_hold_char; \
+ YY_RESTORE_YY_MORE_OFFSET \
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+ YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+ } \
+ while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+ {
+ FILE *yy_input_file;
+
+ char *yy_ch_buf; /* input buffer */
+ char *yy_buf_pos; /* current position in input buffer */
+
+ /* Size of input buffer in bytes, not including room for EOB
+ * characters.
+ */
+ yy_size_t yy_buf_size;
+
+ /* Number of characters read into yy_ch_buf, not including EOB
+ * characters.
+ */
+ int yy_n_chars;
+
+ /* Whether we "own" the buffer - i.e., we know we created it,
+ * and can realloc() it to grow it, and should free() it to
+ * delete it.
+ */
+ int yy_is_our_buffer;
+
+ /* Whether this is an "interactive" input source; if so, and
+ * if we're using stdio for input, then we want to use getc()
+ * instead of fread(), to make sure we stop fetching input after
+ * each newline.
+ */
+ int yy_is_interactive;
+
+ /* Whether we're considered to be at the beginning of a line.
+ * If so, '^' rules will be active on the next match, otherwise
+ * not.
+ */
+ int yy_at_bol;
+
+ /* Whether to try to fill the input buffer when we reach the
+ * end of it.
+ */
+ int yy_fill_buffer;
+
+ int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+ /* When an EOF's been seen but there's still some text to process
+ * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+ * shouldn't try reading from the input source any more. We might
+ * still have a bunch of tokens to match, though, because of
+ * possible backing-up.
+ *
+ * When we actually see the EOF, we change the status to "new"
+ * (via yyrestart()), so that the user can continue scanning by
+ * just pointing yyin at a new input file.
+ */
+#define YY_BUFFER_EOF_PENDING 2
+ };
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1; /* whether we need to initialize */
+static int yy_start = 0; /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin. A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_is_interactive = is_interactive; \
+ }
+
+#define yy_set_bol(at_bol) \
+ { \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_at_bol = at_bol; \
+ }
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+
+#define YY_USES_REJECT
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern int yylineno;
+int yylineno = 1;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+ yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yy_hold_char = *yy_cp; \
+ *yy_cp = '\0'; \
+ yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 13
+#define YY_END_OF_BUFFER 14
+static yyconst short int yy_acclist[83] =
+ { 0,
+ 14, 12, 13, 1, 12, 13, 4, 13, 2, 12,
+ 13, 11, 12, 13, 11, 12, 13, 11, 12, 13,
+ 11, 12, 13, 11, 12, 13, 11, 12, 13, 11,
+ 12, 13, 12, 13, 1, 2, 11, 11, 11, 11,
+ 11, 11, 11, 3, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
+ 11, 11, 11, 11, 9, 11, 11, 11, 11, 11,
+ 11, 5, 11, 11, 6, 11, 10, 11, 7, 11,
+ 8, 11
+ } ;
+
+static yyconst short int yy_accept[60] =
+ { 0,
+ 1, 1, 1, 2, 4, 7, 9, 12, 15, 18,
+ 21, 24, 27, 30, 33, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
+ 60, 61, 62, 63, 64, 65, 67, 68, 69, 70,
+ 71, 72, 74, 75, 77, 79, 81, 83, 83
+ } ;
+
+static yyconst int yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 1, 1, 4, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 5, 5, 5,
+ 5, 5, 5, 5, 5, 5, 5, 1, 1, 1,
+ 1, 1, 1, 1, 6, 7, 8, 9, 10, 11,
+ 12, 7, 13, 7, 7, 14, 7, 15, 16, 7,
+ 7, 17, 18, 19, 20, 21, 7, 7, 22, 7,
+ 1, 23, 1, 1, 5, 1, 6, 7, 8, 9,
+
+ 10, 11, 12, 7, 13, 7, 7, 14, 7, 15,
+ 16, 7, 7, 17, 18, 19, 20, 21, 7, 7,
+ 22, 7, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst int yy_meta[24] =
+ { 0,
+ 1, 1, 2, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 1
+ } ;
+
+static yyconst short int yy_base[61] =
+ { 0,
+ 0, 0, 68, 69, 65, 69, 0, 0, 50, 49,
+ 54, 43, 45, 46, 57, 57, 0, 0, 43, 38,
+ 37, 47, 32, 47, 69, 33, 40, 30, 41, 42,
+ 26, 33, 29, 27, 33, 30, 35, 25, 19, 23,
+ 19, 30, 22, 14, 18, 0, 14, 18, 16, 19,
+ 19, 0, 12, 0, 0, 0, 0, 69, 23, 22
+ } ;
+
+static yyconst short int yy_def[61] =
+ { 0,
+ 58, 1, 58, 58, 58, 58, 59, 60, 60, 60,
+ 60, 60, 60, 60, 58, 58, 59, 60, 60, 60,
+ 60, 60, 60, 60, 58, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+ 60, 60, 60, 60, 60, 60, 60, 0, 58, 58
+ } ;
+
+static yyconst short int yy_nxt[93] =
+ { 0,
+ 4, 5, 6, 7, 4, 8, 8, 9, 8, 8,
+ 8, 8, 8, 8, 10, 8, 11, 12, 13, 14,
+ 8, 8, 15, 17, 18, 17, 57, 56, 55, 54,
+ 53, 52, 51, 50, 49, 48, 47, 46, 45, 44,
+ 43, 42, 41, 40, 39, 38, 37, 36, 35, 34,
+ 33, 32, 31, 30, 29, 28, 27, 26, 16, 25,
+ 24, 23, 22, 21, 20, 19, 16, 58, 3, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58
+
+ } ;
+
+static yyconst short int yy_chk[93] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 59, 60, 59, 53, 51, 50, 49,
+ 48, 47, 45, 44, 43, 42, 41, 40, 39, 38,
+ 37, 36, 35, 34, 33, 32, 31, 30, 29, 28,
+ 27, 26, 24, 23, 22, 21, 20, 19, 16, 15,
+ 14, 13, 12, 11, 10, 9, 5, 3, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58
+
+ } ;
+
+static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
+static char *yy_full_match;
+static int yy_lp;
+#define REJECT \
+{ \
+*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
+yy_cp = yy_full_match; /* restore poss. backed-over text */ \
+++yy_lp; \
+goto find_rule; \
+}
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "nslexer.l"
+#define INITIAL 0
+#line 2 "nslexer.l"
+/* $NetBSD: nslexer.l,v 1.3 1999/01/25 00:16:17 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid =
+ "$FreeBSD: src/lib/libc/net/nslexer.l,v 1.3 2001/11/11 02:48:09 bde Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <ctype.h>
+#define _NS_PRIVATE
+#include <nsswitch.h>
+#include <string.h>
+
+#include "nsparser.h"
+
+#define YY_NO_UNPUT
+
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+ if ( yy_current_buffer->yy_is_interactive ) \
+ { \
+ int c = '*', n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+ if ( c == '\n' ) \
+ buf[n++] = (char) c; \
+ if ( c == EOF && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ result = n; \
+ } \
+ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+ && ferror( yyin ) ) \
+ YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+ YY_USER_ACTION
+
+YY_DECL
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp = NULL, *yy_bp = NULL;
+ register int yy_act;
+
+#line 65 "nslexer.l"
+
+
+
+ if ( yy_init )
+ {
+ yy_init = 0;
+
+#ifdef YY_USER_INIT
+ YY_USER_INIT;
+#endif
+
+ if ( ! yy_start )
+ yy_start = 1; /* first start state */
+
+ if ( ! yyin )
+ yyin = stdin;
+
+ if ( ! yyout )
+ yyout = stdout;
+
+ if ( ! yy_current_buffer )
+ yy_current_buffer =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_load_buffer_state();
+ }
+
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+ yy_cp = yy_c_buf_p;
+
+ /* Support of yytext. */
+ *yy_cp = yy_hold_char;
+
+ /* yy_bp points to the position in yy_ch_buf of the start of
+ * the current run.
+ */
+ yy_bp = yy_cp;
+
+ yy_current_state = yy_start;
+ yy_state_ptr = yy_state_buf;
+ *yy_state_ptr++ = yy_current_state;
+yy_match:
+ do
+ {
+ register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 59 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ *yy_state_ptr++ = yy_current_state;
+ ++yy_cp;
+ }
+ while ( yy_base[yy_current_state] != 69 );
+
+yy_find_action:
+ yy_current_state = *--yy_state_ptr;
+ yy_lp = yy_accept[yy_current_state];
+find_rule: /* we branch to this label when backing up */
+ for ( ; ; ) /* until we find what rule we matched */
+ {
+ if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
+ {
+ yy_act = yy_acclist[yy_lp];
+ {
+ yy_full_match = yy_cp;
+ break;
+ }
+ }
+ --yy_cp;
+ yy_current_state = *--yy_state_ptr;
+ yy_lp = yy_accept[yy_current_state];
+ }
+
+ YY_DO_BEFORE_ACTION;
+
+ if ( yy_act != YY_END_OF_BUFFER )
+ {
+ int yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
+ ++yylineno;
+ }
+
+do_action: /* This label is used only to access EOF actions. */
+
+
+ switch ( yy_act )
+ { /* beginning of action switch */
+case 1:
+YY_RULE_SETUP
+#line 67 "nslexer.l"
+; /* skip whitespace */
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 69 "nslexer.l"
+; /* skip comments */
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 71 "nslexer.l"
+; /* allow continuation */
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 73 "nslexer.l"
+return NL;
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 75 "nslexer.l"
+return SUCCESS;
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 76 "nslexer.l"
+return UNAVAIL;
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 77 "nslexer.l"
+return NOTFOUND;
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 78 "nslexer.l"
+return TRYAGAIN;
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 80 "nslexer.l"
+return RETURN;
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 81 "nslexer.l"
+return CONTINUE;
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 83 "nslexer.l"
+{
+ char *p;
+ int i;
+ size_t len;
+
+ len = strlen (yytext) + 1;
+ if ((p = malloc (len)) == NULL)
+ printf("nsdispatch: memory allocation failure\n");
+ else
+ memcpy (p, yytext, len);
+
+ for (i = 0; i < strlen(p); i++) {
+ if (isupper((unsigned char)p[i]))
+ p[i] = tolower((unsigned char)p[i]);
+ }
+ _nsyylval.str = p;
+ return STRING;
+ }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 99 "nslexer.l"
+return yytext[0];
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 101 "nslexer.l"
+ECHO;
+ YY_BREAK
+ case YY_STATE_EOF(INITIAL):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+ {
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * yylex(). If so, then we have to assure
+ * consistency between yy_current_buffer and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yy_current_buffer->yy_input_file = yyin;
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+ }
+
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
+
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
+
+ yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
+ }
+
+ else
+ {
+ yy_cp = yy_c_buf_p;
+ goto yy_find_action;
+ }
+ }
+
+ else switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yy_did_buffer_switch_on_eof = 0;
+
+ if ( yywrap() )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
+ }
+
+ else
+ {
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+ }
+ break;
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p =
+ yytext_ptr + yy_amount_of_matched_text;
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
+
+ case EOB_ACT_LAST_MATCH:
+ yy_c_buf_p =
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+ yy_current_state = yy_get_previous_state();
+
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
+ }
+
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
+ } /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ * EOB_ACT_LAST_MATCH -
+ * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ * EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+ {
+ register char *dest = yy_current_buffer->yy_ch_buf;
+ register char *source = yytext_ptr;
+ register int number_to_move, i;
+ int ret_val;
+
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--end of buffer missed" );
+
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+ {
+ /* We matched a single character, the EOB, so
+ * treat this as a final EOF.
+ */
+ return EOB_ACT_END_OF_FILE;
+ }
+
+ else
+ {
+ /* We matched some text prior to the EOB, first
+ * process it.
+ */
+ return EOB_ACT_LAST_MATCH;
+ }
+ }
+
+ /* Try to read more data. */
+
+ /* First move last chars to start of buffer. */
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+ for ( i = 0; i < number_to_move; ++i )
+ *(dest++) = *(source++);
+
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ /* don't do the read, it's not guaranteed to return an EOF,
+ * just force an EOF
+ */
+ yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+ else
+ {
+ int num_to_read =
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+ /* just a shorter name for the current buffer */
+ YY_BUFFER_STATE b = yy_current_buffer;
+
+ int yy_c_buf_p_offset =
+ (int) (yy_c_buf_p - b->yy_ch_buf);
+
+ if ( b->yy_is_our_buffer )
+ {
+ int new_size = b->yy_buf_size * 2;
+
+ if ( new_size <= 0 )
+ b->yy_buf_size += b->yy_buf_size / 8;
+ else
+ b->yy_buf_size *= 2;
+
+ b->yy_ch_buf = (char *)
+ /* Include room in for 2 EOB chars. */
+ yy_flex_realloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 );
+ }
+ else
+ /* Can't grow it, we don't own it. */
+ b->yy_ch_buf = 0;
+
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR(
+ "fatal error - scanner input buffer overflow" );
+
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+ num_to_read = yy_current_buffer->yy_buf_size -
+ number_to_move - 1;
+#endif
+ }
+
+ if ( num_to_read > YY_READ_BUF_SIZE )
+ num_to_read = YY_READ_BUF_SIZE;
+
+ /* Read in more data. */
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+ yy_n_chars, num_to_read );
+
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ if ( yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
+ ret_val = EOB_ACT_END_OF_FILE;
+ yyrestart( yyin );
+ }
+
+ else
+ {
+ ret_val = EOB_ACT_LAST_MATCH;
+ yy_current_buffer->yy_buffer_status =
+ YY_BUFFER_EOF_PENDING;
+ }
+ }
+
+ else
+ ret_val = EOB_ACT_CONTINUE_SCAN;
+
+ yy_n_chars += number_to_move;
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+ return ret_val;
+ }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+ {
+ register yy_state_type yy_current_state;
+ register char *yy_cp;
+
+ yy_current_state = yy_start;
+ yy_state_ptr = yy_state_buf;
+ *yy_state_ptr++ = yy_current_state;
+
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+ {
+ register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 59 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ *yy_state_ptr++ = yy_current_state;
+ }
+
+ return yy_current_state;
+ }
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ * next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+ {
+ register int yy_is_jam;
+
+ register YY_CHAR yy_c = 1;
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
+ yy_current_state = (int) yy_def[yy_current_state];
+ if ( yy_current_state >= 59 )
+ yy_c = yy_meta[(unsigned int) yy_c];
+ }
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_is_jam = (yy_current_state == 58);
+ if ( ! yy_is_jam )
+ *yy_state_ptr++ = yy_current_state;
+
+ return yy_is_jam ? 0 : yy_current_state;
+ }
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+ {
+ register char *yy_cp = yy_c_buf_p;
+
+ /* undo effects of setting up yytext */
+ *yy_cp = yy_hold_char;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
+ /* +2 for EOB chars. */
+ register int number_to_move = yy_n_chars + 2;
+ register char *dest = &yy_current_buffer->yy_ch_buf[
+ yy_current_buffer->yy_buf_size + 2];
+ register char *source =
+ &yy_current_buffer->yy_ch_buf[number_to_move];
+
+ while ( source > yy_current_buffer->yy_ch_buf )
+ *--dest = *--source;
+
+ yy_cp += (int) (dest - source);
+ yy_bp += (int) (dest - source);
+ yy_current_buffer->yy_n_chars =
+ yy_n_chars = yy_current_buffer->yy_buf_size;
+
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ YY_FATAL_ERROR( "flex scanner push-back overflow" );
+ }
+
+ *--yy_cp = (char) c;
+
+ if ( c == '\n' )
+ --yylineno;
+
+ yytext_ptr = yy_bp;
+ yy_hold_char = *yy_cp;
+ yy_c_buf_p = yy_cp;
+ }
+#endif /* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+ {
+ int c;
+
+ *yy_c_buf_p = yy_hold_char;
+
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
+ /* yy_c_buf_p now points to the character we want to return.
+ * If this occurs *before* the EOB characters, then it's a
+ * valid NUL; if not, then we've hit the end of the buffer.
+ */
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ /* This was really a NUL. */
+ *yy_c_buf_p = '\0';
+
+ else
+ { /* need more input */
+ int offset = yy_c_buf_p - yytext_ptr;
+ ++yy_c_buf_p;
+
+ switch ( yy_get_next_buffer() )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ yyrestart( yyin );
+
+ /* fall through */
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( yywrap() )
+ return EOF;
+
+ if ( ! yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
+#ifdef __cplusplus
+ return yyinput();
+#else
+ return input();
+#endif
+ }
+
+ case EOB_ACT_CONTINUE_SCAN:
+ yy_c_buf_p = yytext_ptr + offset;
+ break;
+ }
+ }
+ }
+
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
+ *yy_c_buf_p = '\0'; /* preserve yytext */
+ yy_hold_char = *++yy_c_buf_p;
+
+ if ( c == '\n' )
+ ++yylineno;
+
+ return c;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! yy_current_buffer )
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_init_buffer( yy_current_buffer, input_file );
+ yy_load_buffer_state();
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( yy_current_buffer == new_buffer )
+ return;
+
+ if ( yy_current_buffer )
+ {
+ /* Flush out information for old buffer. */
+ *yy_c_buf_p = yy_hold_char;
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+ yy_current_buffer->yy_n_chars = yy_n_chars;
+ }
+
+ yy_current_buffer = new_buffer;
+ yy_load_buffer_state();
+
+ /* We don't actually know whether we did this switch during
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
+ * to go ahead and always set it.
+ */
+ yy_did_buffer_switch_on_eof = 1;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+ {
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+ yyin = yy_current_buffer->yy_input_file;
+ yy_hold_char = *yy_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_buf_size = size;
+
+ /* yy_ch_buf has to be 2 characters longer than the size given because
+ * we need to put in 2 end-of-buffer characters.
+ */
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+ if ( ! b->yy_ch_buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+ b->yy_is_our_buffer = 1;
+
+ yy_init_buffer( b, file );
+
+ return b;
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
+ if ( ! b )
+ return;
+
+ if ( b == yy_current_buffer )
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+ if ( b->yy_is_our_buffer )
+ yy_flex_free( (void *) b->yy_ch_buf );
+
+ yy_flex_free( (void *) b );
+ }
+
+
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ yy_flush_buffer( b );
+
+ b->yy_input_file = file;
+ b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+ b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->yy_is_interactive = 0;
+#else
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
+ return;
+
+ b->yy_n_chars = 0;
+
+ /* We always need two end-of-buffer characters. The first causes
+ * a transition to the end-of-buffer state. The second causes
+ * a jam in that state.
+ */
+ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+ b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+ b->yy_buf_pos = &b->yy_ch_buf[0];
+
+ b->yy_at_bol = 1;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ if ( b == yy_current_buffer )
+ yy_load_buffer_state();
+ }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+ {
+ YY_BUFFER_STATE b;
+
+ if ( size < 2 ||
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
+ /* They forgot to leave room for the EOB's. */
+ return 0;
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ if ( ! b )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+ b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_pos = b->yy_ch_buf = base;
+ b->yy_is_our_buffer = 0;
+ b->yy_input_file = 0;
+ b->yy_n_chars = b->yy_buf_size;
+ b->yy_is_interactive = 0;
+ b->yy_at_bol = 1;
+ b->yy_fill_buffer = 0;
+ b->yy_buffer_status = YY_BUFFER_NEW;
+
+ yy_switch_to_buffer( b );
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; yy_str[len]; ++len )
+ ;
+
+ return yy_scan_bytes( yy_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+ {
+ YY_BUFFER_STATE b;
+ char *buf;
+ yy_size_t n;
+ int i;
+
+ /* Get memory for full buffer, including space for trailing EOB's. */
+ n = len + 2;
+ buf = (char *) yy_flex_alloc( n );
+ if ( ! buf )
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
+
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+ b = yy_scan_buffer( buf, n );
+ if ( ! b )
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+ /* It's okay to grow etc. this buffer, and we should throw it
+ * away when we're done.
+ */
+ b->yy_is_our_buffer = 1;
+
+ return b;
+ }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ {
+ yy_size_t new_size;
+
+ yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yy_start_stack_depth * sizeof( int );
+
+ if ( ! yy_start_stack )
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+ else
+ yy_start_stack = (int *) yy_flex_realloc(
+ (void *) yy_start_stack, new_size );
+
+ if ( ! yy_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
+
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+ BEGIN(new_state);
+ }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+ {
+ if ( --yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
+
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+ {
+ return yy_start_stack[yy_start_stack_ptr - 1];
+ }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ yytext[yyleng] = yy_hold_char; \
+ yy_c_buf_p = yytext + n; \
+ yy_hold_char = *yy_c_buf_p; \
+ *yy_c_buf_p = '\0'; \
+ yyleng = n; \
+ } \
+ while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+ {
+ register int i;
+ for ( i = 0; i < n; ++i )
+ s1[i] = s2[i];
+ }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+ {
+ register int n;
+ for ( n = 0; s[n]; ++n )
+ ;
+
+ return n;
+ }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+ {
+ return (void *) malloc( size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+ {
+ /* The cast to (char *) in the following accommodates both
+ * implementations that use char* generic pointers, and those
+ * that use void* generic pointers. It works with the latter
+ * because both ANSI C and C++ allow castless assignment from
+ * any pointer type to void*, and deal with argument conversions
+ * as though doing an assignment.
+ */
+ return (void *) realloc( (char *) ptr, size );
+ }
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+
+#if YY_MAIN
+int main()
+ {
+ yylex();
+ return 0;
+ }
+#endif
+#line 101 "nslexer.l"
+
+
+#undef _nsyywrap
+int
+_nsyywrap()
+{
+ return 1;
+} /* _nsyywrap */
+
+void
+_nsyyerror(msg)
+ const char *msg;
+{
+
+ printf("Error in nslexer\n");
+} /* _nsyyerror */
diff --git a/newlib/libc/sys/linux/net/nslexer.l b/newlib/libc/sys/linux/net/nslexer.l
new file mode 100644
index 000000000..0b66b6c66
--- /dev/null
+++ b/newlib/libc/sys/linux/net/nslexer.l
@@ -0,0 +1,114 @@
+%{
+/* $NetBSD: nslexer.l,v 1.3 1999/01/25 00:16:17 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid =
+ "$FreeBSD: src/lib/libc/net/nslexer.l,v 1.3 2001/11/11 02:48:09 bde Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#include <ctype.h>
+#define _NS_PRIVATE
+#include <nsswitch.h>
+#include <string.h>
+
+#include "nsparser.h"
+
+#define YY_NO_UNPUT
+
+%}
+
+%option yylineno
+
+BLANK [ \t]
+CR \n
+STRING [a-zA-Z][a-zA-Z0-9_]*
+
+%%
+
+{BLANK}+ ; /* skip whitespace */
+
+#.* ; /* skip comments */
+
+\\{CR} ; /* allow continuation */
+
+{CR} return NL;
+
+[sS][uU][cC][cC][eE][sS][sS] return SUCCESS;
+[uU][nN][aA][vV][aA][iI][lL] return UNAVAIL;
+[nN][oO][tT][fF][oO][uU][nN][dD] return NOTFOUND;
+[tT][rR][yY][aA][gG][aA][iI][nN] return TRYAGAIN;
+
+[rR][eE][tT][uU][rR][nN] return RETURN;
+[cC][oO][nN][tT][iI][nN][uU][eE] return CONTINUE;
+
+{STRING} {
+ char *p;
+ int i;
+
+ if ((p = strdup(yytext)) == NULL)
+ printf("nsdispatch: memory allocation failure\n");
+
+ for (i = 0; i < strlen(p); i++) {
+ if (isupper((unsigned char)p[i]))
+ p[i] = tolower((unsigned char)p[i]);
+ }
+ _nsyylval.str = p;
+ return STRING;
+ }
+
+. return yytext[0];
+
+%%
+
+#undef _nsyywrap
+int
+_nsyywrap()
+{
+ return 1;
+} /* _nsyywrap */
+
+void
+_nsyyerror(msg)
+ const char *msg;
+{
+
+ printf("Error in nslexer\n");
+} /* _nsyyerror */
diff --git a/newlib/libc/sys/linux/net/nsparser.c b/newlib/libc/sys/linux/net/nsparser.c
new file mode 100644
index 000000000..b4701aed1
--- /dev/null
+++ b/newlib/libc/sys/linux/net/nsparser.c
@@ -0,0 +1,541 @@
+#ifndef lint
+static char yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
+#endif
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define yyclearin (yychar=(-1))
+#define yyerrok (yyerrflag=0)
+#define YYRECOVERING (yyerrflag!=0)
+#define yyparse _nsyyparse
+#define yylex _nsyylex
+#define yyerror _nsyyerror
+#define yychar _nsyychar
+#define yyval _nsyyval
+#define yylval _nsyylval
+#define yydebug _nsyydebug
+#define yynerrs _nsyynerrs
+#define yyerrflag _nsyyerrflag
+#define yyss _nsyyss
+#define yyssp _nsyyssp
+#define yyvs _nsyyvs
+#define yyvsp _nsyyvsp
+#define yylhs _nsyylhs
+#define yylen _nsyylen
+#define yydefred _nsyydefred
+#define yydgoto _nsyydgoto
+#define yysindex _nsyysindex
+#define yyrindex _nsyyrindex
+#define yygindex _nsyygindex
+#define yytable _nsyytable
+#define yycheck _nsyycheck
+#define yyname _nsyyname
+#define yyrule _nsyyrule
+#define YYPREFIX "_nsyy"
+#line 2 "nsparser.y"
+/* $NetBSD: nsparser.y,v 1.3 1999/01/25 00:16:18 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid =
+ "$FreeBSD: src/lib/libc/net/nsparser.y,v 1.3 2002/03/21 22:47:17 obrien Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#define _NS_PRIVATE
+#include <nsswitch.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static void _nsaddsrctomap(const char *);
+
+static ns_dbt curdbt;
+static ns_src cursrc;
+#line 59 "nsparser.y"
+typedef union {
+ char *str;
+ int mapval;
+} YYSTYPE;
+#line 97 "y.tab.c"
+#define NL 257
+#define SUCCESS 258
+#define UNAVAIL 259
+#define NOTFOUND 260
+#define TRYAGAIN 261
+#define RETURN 262
+#define CONTINUE 263
+#define STRING 264
+#define YYERRCODE 256
+short _nsyylhs[] = { -1,
+ 0, 0, 3, 3, 4, 4, 4, 4, 5, 6,
+ 6, 7, 9, 7, 8, 8, 10, 1, 1, 1,
+ 1, 2, 2,
+};
+short _nsyylen[] = { 2,
+ 0, 1, 1, 2, 1, 3, 4, 2, 1, 1,
+ 2, 1, 0, 5, 1, 2, 3, 1, 1, 1,
+ 1, 1, 1,
+};
+short _nsyydefred[] = { 0,
+ 0, 5, 9, 0, 0, 3, 0, 8, 4, 0,
+ 6, 0, 0, 10, 13, 7, 11, 0, 18, 19,
+ 20, 21, 0, 0, 15, 0, 14, 16, 22, 23,
+ 17,
+};
+short _nsyydgoto[] = { 4,
+ 23, 31, 5, 6, 7, 13, 14, 24, 18, 25,
+};
+short _nsyysindex[] = { -255,
+ -249, 0, 0, 0, -255, 0, -41, 0, 0, -254,
+ 0, -73, -253, 0, 0, 0, 0, -245, 0, 0,
+ 0, 0, -42, -93, 0, -256, 0, 0, 0, 0,
+ 0,
+};
+short _nsyyrindex[] = { 20,
+ 0, 0, 0, 0, 21, 0, 0, 0, 0, 0,
+ 0, -252, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0,
+};
+short _nsyygindex[] = { 0,
+ 0, 0, 0, 17, 0, 0, 10, 0, 0, 1,
+};
+#define YYTABLESIZE 168
+short _nsyytable[] = { 27,
+ 1, 2, 11, 16, 12, 29, 30, 8, 3, 12,
+ 12, 12, 19, 20, 21, 22, 10, 15, 26, 1,
+ 2, 9, 17, 0, 28, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 19, 20, 21, 22,
+};
+short _nsyycheck[] = { 93,
+ 256, 257, 257, 257, 257, 262, 263, 257, 264, 264,
+ 264, 264, 258, 259, 260, 261, 58, 91, 61, 0,
+ 0, 5, 13, -1, 24, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 258, 259, 260, 261,
+};
+#define YYFINAL 4
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 264
+#if YYDEBUG
+char *_nsyyname[] = {
+"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"':'",0,0,"'='",0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"NL","SUCCESS",
+"UNAVAIL","NOTFOUND","TRYAGAIN","RETURN","CONTINUE","STRING",
+};
+char *_nsyyrule[] = {
+"$accept : File",
+"File :",
+"File : Lines",
+"Lines : Entry",
+"Lines : Lines Entry",
+"Entry : NL",
+"Entry : Database ':' NL",
+"Entry : Database ':' Srclist NL",
+"Entry : error NL",
+"Database : STRING",
+"Srclist : Item",
+"Srclist : Srclist Item",
+"Item : STRING",
+"$$1 :",
+"Item : STRING '[' $$1 Criteria ']'",
+"Criteria : Criterion",
+"Criteria : Criteria Criterion",
+"Criterion : Status '=' Action",
+"Status : SUCCESS",
+"Status : UNAVAIL",
+"Status : NOTFOUND",
+"Status : TRYAGAIN",
+"Action : RETURN",
+"Action : CONTINUE",
+};
+#endif
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
+#endif
+#endif
+int yydebug;
+int yynerrs;
+int yyerrflag;
+int yychar;
+short *yyssp;
+YYSTYPE *yyvsp;
+YYSTYPE yyval;
+YYSTYPE yylval;
+short yyss[YYSTACKSIZE];
+YYSTYPE yyvs[YYSTACKSIZE];
+#define yystacksize YYSTACKSIZE
+#line 150 "nsparser.y"
+
+static void
+_nsaddsrctomap(elem)
+ const char *elem;
+{
+ int i, lineno;
+ extern int _nsyylineno;
+ extern char * _nsyytext;
+
+ lineno = _nsyylineno - (*_nsyytext == '\n' ? 1 : 0);
+ if (curdbt.srclistsize > 0) {
+ if ((strcasecmp(elem, NSSRC_COMPAT) == 0) ||
+ (strcasecmp(curdbt.srclist[0].name, NSSRC_COMPAT) == 0)) {
+ /* XXX: syslog the following */
+ printf("line %d 'compat' used with other sources",
+ lineno);
+ return;
+ }
+ }
+ for (i = 0; i < curdbt.srclistsize; i++) {
+ if (strcasecmp(curdbt.srclist[i].name, elem) == 0) {
+ /* XXX: syslog the following */
+ printf("%s line %d: duplicate source '%s'",
+ lineno, elem);
+ return;
+ }
+ }
+ cursrc.name = elem;
+ _nsdbtaddsrc(&curdbt, &cursrc);
+}
+#line 276 "y.tab.c"
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+int
+yyparse()
+{
+ register int yym, yyn, yystate;
+#if YYDEBUG
+ register char *yys;
+ extern char *getenv();
+
+ if (yys = getenv("YYDEBUG"))
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+#endif
+
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = (-1);
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+ *yyssp = yystate = 0;
+
+yyloop:
+ if (yyn = yydefred[yystate]) goto yyreduce;
+ if (yychar < 0)
+ {
+ if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ }
+ if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, shifting to state %d\n",
+ YYPREFIX, yystate, yytable[yyn]);
+#endif
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ goto yyoverflow;
+ }
+ *++yyssp = yystate = yytable[yyn];
+ *++yyvsp = yylval;
+ yychar = (-1);
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag) goto yyinrecovery;
+#ifdef lint
+ goto yynewerror;
+#endif
+yynewerror:
+ yyerror("syntax error");
+#ifdef lint
+ goto yyerrlab;
+#endif
+yyerrlab:
+ ++yynerrs;
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
+#endif
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ goto yyoverflow;
+ }
+ *++yyssp = yystate = yytable[yyn];
+ *++yyvsp = yylval;
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: error recovery discarding state %d\n",
+ YYPREFIX, *yyssp);
+#endif
+ if (yyssp <= yyss) goto yyabort;
+ --yyssp;
+ --yyvsp;
+ }
+ }
+ }
+ else
+ {
+ if (yychar == 0) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
+ YYPREFIX, yystate, yychar, yys);
+ }
+#endif
+ yychar = (-1);
+ goto yyloop;
+ }
+yyreduce:
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+ YYPREFIX, yystate, yyn, yyrule[yyn]);
+#endif
+ yym = yylen[yyn];
+ yyval = yyvsp[1-yym];
+ switch (yyn)
+ {
+case 7:
+#line 87 "nsparser.y"
+{
+ _nsdbtput(&curdbt);
+ }
+break;
+case 8:
+#line 91 "nsparser.y"
+{
+ yyerrok;
+ }
+break;
+case 9:
+#line 98 "nsparser.y"
+{
+ curdbt.name = yylval.str;
+ curdbt.srclist = NULL;
+ curdbt.srclistsize = 0;
+ }
+break;
+case 12:
+#line 112 "nsparser.y"
+{
+ cursrc.flags = NS_SUCCESS;
+ _nsaddsrctomap(yyvsp[0].str);
+ }
+break;
+case 13:
+#line 116 "nsparser.y"
+{ cursrc.flags = NS_SUCCESS; }
+break;
+case 14:
+#line 117 "nsparser.y"
+{
+ _nsaddsrctomap(yyvsp[-4].str);
+ }
+break;
+case 17:
+#line 129 "nsparser.y"
+{
+ if (yyvsp[0].mapval) /* if action == RETURN set RETURN bit */
+ cursrc.flags |= yyvsp[-2].mapval;
+ else /* else unset it */
+ cursrc.flags &= ~yyvsp[-2].mapval;
+ }
+break;
+case 18:
+#line 138 "nsparser.y"
+{ yyval.mapval = NS_SUCCESS; }
+break;
+case 19:
+#line 139 "nsparser.y"
+{ yyval.mapval = NS_UNAVAIL; }
+break;
+case 20:
+#line 140 "nsparser.y"
+{ yyval.mapval = NS_NOTFOUND; }
+break;
+case 21:
+#line 141 "nsparser.y"
+{ yyval.mapval = NS_TRYAGAIN; }
+break;
+case 22:
+#line 145 "nsparser.y"
+{ yyval.mapval = 1L; }
+break;
+case 23:
+#line 146 "nsparser.y"
+{ yyval.mapval = 0L; }
+break;
+#line 487 "y.tab.c"
+ }
+ yyssp -= yym;
+ yystate = *yyssp;
+ yyvsp -= yym;
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
+#endif
+ yystate = YYFINAL;
+ *++yyssp = YYFINAL;
+ *++yyvsp = yyval;
+ if (yychar < 0)
+ {
+ if ((yychar = yylex()) < 0) yychar = 0;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = 0;
+ if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
+ if (!yys) yys = "illegal-symbol";
+ printf("%sdebug: state %d, reading %d (%s)\n",
+ YYPREFIX, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == 0) goto yyaccept;
+ goto yyloop;
+ }
+ if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yyssp, yystate);
+#endif
+ if (yyssp >= yyss + yystacksize - 1)
+ {
+ goto yyoverflow;
+ }
+ *++yyssp = yystate;
+ *++yyvsp = yyval;
+ goto yyloop;
+yyoverflow:
+ yyerror("yacc stack overflow");
+yyabort:
+ return (1);
+yyaccept:
+ return (0);
+}
diff --git a/newlib/libc/sys/linux/net/nsparser.h b/newlib/libc/sys/linux/net/nsparser.h
new file mode 100644
index 000000000..6a6fae0be
--- /dev/null
+++ b/newlib/libc/sys/linux/net/nsparser.h
@@ -0,0 +1,13 @@
+#define NL 257
+#define SUCCESS 258
+#define UNAVAIL 259
+#define NOTFOUND 260
+#define TRYAGAIN 261
+#define RETURN 262
+#define CONTINUE 263
+#define STRING 264
+typedef union {
+ char *str;
+ int mapval;
+} YYSTYPE;
+extern YYSTYPE _nsyylval;
diff --git a/newlib/libc/sys/linux/net/nsparser.y b/newlib/libc/sys/linux/net/nsparser.y
new file mode 100644
index 000000000..42f63a8a5
--- /dev/null
+++ b/newlib/libc/sys/linux/net/nsparser.y
@@ -0,0 +1,178 @@
+%{
+/* $NetBSD: nsparser.y,v 1.3 1999/01/25 00:16:18 lukem Exp $ */
+
+/*-
+ * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Luke Mewburn.
+ *
+ * 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 NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+static char *rcsid =
+ "$FreeBSD: src/lib/libc/net/nsparser.y,v 1.3 2002/03/21 22:47:17 obrien Exp $";
+#endif /* LIBC_SCCS and not lint */
+
+#define _NS_PRIVATE
+#include <nsswitch.h>
+#include <stdio.h>
+#include <string.h>
+
+
+static void _nsaddsrctomap(const char *);
+
+static ns_dbt curdbt;
+static ns_src cursrc;
+%}
+
+%union {
+ char *str;
+ int mapval;
+}
+
+%token NL
+%token SUCCESS UNAVAIL NOTFOUND TRYAGAIN
+%token RETURN CONTINUE
+%token <str> STRING
+
+%type <mapval> Status Action
+
+%%
+
+File
+ : /* empty */
+ | Lines
+ ;
+
+Lines
+ : Entry
+ | Lines Entry
+ ;
+
+Entry
+ : NL
+ | Database ':' NL
+ | Database ':' Srclist NL
+ {
+ _nsdbtput(&curdbt);
+ }
+ | error NL
+ {
+ yyerrok;
+ }
+ ;
+
+Database
+ : STRING
+ {
+ curdbt.name = yylval.str;
+ curdbt.srclist = NULL;
+ curdbt.srclistsize = 0;
+ }
+ ;
+
+Srclist
+ : Item
+ | Srclist Item
+ ;
+
+Item
+ : STRING
+ {
+ cursrc.flags = NS_SUCCESS;
+ _nsaddsrctomap($1);
+ }
+ | STRING '[' { cursrc.flags = NS_SUCCESS; } Criteria ']'
+ {
+ _nsaddsrctomap($1);
+ }
+ ;
+
+Criteria
+ : Criterion
+ | Criteria Criterion
+ ;
+
+Criterion
+ : Status '=' Action
+ {
+ if ($3) /* if action == RETURN set RETURN bit */
+ cursrc.flags |= $1;
+ else /* else unset it */
+ cursrc.flags &= ~$1;
+ }
+ ;
+
+Status
+ : SUCCESS { $$ = NS_SUCCESS; }
+ | UNAVAIL { $$ = NS_UNAVAIL; }
+ | NOTFOUND { $$ = NS_NOTFOUND; }
+ | TRYAGAIN { $$ = NS_TRYAGAIN; }
+ ;
+
+Action
+ : RETURN { $$ = 1L; }
+ | CONTINUE { $$ = 0L; }
+ ;
+
+%%
+
+static void
+_nsaddsrctomap(elem)
+ const char *elem;
+{
+ int i, lineno;
+ extern int _nsyylineno;
+ extern char * _nsyytext;
+
+ lineno = _nsyylineno - (*_nsyytext == '\n' ? 1 : 0);
+ if (curdbt.srclistsize > 0) {
+ if ((strcasecmp(elem, NSSRC_COMPAT) == 0) ||
+ (strcasecmp(curdbt.srclist[0].name, NSSRC_COMPAT) == 0)) {
+ /* XXX: syslog the following */
+ printf("line %d 'compat' used with other sources",
+ lineno);
+ return;
+ }
+ }
+ for (i = 0; i < curdbt.srclistsize; i++) {
+ if (strcasecmp(curdbt.srclist[i].name, elem) == 0) {
+ /* XXX: syslog the following */
+ printf("%s line %d: duplicate source '%s'",
+ lineno, elem);
+ return;
+ }
+ }
+ cursrc.name = elem;
+ _nsdbtaddsrc(&curdbt, &cursrc);
+}
diff --git a/newlib/libc/sys/linux/net/nss.h b/newlib/libc/sys/linux/net/nss.h
deleted file mode 100644
index f5c12afab..000000000
--- a/newlib/libc/sys/linux/net/nss.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* Define interface to NSS. This is meant for the interface functions
- and for implementors of new services. */
-
-#ifndef _NSS_H
-#define _NSS_H 1
-
-#include <features.h>
-
-
-__BEGIN_DECLS
-
-/* Possible results of lookup using a nss_* function. */
-enum nss_status
-{
- NSS_STATUS_TRYAGAIN = -2,
- NSS_STATUS_UNAVAIL,
- NSS_STATUS_NOTFOUND,
- NSS_STATUS_SUCCESS,
- NSS_STATUS_RETURN
-};
-
-
-/* Overwrite service selection for database DBNAME using specification
- in STRING.
- This function should only be used by system programs which have to
- work around non-existing services (e.e., while booting).
- Attention: Using this function repeatedly will slowly eat up the
- whole memory since previous selection data cannot be freed. */
-extern int __nss_configure_lookup (__const char *__dbname,
- __const char *__string) __THROW;
-
-__END_DECLS
-
-#endif /* nss.h */
diff --git a/newlib/libc/sys/linux/net/nsswitch.c b/newlib/libc/sys/linux/net/nsswitch.c
deleted file mode 100644
index 6c5d1f8e9..000000000
--- a/newlib/libc/sys/linux/net/nsswitch.c
+++ /dev/null
@@ -1,772 +0,0 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004
- Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <ctype.h>
-#include <dlfcn.h>
-#include <errno.h>
-#include <netdb.h>
-#include <bits/libc-lock.h>
-#include <search.h>
-#include <stdio.h>
-#include <stdio_ext.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <aliases.h>
-#include <grp.h>
-#include <netinet/ether.h>
-#include <pwd.h>
-#include <shadow.h>
-
-#include "local.h"
-
-#if !defined DO_STATIC_NSS || defined SHARED
-# include <gnu/lib-names.h>
-#endif
-
-#include "nsswitch.h"
-#include "nscd/nscd_proto.h"
-
-/* Prototypes for the local functions. */
-static name_database *nss_parse_file (const char *fname) internal_function;
-static name_database_entry *nss_getline (char *line) internal_function;
-static service_user *nss_parse_service_list (const char *line)
- internal_function;
-static service_library *nss_new_service (name_database *database,
- const char *name) internal_function;
-
-
-/* Declare external database variables. */
-#define DEFINE_DATABASE(name) \
- extern service_user *__nss_##name##_database attribute_hidden; \
- weak_extern (__nss_##name##_database)
-#include "databases.def"
-#undef DEFINE_DATABASE
-
-/* Structure to map database name to variable. */
-static struct
-{
- const char *name;
- service_user **dbp;
-} databases[] =
-{
-#define DEFINE_DATABASE(name) \
- { #name, &__nss_##name##_database },
-#include "databases.def"
-#undef DEFINE_DATABASE
-};
-
-
-__libc_lock_define_initialized (static, lock)
-
-#if !defined DO_STATIC_NSS || defined SHARED
-/* String with revision number of the shared object files. */
-static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
-#endif
-
-/* The root of the whole data base. */
-static name_database *service_table;
-
-
-/* -1 == database not found
- 0 == database entry pointer stored */
-int
-__nss_database_lookup (const char *database, const char *alternate_name,
- const char *defconfig, service_user **ni)
-{
- /* Prevent multiple threads to change the service table. */
- __libc_lock_lock (lock);
-
- /* Reconsider database variable in case some other thread called
- `__nss_configure_lookup' while we waited for the lock. */
- if (*ni != NULL)
- {
- __libc_lock_unlock (lock);
- return 0;
- }
-
- /* Are we initialized yet? */
- if (service_table == NULL)
- /* Read config file. */
- service_table = nss_parse_file (_PATH_NSSWITCH_CONF);
-
- /* Test whether configuration data is available. */
- if (service_table != NULL)
- {
- /* Return first `service_user' entry for DATABASE. */
- name_database_entry *entry;
-
- /* XXX Could use some faster mechanism here. But each database is
- only requested once and so this might not be critical. */
- for (entry = service_table->entry; entry != NULL; entry = entry->next)
- if (strcmp (database, entry->name) == 0)
- *ni = entry->service;
-
- if (*ni == NULL && alternate_name != NULL)
- /* We haven't found an entry so far. Try to find it with the
- alternative name. */
- for (entry = service_table->entry; entry != NULL; entry = entry->next)
- if (strcmp (alternate_name, entry->name) == 0)
- *ni = entry->service;
- }
-
- /* No configuration data is available, either because nsswitch.conf
- doesn't exist or because it doesn't has a line for this database.
-
- DEFCONFIG specifies the default service list for this database,
- or null to use the most common default. */
- if (*ni == NULL)
- *ni = nss_parse_service_list (defconfig
- ?: "nis [NOTFOUND=return] files");
-
- __libc_lock_unlock (lock);
-
- return 0;
-}
-libc_hidden_def (__nss_database_lookup)
-
-
-/* -1 == not found
- 0 == function found
- 1 == finished */
-int
-__nss_lookup (service_user **ni, const char *fct_name, void **fctp)
-{
- *fctp = __nss_lookup_function (*ni, fct_name);
-
- while (*fctp == NULL
- && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_CONTINUE
- && (*ni)->next != NULL)
- {
- *ni = (*ni)->next;
-
- *fctp = __nss_lookup_function (*ni, fct_name);
- }
-
- return *fctp != NULL ? 0 : (*ni)->next == NULL ? 1 : -1;
-}
-
-
-/* -1 == not found
- 0 == adjusted for next function
- 1 == finished */
-int
-__nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
- int all_values)
-{
- if (all_values)
- {
- if (nss_next_action (*ni, NSS_STATUS_TRYAGAIN) == NSS_ACTION_RETURN
- && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_RETURN
- && nss_next_action (*ni, NSS_STATUS_NOTFOUND) == NSS_ACTION_RETURN
- && nss_next_action (*ni, NSS_STATUS_SUCCESS) == NSS_ACTION_RETURN)
- return 1;
- }
- else
- {
- /* This is really only for debugging. */
- if (NSS_STATUS_TRYAGAIN > status || status > NSS_STATUS_RETURN)
- {
- fprintf (stderr, "illegal status in __nss_next");
- abort();
- }
-
- if (nss_next_action (*ni, status) == NSS_ACTION_RETURN)
- return 1;
- }
-
- if ((*ni)->next == NULL)
- return -1;
-
- do
- {
- *ni = (*ni)->next;
-
- *fctp = __nss_lookup_function (*ni, fct_name);
- }
- while (*fctp == NULL
- && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_CONTINUE
- && (*ni)->next != NULL);
-
- return *fctp != NULL ? 0 : -1;
-}
-libc_hidden_def (__nss_next)
-
-
-int
-__nss_configure_lookup (const char *dbname, const char *service_line)
-{
- service_user *new_db;
- size_t cnt;
-
- for (cnt = 0; cnt < sizeof databases; ++cnt)
- {
- int cmp = strcmp (dbname, databases[cnt].name);
- if (cmp == 0)
- break;
- if (cmp < 0)
- {
- __set_errno (EINVAL);
- return -1;
- }
- }
-
- if (cnt == sizeof databases)
- {
- __set_errno (EINVAL);
- return -1;
- }
-
- /* Test whether it is really used. */
- if (databases[cnt].dbp == NULL)
- /* Nothing to do, but we could do. */
- return 0;
-
- /* Try to generate new data. */
- new_db = nss_parse_service_list (service_line);
- if (new_db == NULL)
- {
- /* Illegal service specification. */
- __set_errno (EINVAL);
- return -1;
- }
-
- /* Prevent multiple threads to change the service table. */
- __libc_lock_lock (lock);
-
- /* Install new rules. */
- *databases[cnt].dbp = new_db;
-
- __libc_lock_unlock (lock);
-
- return 0;
-}
-
-
-/* Comparison function for searching NI->known tree. */
-static int
-known_compare (const void *p1, const void *p2)
-{
- return p1 == p2 ? 0 : strcmp (*(const char *const *) p1,
- *(const char *const *) p2);
-}
-
-
-void *
-__nss_lookup_function (service_user *ni, const char *fct_name)
-{
- void **found, *result;
-
- /* We now modify global data. Protect it. */
- __libc_lock_lock (lock);
-
- /* Search the tree of functions previously requested. Data in the
- tree are `known_function' structures, whose first member is a
- `const char *', the lookup key. The search returns a pointer to
- the tree node structure; the first member of the is a pointer to
- our structure (i.e. what will be a `known_function'); since the
- first member of that is the lookup key string, &FCT_NAME is close
- enough to a pointer to our structure to use as a lookup key that
- will be passed to `known_compare' (above). */
-
- found = tsearch (&fct_name, (void **) &ni->known, &known_compare);
- if (*found != &fct_name)
- /* The search found an existing structure in the tree. */
- result = ((known_function *) *found)->fct_ptr;
- else
- {
- /* This name was not known before. Now we have a node in the tree
- (in the proper sorted position for FCT_NAME) that points to
- &FCT_NAME instead of any real `known_function' structure.
- Allocate a new structure and fill it in. */
-
- known_function *known = malloc (sizeof *known);
- if (! known)
- {
- remove_from_tree:
- /* Oops. We can't instantiate this node properly.
- Remove it from the tree. */
- tdelete (&fct_name, (void **) &ni->known, &known_compare);
- result = NULL;
- }
- else
- {
- /* Point the tree node at this new structure. */
- *found = known;
- known->fct_name = fct_name;
-
- if (ni->library == NULL)
- {
- /* This service has not yet been used. Fetch the service
- library for it, creating a new one if need be. If there
- is no service table from the file, this static variable
- holds the head of the service_library list made from the
- default configuration. */
- static name_database default_table;
- ni->library = nss_new_service (service_table ?: &default_table,
- ni->name);
- if (ni->library == NULL)
- {
- /* This only happens when out of memory. */
- free (known);
- goto remove_from_tree;
- }
- }
-
-#if !defined DO_STATIC_NSS || defined SHARED
- if (ni->library->lib_handle == NULL)
- {
- /* Load the shared library. */
- size_t shlen = (7 + strlen (ni->library->name) + 3
- + strlen (__nss_shlib_revision) + 1);
- int saved_errno = errno;
- char shlib_name[shlen];
-
- /* Construct shared object name. */
- stpcpy (stpcpy (stpcpy (stpcpy (shlib_name,
- "libnss_"),
- ni->library->name),
- ".so"),
- __nss_shlib_revision);
-
- ni->library->lib_handle = __libc_dlopen (shlib_name);
- if (ni->library->lib_handle == NULL)
- {
- /* Failed to load the library. */
- ni->library->lib_handle = (void *) -1l;
- __set_errno (saved_errno);
- }
- }
-
- if (ni->library->lib_handle == (void *) -1l)
- /* Library not found => function not found. */
- result = NULL;
- else
- {
- /* Get the desired function. */
- size_t namlen = (5 + strlen (ni->library->name) + 1
- + strlen (fct_name) + 1);
- char name[namlen];
-
- /* Construct the function name. */
- stpcpy (stpcpy (stpcpy (stpcpy (name, "_nss_"),
- ni->library->name),
- "_"),
- fct_name);
-
- /* Look up the symbol. */
- result = __libc_dlsym (ni->library->lib_handle, name);
- }
-#else
- /* We can't get function address dynamically in static linking. */
- {
-# define DEFINE_ENT(h,nm) \
- { #h"_get"#nm"ent_r", _nss_##h##_get##nm##ent_r }, \
- { #h"_end"#nm"ent", _nss_##h##_end##nm##ent }, \
- { #h"_set"#nm"ent", _nss_##h##_set##nm##ent },
-# define DEFINE_GET(h,nm) \
- { #h"_get"#nm"_r", _nss_##h##_get##nm##_r },
-# define DEFINE_GETBY(h,nm,ky) \
- { #h"_get"#nm"by"#ky"_r", _nss_##h##_get##nm##by##ky##_r },
- static struct fct_tbl { const char *fname; void *fp; } *tp, tbl[] =
- {
-# include "function.def"
- { NULL, NULL }
- };
- size_t namlen = (5 + strlen (ni->library->name) + 1
- + strlen (fct_name) + 1);
- char name[namlen];
-
- /* Construct the function name. */
- stpcpy (stpcpy (stpcpy (name, ni->library->name),
- "_"),
- fct_name);
-
- result = NULL;
- for (tp = &tbl[0]; tp->fname; tp++)
- if (strcmp (tp->fname, name) == 0)
- {
- result = tp->fp;
- break;
- }
- }
-#endif
-
- /* Remember function pointer for later calls. Even if null, we
- record it so a second try needn't search the library again. */
- known->fct_ptr = result;
- }
- }
-
- /* Remove the lock. */
- __libc_lock_unlock (lock);
-
- return result;
-}
-libc_hidden_def (__nss_lookup_function)
-
-
-static name_database *
-internal_function
-nss_parse_file (const char *fname)
-{
- FILE *fp;
- name_database *result;
- name_database_entry *last;
- char *line;
- size_t len;
-
- /* Open the configuration file. */
- fp = fopen (fname, "rc");
- if (fp == NULL)
- return NULL;
-
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- result = (name_database *) malloc (sizeof (name_database));
- if (result == NULL)
- return NULL;
-
- result->entry = NULL;
- result->library = NULL;
- last = NULL;
- line = NULL;
- len = 0;
- do
- {
- name_database_entry *this;
- ssize_t n;
- char *tmp;
-
- n = __getline (&line, &len, fp);
- if (n < 0)
- break;
- if (line[n - 1] == '\n')
- line[n - 1] = '\0';
-
- /* Because the file format does not know any form of quoting we
- can search forward for the next '#' character and if found
- make it terminating the line. */
- tmp = strchr (line, '#');
- if (tmp == NULL)
- tmp = line + strlen (line);
- *tmp = '\0';
-
- /* If the line is blank it is ignored. */
- if (line[0] == '\0')
- continue;
-
- /* Each line completely specifies the actions for a database. */
- this = nss_getline (line);
- if (this != NULL)
- {
- if (last != NULL)
- last->next = this;
- else
- result->entry = this;
-
- last = this;
- }
- }
- while (!feof (fp));
-
- /* Free the buffer. */
- free (line);
- /* Close configuration file. */
- fclose (fp);
-
- return result;
-}
-
-
-/* Read the source names:
- `( <source> ( "[" "!"? (<status> "=" <action> )+ "]" )? )*'
- */
-static service_user *
-internal_function
-nss_parse_service_list (const char *line)
-{
- service_user *result = NULL, **nextp = &result;
-
- while (1)
- {
- service_user *new_service;
- const char *name;
-
- while (isspace (line[0]))
- ++line;
- if (line[0] == '\0')
- /* No source specified. */
- return result;
-
- /* Read <source> identifier. */
- name = line;
- while (line[0] != '\0' && !isspace (line[0]) && line[0] != '[')
- ++line;
- if (name == line)
- return result;
-
-
- new_service = (service_user *) malloc (sizeof (service_user)
- + (line - name + 1));
- if (new_service == NULL)
- return result;
-
- *((char *) mempcpy (new_service->name, name, line - name)) = '\0';
-
- /* Set default actions. */
- new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE;
- new_service->actions[2 + NSS_STATUS_UNAVAIL] = NSS_ACTION_CONTINUE;
- new_service->actions[2 + NSS_STATUS_NOTFOUND] = NSS_ACTION_CONTINUE;
- new_service->actions[2 + NSS_STATUS_SUCCESS] = NSS_ACTION_RETURN;
- new_service->actions[2 + NSS_STATUS_RETURN] = NSS_ACTION_RETURN;
- new_service->library = NULL;
- new_service->known = NULL;
- new_service->next = NULL;
-
- while (isspace (line[0]))
- ++line;
-
- if (line[0] == '[')
- {
- /* Read criterions. */
- do
- ++line;
- while (line[0] != '\0' && isspace (line[0]));
-
- do
- {
- int not;
- enum nss_status status;
- lookup_actions action;
-
- /* Grok ! before name to mean all statii but that one. */
- not = line[0] == '!';
- if (not)
- ++line;
-
- /* Read status name. */
- name = line;
- while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
- && line[0] != ']')
- ++line;
-
- /* Compare with known statii. */
- if (line - name == 7)
- {
- if (strncasecmp (name, "SUCCESS", 7) == 0)
- status = NSS_STATUS_SUCCESS;
- else if (strncasecmp (name, "UNAVAIL", 7) == 0)
- status = NSS_STATUS_UNAVAIL;
- else
- return result;
- }
- else if (line - name == 8)
- {
- if (strncasecmp (name, "NOTFOUND", 8) == 0)
- status = NSS_STATUS_NOTFOUND;
- else if (strncasecmp (name, "TRYAGAIN", 8) == 0)
- status = NSS_STATUS_TRYAGAIN;
- else
- return result;
- }
- else
- return result;
-
- while (isspace (line[0]))
- ++line;
- if (line[0] != '=')
- return result;
- do
- ++line;
- while (isspace (line[0]));
-
- name = line;
- while (line[0] != '\0' && !isspace (line[0]) && line[0] != '='
- && line[0] != ']')
- ++line;
-
- if (line - name == 6 && strncasecmp (name, "RETURN", 6) == 0)
- action = NSS_ACTION_RETURN;
- else if (line - name == 8
- && strncasecmp (name, "CONTINUE", 8) == 0)
- action = NSS_ACTION_CONTINUE;
- else
- return result;
-
- if (not)
- {
- /* Save the current action setting for this status,
- set them all to the given action, and reset this one. */
- const lookup_actions save = new_service->actions[2 + status];
- new_service->actions[2 + NSS_STATUS_TRYAGAIN] = action;
- new_service->actions[2 + NSS_STATUS_UNAVAIL] = action;
- new_service->actions[2 + NSS_STATUS_NOTFOUND] = action;
- new_service->actions[2 + NSS_STATUS_SUCCESS] = action;
- new_service->actions[2 + status] = save;
- }
- else
- new_service->actions[2 + status] = action;
-
- /* Skip white spaces. */
- while (isspace (line[0]))
- ++line;
- }
- while (line[0] != ']');
-
- /* Skip the ']'. */
- ++line;
- }
-
- *nextp = new_service;
- nextp = &new_service->next;
- }
-}
-
-static name_database_entry *
-internal_function
-nss_getline (char *line)
-{
- const char *name;
- name_database_entry *result;
- size_t len;
-
- /* Ignore leading white spaces. ATTENTION: this is different from
- what is implemented in Solaris. The Solaris man page says a line
- beginning with a white space character is ignored. We regard
- this as just another misfeature in Solaris. */
- while (isspace (line[0]))
- ++line;
-
- /* Recognize `<database> ":"'. */
- name = line;
- while (line[0] != '\0' && !isspace (line[0]) && line[0] != ':')
- ++line;
- if (line[0] == '\0' || name == line)
- /* Syntax error. */
- return NULL;
- *line++ = '\0';
-
- len = strlen (name) + 1;
-
- result = (name_database_entry *) malloc (sizeof (name_database_entry) + len);
- if (result == NULL)
- return NULL;
-
- /* Save the database name. */
- memcpy (result->name, name, len);
-
- /* Parse the list of services. */
- result->service = nss_parse_service_list (line);
-
- result->next = NULL;
- return result;
-}
-
-
-static service_library *
-internal_function
-nss_new_service (name_database *database, const char *name)
-{
- service_library **currentp = &database->library;
-
- while (*currentp != NULL)
- {
- if (strcmp ((*currentp)->name, name) == 0)
- return *currentp;
- currentp = &(*currentp)->next;
- }
-
- /* We have to add the new service. */
- *currentp = (service_library *) malloc (sizeof (service_library));
- if (*currentp == NULL)
- return NULL;
-
- (*currentp)->name = name;
- (*currentp)->lib_handle = NULL;
- (*currentp)->next = NULL;
-
- return *currentp;
-}
-
-
-#ifdef USE_NSCD
-/* Called by nscd and nscd alone. */
-void
-__nss_disable_nscd (void)
-{
- /* Disable all uses of NSCD. */
- __nss_not_use_nscd_passwd = -1;
- __nss_not_use_nscd_group = -1;
- __nss_not_use_nscd_hosts = -1;
-}
-#endif
-
-
-/* Free all resources if necessary. */
-libc_freeres_fn (free_mem)
-{
- name_database *top = service_table;
- name_database_entry *entry;
- service_library *library;
-
- if (top == NULL)
- /* Maybe we have not read the nsswitch.conf file. */
- return;
-
- /* Don't disturb ongoing other threads (if there are any). */
- service_table = NULL;
-
- entry = top->entry;
- while (entry != NULL)
- {
- name_database_entry *olde = entry;
- service_user *service = entry->service;
-
- while (service != NULL)
- {
- service_user *olds = service;
-
- if (service->known != NULL)
- tdestroy (service->known, free);
-
- service = service->next;
- free (olds);
- }
-
- entry = entry->next;
- free (olde);
- }
-
- library = top->library;
- while (library != NULL)
- {
- service_library *oldl = library;
-
- if (library->lib_handle && library->lib_handle != (void *) -1l)
- __libc_dlclose (library->lib_handle);
-
- library = library->next;
- free (oldl);
- }
-
- free (top);
-}
diff --git a/newlib/libc/sys/linux/net/nsswitch.h b/newlib/libc/sys/linux/net/nsswitch.h
deleted file mode 100644
index 7ee6d5e4b..000000000
--- a/newlib/libc/sys/linux/net/nsswitch.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Copyright (C) 1996-1999,2001,2002,2003,2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _NSSWITCH_H
-#define _NSSWITCH_H 1
-
-/* This is an *internal* header. */
-
-#include <arpa/nameser.h>
-#include <netinet/in.h>
-#include <nss.h>
-#include <resolv.h>
-#include <search.h>
-#include <dlfcn.h>
-#include <libc-symbols.h>
-
-/* Actions performed after lookup finished. */
-typedef enum
-{
- NSS_ACTION_CONTINUE,
- NSS_ACTION_RETURN
-} lookup_actions;
-
-
-typedef struct service_library
-{
- /* Name of service (`files', `dns', `nis', ...). */
- const char *name;
- /* Pointer to the loaded shared library. */
- void *lib_handle;
- /* And the link to the next entry. */
- struct service_library *next;
-} service_library;
-
-
-/* For mapping a function name to a function pointer. It is known in
- nsswitch.c:nss_lookup_function that a string pointer for the lookup key
- is the first member. */
-typedef struct
-{
- const char *fct_name;
- void *fct_ptr;
-} known_function;
-
-
-typedef struct service_user
-{
- /* And the link to the next entry. */
- struct service_user *next;
- /* Action according to result. */
- lookup_actions actions[5];
- /* Link to the underlying library object. */
- service_library *library;
- /* Collection of known functions. */
- struct entry *known;
- /* Name of the service (`files', `dns', `nis', ...). */
- char name[0];
-} service_user;
-
-/* To access the action based on the status value use this macro. */
-#define nss_next_action(ni, status) ((ni)->actions[2 + status])
-
-
-typedef struct name_database_entry
-{
- /* And the link to the next entry. */
- struct name_database_entry *next;
- /* List of service to be used. */
- service_user *service;
- /* Name of the database. */
- char name[0];
-} name_database_entry;
-
-
-typedef struct name_database
-{
- /* List of all known databases. */
- name_database_entry *entry;
- /* List of libraries with service implementation. */
- service_library *library;
-} name_database;
-
-
-/* Interface functions for NSS. */
-
-/* Get the data structure representing the specified database.
- If there is no configuration for this database in the file,
- parse a service list from DEFCONFIG and use that. More
- than one function can use the database. */
-extern int __nss_database_lookup (const char *database,
- const char *alternative_name,
- const char *defconfig, service_user **ni);
-libc_hidden_proto (__nss_database_lookup)
-
-/* Put first function with name FCT_NAME for SERVICE in FCTP. The
- position is remembered in NI. The function returns a value < 0 if
- an error occurred or no such function exists. */
-extern int __nss_lookup (service_user **ni, const char *fct_name, void **fctp);
-
-/* Determine the next step in the lookup process according to the
- result STATUS of the call to the last function returned by
- `__nss_lookup' or `__nss_next'. NI specifies the last function
- examined. The function return a value > 0 if the process should
- stop with the last result of the last function call to be the
- result of the entire lookup. The returned value is 0 if there is
- another function to use and < 0 if an error occurred.
-
- If ALL_VALUES is nonzero, the return value will not be > 0 as long as
- there is a possibility the lookup process can ever use following
- services. In other words, only if all four lookup results have
- the action RETURN associated the lookup process stops before the
- natural end. */
-extern int __nss_next (service_user **ni, const char *fct_name, void **fctp,
- int status, int all_values);
-libc_hidden_proto (__nss_next)
-
-/* Search for the service described in NI for a function named FCT_NAME
- and return a pointer to this function if successful. */
-extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
-libc_hidden_proto (__nss_lookup_function)
-
-
-/* Called by NSCD to disable recursive calls. */
-extern void __nss_disable_nscd (void);
-
-
-typedef int (*db_lookup_function) (service_user **, const char *, void **)
- internal_function;
-typedef enum nss_status (*setent_function) (int);
-typedef enum nss_status (*endent_function) (void);
-typedef enum nss_status (*getent_function) (void *, char *, size_t,
- int *, int *);
-typedef int (*getent_r_function) (void *, char *, size_t,
- void **result, int *);
-
-extern void __nss_setent (const char *func_name,
- db_lookup_function lookup_fct,
- service_user **nip, service_user **startp,
- service_user **last_nip, int stayon,
- int *stayon_tmp, int res);
-extern void __nss_endent (const char *func_name,
- db_lookup_function lookup_fct,
- service_user **nip, service_user **startp,
- service_user **last_nip, int res);
-extern int __nss_getent_r (const char *getent_func_name,
- const char *setent_func_name,
- db_lookup_function lookup_fct,
- service_user **nip, service_user **startp,
- service_user **last_nip, int *stayon_tmp,
- int res,
- void *resbuf, char *buffer, size_t buflen,
- void **result, int *h_errnop);
-extern void *__nss_getent (getent_r_function func,
- void **resbuf, char **buffer, size_t buflen,
- size_t *buffer_size, int *h_errnop);
-struct hostent;
-extern int __nss_hostname_digits_dots (const char *name,
- struct hostent *resbuf, char **buffer,
- size_t *buffer_size, size_t buflen,
- struct hostent **result,
- enum nss_status *status, int af,
- int *h_errnop);
-libc_hidden_proto (__nss_hostname_digits_dots)
-
-#endif /* nsswitch.h */
diff --git a/newlib/libc/sys/linux/net/opensock.c b/newlib/libc/sys/linux/net/opensock.c
deleted file mode 100644
index 7ff3f69ed..000000000
--- a/newlib/libc/sys/linux/net/opensock.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Copyright (C) 1999, 2001, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include "libc-symbols.h"
-
-/* Return a socket of any type. The socket can be used in subsequent
- ioctl calls to talk to the kernel. */
-int internal_function
-__opensock (void)
-{
- static int last_family; /* Available socket family we will use. */
- static int last_type;
- static const struct
- {
- int family;
- const char procname[15];
- } afs[] =
- {
- /* The 2.2 kernels cannot handle ioctl(SIOCGIFCONF) on AF_UNIX sockets.
- Give the kernel a chance to user inet sockets on old kernels. */
-#if __LINUX_KERNEL_VERSION < 132096
- { AF_INET, "" },
- { AF_UNIX, "net/unix" },
-#else
- { AF_UNIX, "net/unix" },
- { AF_INET, "" },
-#endif
- { AF_INET6, "net/if_inet6" },
- { AF_AX25, "net/ax25" },
- { AF_NETROM, "net/nr" },
- { AF_ROSE, "net/rose" },
- { AF_IPX, "net/ipx" },
- { AF_APPLETALK, "net/appletalk" },
- { AF_ECONET, "sys/net/econet" },
- { AF_ASH, "sys/net/ash" },
- { AF_X25, "net/x25" }
- };
-#define nafs (sizeof (afs) / sizeof (afs[0]))
- char fname[sizeof "/proc/" + 14];
- int result;
- int has_proc;
- size_t cnt;
-
- /* We already know which family to use from the last call. Use it
- again. */
- if (last_family != 0)
- {
- assert (last_type != 0);
-
- result = socket (last_family, last_type, 0);
- if (result != -1 || errno != EAFNOSUPPORT)
- /* Maybe the socket type isn't supported anymore (module is
- unloaded). In this case again try to find the type. */
- return result;
-
- /* Reset the values. They seem not valid anymore. */
- last_family = 0;
- last_type = 0;
- }
-
- /* Check whether the /proc filesystem is available. */
- has_proc = access ("/proc/net", R_OK) != -1;
- strcpy (fname, "/proc/");
-
- /* Iterate over the interface families and find one which is
- available. */
- for (cnt = 0; cnt < nafs; ++cnt)
- {
- int type = SOCK_DGRAM;
-
- if (has_proc && afs[cnt].procname[0] != '\0')
- {
- strcpy (fname + 6, afs[cnt].procname);
- if (access (fname, R_OK) == -1)
- /* The /proc entry is not available. I.e., we cannot
- create a socket of this type (without loading the
- module). Don't look for it since this might trigger
- loading the module. */
- continue;
- }
-
- if (afs[cnt].family == AF_NETROM || afs[cnt].family == AF_X25)
- type = SOCK_SEQPACKET;
-
- result = socket (afs[cnt].family, type, 0);
- if (result != -1)
- {
- /* Found an available family. */
- last_type = type;
- last_family = afs[cnt].family;
- return result;
- }
- }
-
- /* None of the protocol families is available. It is unclear what kind
- of error is returned. ENOENT seems like a reasonable choice. */
- __set_errno (ENOENT);
- return -1;
-}
diff --git a/newlib/libc/sys/linux/net/proto-lookup.c b/newlib/libc/sys/linux/net/proto-lookup.c
deleted file mode 100644
index 8f98158b3..000000000
--- a/newlib/libc/sys/linux/net/proto-lookup.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME protocols
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/pwd-lookup.c b/newlib/libc/sys/linux/net/pwd-lookup.c
deleted file mode 100644
index 1def3a08c..000000000
--- a/newlib/libc/sys/linux/net/pwd-lookup.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME passwd
-#define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/rcmd.3 b/newlib/libc/sys/linux/net/rcmd.3
new file mode 100644
index 000000000..9479a237d
--- /dev/null
+++ b/newlib/libc/sys/linux/net/rcmd.3
@@ -0,0 +1,298 @@
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/rcmd.3,v 1.20 2001/10/01 16:08:56 ru Exp $
+.\"
+.Dd March 3, 2000
+.Dt RCMD 3
+.Os
+.Sh NAME
+.Nm rcmd ,
+.Nm rresvport ,
+.Nm iruserok ,
+.Nm ruserok ,
+.Nm rcmd_af ,
+.Nm rresvport_af ,
+.Nm iruserok_sa
+.Nd routines for returning a stream to a remote command
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In unistd.h
+.Ft int
+.Fn rcmd "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p"
+.Ft int
+.Fn rresvport "int *port"
+.Ft int
+.Fn iruserok "u_long raddr" "int superuser" "const char *ruser" "const char *luser"
+.Ft int
+.Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser"
+.Ft int
+.Fn rcmd_af "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" "int af"
+.Ft int
+.Fn rresvport_af "int *port" "int af"
+.Ft int
+.Fn iruserok_sa "const void *addr" "int addrlen" "int superuser" "const char *ruser" "const char *luser"
+.Sh DESCRIPTION
+The
+.Fn rcmd
+function
+is used by the super-user to execute a command on
+a remote machine using an authentication scheme based
+on reserved port numbers.
+The
+.Fn rresvport
+function
+returns a descriptor to a socket
+with an address in the privileged port space.
+The
+.Fn ruserok
+function
+is used by servers
+to authenticate clients requesting service with
+.Fn rcmd .
+All three functions are present in the same file and are used
+by the
+.Xr rshd 8
+server (among others).
+.Pp
+The
+.Fn rcmd
+function
+looks up the host
+.Fa *ahost
+using
+.Xr gethostbyname 3 ,
+returning -1 if the host does not exist.
+Otherwise
+.Fa *ahost
+is set to the standard name of the host
+and a connection is established to a server
+residing at the well-known Internet port
+.Fa inport .
+.Pp
+If the connection succeeds,
+a socket in the Internet domain of type
+.Dv SOCK_STREAM
+is returned to the caller, and given to the remote
+command as
+.Em stdin
+and
+.Em stdout .
+If
+.Fa fd2p
+is non-zero, then an auxiliary channel to a control
+process will be set up, and a descriptor for it will be placed
+in
+.Fa *fd2p .
+The control process will return diagnostic
+output from the command (unit 2) on this channel, and will also
+accept bytes on this channel as being
+.Tn UNIX
+signal numbers, to be
+forwarded to the process group of the command.
+If
+.Fa fd2p
+is 0, then the
+.Em stderr
+(unit 2 of the remote
+command) will be made the same as the
+.Em stdout
+and no
+provision is made for sending arbitrary signals to the remote process,
+although you may be able to get its attention by using out-of-band data.
+.Pp
+The protocol is described in detail in
+.Xr rshd 8 .
+.Pp
+The
+.Fn rresvport
+function is used to obtain a socket to which an address with a Privileged
+Internet port is bound.
+This socket is suitable for use by
+.Fn rcmd
+and several other functions.
+Privileged Internet ports are those in the range 0 to 1023.
+Only the super-user is allowed to bind an address of this sort
+to a socket.
+.Pp
+The
+.Fn iruserok
+and
+.Fn ruserok
+functions take a remote host's IP address or name, as returned by the
+.Xr gethostbyname 3
+routines, two user names and a flag indicating whether the local user's
+name is that of the super-user.
+Then, if the user is
+.Em NOT
+the super-user, it checks the
+.Pa /etc/hosts.equiv
+file.
+If that lookup is not done, or is unsuccessful, the
+.Pa .rhosts
+in the local user's home directory is checked to see if the request for
+service is allowed.
+.Pp
+If this file does not exist, is not a regular file, is owned by anyone
+other than the user or the super-user, or is writable by anyone other
+than the owner, the check automatically fails.
+Zero is returned if the machine name is listed in the
+.Dq Pa hosts.equiv
+file, or the host and remote user name are found in the
+.Dq Pa .rhosts
+file; otherwise
+.Fn iruserok
+and
+.Fn ruserok
+return -1.
+If the local domain (as obtained from
+.Xr gethostname 3 )
+is the same as the remote domain, only the machine name need be specified.
+.Pp
+The
+.Fn iruserok
+function is strongly preferred for security reasons.
+It requires trusting the local DNS at most, while the
+.Fn ruserok
+function requires trusting the entire DNS, which can be spoofed.
+.Pp
+The functions with an
+.Dq Li _af
+or
+.Dq Li _sa
+suffix, i.e.,
+.Fn rcmd_af ,
+.Fn rresvport_af
+and
+.Fn iruserok_sa ,
+work the same as the corresponding functions without a
+suffix, except that they are capable of handling both IPv6 and IPv4 ports.
+.Pp
+The
+.Dq Li _af
+suffix means that the function has an additional
+.Fa af
+argument which is used to specify the address family,
+(see below).
+The
+.Fa af
+argument extension is implemented for functions
+that have no binary address argument.
+Instead, the
+.Fa af
+argument specifies which address family is desired.
+.Pp
+The
+.Dq Li _sa
+suffix means that the function has general socket address and
+length arguments.
+As the socket address is a protocol independent data structure,
+IPv4 and IPv6 socket address can be passed as desired.
+The
+.Fa sa
+argument extension is implemented for functions
+that pass a protocol dependent binary address argument.
+The argument needs to be replaced with a more general address structure
+to support multiple address families in a general way.
+.Pp
+The functions with neither an
+.Dq Li _af
+suffix nor an
+.Dq Li _sa
+suffix work for IPv4 only, except for
+.Fn ruserok
+which can handle both IPv6 and IPv4.
+To switch the address family, the
+.Fa af
+argument must be filled with
+.Dv AF_INET ,
+or
+.Dv AF_INET6 .
+For
+.Fn rcmd_af ,
+.Dv PF_UNSPEC
+is also allowed.
+.Sh DIAGNOSTICS
+The
+.Fn rcmd
+function
+returns a valid socket descriptor on success.
+It returns -1 on error and prints a diagnostic message
+on the standard error.
+.Pp
+The
+.Fn rresvport
+function
+returns a valid, bound socket descriptor on success.
+It returns -1 on error with the global value
+.Va errno
+set according to the reason for failure.
+The error code
+.Er EAGAIN
+is overloaded to mean ``All network ports in use.''
+.Sh SEE ALSO
+.Xr rlogin 1 ,
+.Xr rsh 1 ,
+.Xr intro 2 ,
+.Xr rexec 3 ,
+.Xr rexecd 8 ,
+.Xr rlogind 8 ,
+.Xr rshd 8
+.Pp
+.Rs
+.%A W. Stevens
+.%A M. Thomas
+.%T "Advanced Socket API for IPv6"
+.%O RFC2292
+.Re
+.Rs
+.%A W. Stevens
+.%A M. Thomas
+.%A E. Nordmark
+.%T "Advanced Socket API for IPv6"
+.%O draft-ietf-ipngwg-rfc2292bis-01.txt
+.Re
+.Sh HISTORY
+Most of these
+functions appeared in
+.Bx 4.2 .
+.Fn rresvport_af
+appeared in RFC2292, and was implemented by the WIDE project
+for the Hydrangea IPv6 protocol stack kit.
+.Fn rcmd_af
+appeared in draft-ietf-ipngwg-rfc2292bis-01.txt,
+and was implemented in the WIDE/KAME IPv6 protocol stack kit.
+.Fn iruserok_sa
+appeared in discussion on the IETF ipngwg mailing list,
+and was implemented in
+.Fx 4.0 .
diff --git a/newlib/libc/sys/linux/net/rcmd.c b/newlib/libc/sys/linux/net/rcmd.c
index ab3ade89b..708b69d1b 100644
--- a/newlib/libc/sys/linux/net/rcmd.c
+++ b/newlib/libc/sys/linux/net/rcmd.c
@@ -1,32 +1,4 @@
/*
- * Copyright (C) 1998 WIDE Project.
- * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
- */
-/*
* Copyright (c) 1983, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
@@ -38,6 +10,10 @@
* 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.
@@ -58,51 +34,55 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <time.h>
+#include <sys/select.h>
+#include "namespace.h"
#include <sys/param.h>
-#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <alloca.h>
#include <signal.h>
#include <fcntl.h>
#include <netdb.h>
+#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <errno.h>
#include <stdio.h>
-#include <stdio_ext.h>
#include <ctype.h>
#include <string.h>
-#include <libintl.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <sys/uio.h>
+#ifdef YP
+#include <rpc/rpc.h>
+#include <rpcsvc/yp_prot.h>
+#include <rpcsvc/ypclnt.h>
+#endif
+#include <arpa/nameser.h>
+#include "un-namespace.h"
-#include "local.h"
+/* wrapper for KAME-special getnameinfo() */
+#ifndef NI_WITHSCOPEID
+#define NI_WITHSCOPEID 0
+#endif
+extern int innetgr( const char *, const char *, const char *, const char * );
+extern int rcmdsh(char **ahost, int rport, const char *locuser, const char *remuser, const char *cmd, const char *rshprog);
+int rresvport_af(int *alport, int family);
-int __ivaliduser (FILE *, u_int32_t, const char *, const char *);
-static int __validuser2_sa (FILE *, struct sockaddr *, size_t,
- const char *, const char *, const char *);
-static int ruserok2_sa (struct sockaddr *ra, size_t ralen,
- int superuser, const char *ruser,
- const char *luser, const char *rhost);
-static int ruserok_sa (struct sockaddr *ra, size_t ralen,
- int superuser, const char *ruser,
- const char *luser);
-int iruserok_af (const void *raddr, int superuser, const char *ruser,
- const char *luser, sa_family_t af);
-int iruserok (u_int32_t raddr, int superuser, const char *ruser,
- const char *luser);
+#define max(a, b) ((a > b) ? a : b)
-libc_hidden_proto (iruserok_af)
+int __ivaliduser(FILE *, u_int32_t, const char *, const char *);
+int __ivaliduser_af(FILE *,const void *, const char *, const char *, int, int);
+int __ivaliduser_sa(FILE *, const struct sockaddr *, socklen_t, const char *,
+ const char *);
+static int __icheckhost(const struct sockaddr *, socklen_t, const char *);
-libc_freeres_ptr(static char *ahostbuf);
+char paddr[NI_MAXHOST];
int
rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
@@ -110,300 +90,242 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af)
u_short rport;
const char *locuser, *remuser, *cmd;
int *fd2p;
- sa_family_t af;
+ int af;
{
- char paddr[INET6_ADDRSTRLEN];
struct addrinfo hints, *res, *ai;
struct sockaddr_storage from;
- struct pollfd pfd[2];
- int32_t oldmask;
+ fd_set reads;
+ sigset_t oldmask, newmask;
pid_t pid;
- int s, lport, timo, error;
- char c;
- int refused;
+ int s, aport, lport, timo, error;
+ char c, *p;
+ int refused, nres;
char num[8];
- ssize_t n;
+ static char canonnamebuf[MAXDNAME]; /* is it proper here? */
- if (af != AF_INET && af != AF_INET6 && af != AF_UNSPEC)
- {
- __set_errno (EAFNOSUPPORT);
- return -1;
- }
+ /* call rcmdsh() with specified remote shell if appropriate. */
+ if (!issetugid() && (p = getenv("RSH"))) {
+ struct servent *sp = getservbyname("shell", "tcp");
- pid = __getpid();
+ if (sp && sp->s_port == rport)
+ return (rcmdsh(ahost, rport, locuser, remuser,
+ cmd, p));
+ }
+
+ /* use rsh(1) if non-root and remote port is shell. */
+ if (geteuid()) {
+ struct servent *sp = getservbyname("shell", "tcp");
+
+ if (sp && sp->s_port == rport)
+ return (rcmdsh(ahost, rport, locuser, remuser,
+ cmd, NULL));
+ }
- memset(&hints, '\0', sizeof(hints));
+ pid = getpid();
+
+ memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = af;
hints.ai_socktype = SOCK_STREAM;
+ hints.ai_protocol = 0;
(void)snprintf(num, sizeof(num), "%d", ntohs(rport));
error = getaddrinfo(*ahost, num, &hints, &res);
if (error) {
- if (error == EAI_NONAME && *ahost != NULL) {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s: Unknown host\n",
- *ahost);
- else
- fprintf(stderr, "%s: Unknown host\n", *ahost);
- } else {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"rcmd: getaddrinfo: %s\n",
- gai_strerror(error));
- else
- fprintf(stderr, "rcmd: getaddrinfo: %s\n",
- gai_strerror(error));
- }
- return (-1);
+ fprintf(stderr, "rcmd: getaddrinfo: %s\n",
+ gai_strerror(error));
+ if (error == EAI_SYSTEM)
+ fprintf(stderr, "rcmd: getaddrinfo: %s\n",
+ strerror(errno));
+ return (-1);
}
- pfd[0].events = POLLIN;
- pfd[1].events = POLLIN;
-
- if (res->ai_canonname){
- free (ahostbuf);
- ahostbuf = strdup (res->ai_canonname);
- if (ahostbuf == NULL) {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s",
- _("rcmd: Cannot allocate memory\n"));
- else
- fputs(_("rcmd: Cannot allocate memory\n"),
- stderr);
- return (-1);
- }
- *ahost = ahostbuf;
- } else
- *ahost = NULL;
+ if (res->ai_canonname
+ && strlen(res->ai_canonname) + 1 < sizeof(canonnamebuf)) {
+ strncpy(canonnamebuf, res->ai_canonname, sizeof(canonnamebuf));
+ *ahost = canonnamebuf;
+ }
+ nres = 0;
+ for (ai = res; ai; ai = ai->ai_next)
+ nres++;
ai = res;
refused = 0;
- oldmask = __sigblock(sigmask(SIGURG));
+ sigemptyset(&newmask);
+ sigaddset(&newmask, SIGURG);
+ sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask);
for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
- char errbuf[200];
-
s = rresvport_af(&lport, ai->ai_family);
if (s < 0) {
- if (errno == EAGAIN) {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s",
- _("rcmd: socket: All ports in use\n"));
- else
- fputs(_("rcmd: socket: All ports in use\n"),
- stderr);
- } else {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr,
- L"rcmd: socket: %m\n");
- else
- fprintf(stderr, "rcmd: socket: %m\n");
+ if (errno != EAGAIN && ai->ai_next) {
+ ai = ai->ai_next;
+ continue;
}
- __sigsetmask(oldmask);
+ if (errno == EAGAIN)
+ (void)fprintf(stderr,
+ "rcmd: socket: All ports in use\n");
+ else
+ (void)fprintf(stderr, "rcmd: socket: %s\n",
+ strerror(errno));
freeaddrinfo(res);
- return -1;
+ sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
+ NULL);
+ return (-1);
}
- __fcntl(s, F_SETOWN, pid);
- if (__connect(s, ai->ai_addr, ai->ai_addrlen) >= 0)
+ fcntl(s, F_SETOWN, pid);
+ if (connect(s, ai->ai_addr, ai->ai_addrlen) >= 0)
break;
- (void)__close(s);
+ (void)close(s);
if (errno == EADDRINUSE) {
lport--;
continue;
}
if (errno == ECONNREFUSED)
refused = 1;
- if (ai->ai_next != NULL) {
+ if (ai->ai_next == NULL && (!refused || timo > 16)) {
+ (void)fprintf(stderr, "%s: %s\n",
+ *ahost, strerror(errno));
+ freeaddrinfo(res);
+ sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask,
+ NULL);
+ return (-1);
+ }
+ if (nres > 1) {
int oerrno = errno;
- char *buf = NULL;
getnameinfo(ai->ai_addr, ai->ai_addrlen,
paddr, sizeof(paddr),
NULL, 0,
- NI_NUMERICHOST);
-
- if (__asprintf (&buf, _("connect to address %s: "),
- paddr) >= 0)
- {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s", buf);
- else
- fputs (buf, stderr);
- free (buf);
- }
- __set_errno (oerrno);
+ NI_NUMERICHOST|NI_WITHSCOPEID);
+ (void)fprintf(stderr, "connect to address %s: ",
+ paddr);
+ errno = oerrno;
perror(0);
- ai = ai->ai_next;
- getnameinfo(ai->ai_addr, ai->ai_addrlen,
- paddr, sizeof(paddr),
- NULL, 0,
- NI_NUMERICHOST);
- if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0)
- {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
- free (buf);
- }
- continue;
}
- if (refused && timo <= 16) {
- (void)sleep(timo);
+ if ((ai = ai->ai_next) == NULL) {
+ /* refused && timo <= 16 */
+ struct timespec time_to_sleep, time_remaining;
+
+ time_to_sleep.tv_sec = timo;
+ time_to_sleep.tv_nsec = 0;
+ (void)nanosleep(&time_to_sleep, &time_remaining);
timo *= 2;
ai = res;
refused = 0;
- continue;
}
- freeaddrinfo(res);
- if (_IO_fwide (stderr, 0) > 0)
- (void)__fwprintf(stderr, L"%s: %s\n", *ahost,
- strerror_r(errno,
- errbuf, sizeof (errbuf)));
- else
- (void)fprintf(stderr, "%s: %s\n", *ahost,
- strerror_r(errno,
- errbuf, sizeof (errbuf)));
- __sigsetmask(oldmask);
- return -1;
+ if (nres > 1) {
+ getnameinfo(ai->ai_addr, ai->ai_addrlen,
+ paddr, sizeof(paddr),
+ NULL, 0,
+ NI_NUMERICHOST|NI_WITHSCOPEID);
+ fprintf(stderr, "Trying %s...\n", paddr);
+ }
}
lport--;
if (fd2p == 0) {
- __write(s, "", 1);
+ write(s, "", 1);
lport = 0;
} else {
char num[8];
int s2 = rresvport_af(&lport, ai->ai_family), s3;
- socklen_t len = ai->ai_addrlen;
+ int len = ai->ai_addrlen;
+ int nfds;
if (s2 < 0)
goto bad;
listen(s2, 1);
(void)snprintf(num, sizeof(num), "%d", lport);
- if (__write(s, num, strlen(num)+1) != (ssize_t)strlen(num)+1) {
- char *buf = NULL;
-
- if (__asprintf (&buf, _("\
-rcmd: write (setting up stderr): %m\n")) >= 0)
- {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf(stderr, L"%s", buf);
- else
- fputs (buf, stderr);
- free (buf);
- }
- (void)__close(s2);
+ if (write(s, num, strlen(num)+1) != strlen(num)+1) {
+ (void)fprintf(stderr,
+ "rcmd: write (setting up stderr): %s\n",
+ strerror(errno));
+ (void)close(s2);
goto bad;
}
- pfd[0].fd = s;
- pfd[1].fd = s2;
- __set_errno (0);
- if (__poll (pfd, 2, -1) < 1 || (pfd[1].revents & POLLIN) == 0){
- char *buf = NULL;
-
- if ((errno != 0
- && __asprintf(&buf, _("\
-rcmd: poll (setting up stderr): %m\n")) >= 0)
- || (errno == 0
- && __asprintf(&buf, _("\
-poll: protocol failure in circuit setup\n")) >= 0))
- {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
- free (buf);
- }
- (void)__close(s2);
+ nfds = max(s, s2)+1;
+ if(nfds > FD_SETSIZE) {
+ fprintf(stderr, "rcmd: too many files\n");
+ (void)close(s2);
goto bad;
}
- s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
- &len));
+again:
+ FD_ZERO(&reads);
+ FD_SET(s, &reads);
+ FD_SET(s2, &reads);
+ errno = 0;
+ if (select(nfds, &reads, 0, 0, 0) < 1 || !FD_ISSET(s2, &reads)){
+ if (errno != 0)
+ (void)fprintf(stderr,
+ "rcmd: select (setting up stderr): %s\n",
+ strerror(errno));
+ else
+ (void)fprintf(stderr,
+ "select: protocol failure in circuit setup\n");
+ (void)close(s2);
+ goto bad;
+ }
+ s3 = accept(s2, (struct sockaddr *)&from, &len);
switch (from.ss_family) {
case AF_INET:
- rport = ntohs(((struct sockaddr_in *)&from)->sin_port);
+ aport = ntohs(((struct sockaddr_in *)&from)->sin_port);
break;
+#ifdef INET6
case AF_INET6:
- rport = ntohs(((struct sockaddr_in6 *)&from)->sin6_port);
+ aport = ntohs(((struct sockaddr_in6 *)&from)->sin6_port);
break;
+#endif
default:
- rport = 0;
+ aport = 0; /* error */
break;
}
- (void)__close(s2);
+ /*
+ * XXX careful for ftp bounce attacks. If discovered, shut them
+ * down and check for the real auxiliary channel to connect.
+ */
+ if (aport == 20) {
+ close(s3);
+ goto again;
+ }
+ (void)close(s2);
if (s3 < 0) {
- if (_IO_fwide (stderr, 0) > 0)
- (void)__fwprintf(stderr,
- L"rcmd: accept: %m\n");
- else
- (void)fprintf(stderr,
- "rcmd: accept: %m\n");
+ (void)fprintf(stderr,
+ "rcmd: accept: %s\n", strerror(errno));
lport = 0;
goto bad;
}
*fd2p = s3;
-
- if (rport >= IPPORT_RESERVED || rport < IPPORT_RESERVED / 2){
- char *buf = NULL;
-
- if (__asprintf(&buf, _("\
-socket: protocol failure in circuit setup\n")) >= 0)
- {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
- free (buf);
- }
+ if (aport >= IPPORT_RESERVED || aport < IPPORT_RESERVED / 2) {
+ (void)fprintf(stderr,
+ "socket: protocol failure in circuit setup.\n");
goto bad2;
}
}
- struct iovec iov[3] =
- {
- [0] = { .iov_base = (void *) locuser,
- .iov_len = strlen (locuser) + 1 },
- [1] = { .iov_base = (void *) remuser,
- .iov_len = strlen (remuser) + 1 },
- [2] = { .iov_base = (void *) cmd,
- .iov_len = strlen (cmd) + 1 }
- };
- (void) TEMP_FAILURE_RETRY (writev (s, iov, 3));
- n = TEMP_FAILURE_RETRY (read(s, &c, 1));
- if (n != 1) {
- char *buf = NULL;
-
- if ((n == 0
- && asprintf(&buf, _("rcmd: %s: short read"),
- *ahost) >= 0)
- || (n != 0
- && asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0))
- {
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
- fputs (buf, stderr);
- free (buf);
- }
+ (void)write(s, locuser, strlen(locuser)+1);
+ (void)write(s, remuser, strlen(remuser)+1);
+ (void)write(s, cmd, strlen(cmd)+1);
+ if (read(s, &c, 1) != 1) {
+ (void)fprintf(stderr,
+ "rcmd: %s: %s\n", *ahost, strerror(errno));
goto bad2;
}
if (c != 0) {
- while (__read(s, &c, 1) == 1) {
- (void)__write(STDERR_FILENO, &c, 1);
+ while (read(s, &c, 1) == 1) {
+ (void)write(STDERR_FILENO, &c, 1);
if (c == '\n')
break;
}
goto bad2;
}
- __sigsetmask(oldmask);
+ sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
freeaddrinfo(res);
- return s;
+ return (s);
bad2:
if (lport)
- (void)__close(*fd2p);
+ (void)close(*fd2p);
bad:
- (void)__close(s);
- __sigsetmask(oldmask);
+ (void)close(s);
+ sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL);
freeaddrinfo(res);
- return -1;
+ return (-1);
}
-libc_hidden_def (rcmd_af)
int
rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
@@ -412,155 +334,90 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
const char *locuser, *remuser, *cmd;
int *fd2p;
{
- return rcmd_af (ahost, rport, locuser, remuser, cmd, fd2p, AF_INET);
+ return rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, AF_INET);
+}
+
+int
+rresvport(port)
+ int *port;
+{
+ return rresvport_af(port, AF_INET);
}
int
rresvport_af(alport, family)
- int *alport;
- sa_family_t family;
+ int *alport, family;
{
- struct sockaddr_storage ss;
int s;
- size_t len;
- uint16_t *sport;
+ struct sockaddr_storage ss;
+ u_short *sport;
- switch(family){
+ memset(&ss, 0, sizeof(ss));
+ ss.ss_family = family;
+ switch (family) {
case AF_INET:
- len = sizeof(struct sockaddr_in);
sport = &((struct sockaddr_in *)&ss)->sin_port;
+ ((struct sockaddr_in *)&ss)->sin_addr.s_addr = INADDR_ANY;
break;
+#ifdef INET6
case AF_INET6:
- len = sizeof(struct sockaddr_in6);
sport = &((struct sockaddr_in6 *)&ss)->sin6_port;
+ ((struct sockaddr_in6 *)&ss)->sin6_addr = in6addr_any;
break;
+#endif
default:
- __set_errno (EAFNOSUPPORT);
+ errno = EAFNOSUPPORT;
return -1;
}
- s = __socket(family, SOCK_STREAM, 0);
- if (s < 0)
- return -1;
- memset (&ss, '\0', sizeof(ss));
-#ifdef SALEN
- ss.__ss_len = len;
+ s = socket(ss.ss_family, SOCK_STREAM, 0);
+ if (s < 0)
+ return (-1);
+#if 0 /* compat_exact_traditional_rresvport_semantics */
+ sin.sin_port = htons((u_short)*alport);
+ if (_bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
+ return (s);
+ if (errno != EADDRINUSE) {
+ (void)close(s);
+ return (-1);
+ }
#endif
- ss.ss_family = family;
-
- /* Ignore invalid values. */
- if (*alport < IPPORT_RESERVED / 2)
- *alport = IPPORT_RESERVED / 2;
- else if (*alport >= IPPORT_RESERVED)
- *alport = IPPORT_RESERVED - 1;
-
- int start = *alport;
- do {
- *sport = htons((uint16_t) *alport);
- if (__bind(s, (struct sockaddr *)&ss, len) >= 0)
- return s;
- if (errno != EADDRINUSE) {
- (void)__close(s);
- return -1;
- }
- if ((*alport)-- == IPPORT_RESERVED/2)
- *alport = IPPORT_RESERVED - 1;
- } while (*alport != start);
- (void)__close(s);
- __set_errno (EAGAIN);
- return -1;
-}
-libc_hidden_def (rresvport_af)
-
-int
-rresvport(alport)
- int *alport;
-{
- return rresvport_af(alport, AF_INET);
+ *sport = 0;
+ if (bindresvport_sa(s, (struct sockaddr *)&ss) == -1) {
+ (void)close(s);
+ return (-1);
+ }
+ *alport = (int)ntohs(*sport);
+ return (s);
}
int __check_rhosts_file = 1;
char *__rcmd_errstr;
int
-ruserok_af(rhost, superuser, ruser, luser, af)
- const char *rhost, *ruser, *luser;
- int superuser;
- sa_family_t af;
-{
- struct addrinfo hints, *res, *res0;
- int gai;
- int ret;
-
- memset (&hints, '\0', sizeof(hints));
- hints.ai_family = af;
- gai = getaddrinfo(rhost, NULL, &hints, &res0);
- if (gai)
- return -1;
- ret = -1;
- for (res=res0; res; res=res->ai_next)
- if (ruserok2_sa(res->ai_addr, res->ai_addrlen,
- superuser, ruser, luser, rhost) == 0){
- ret = 0;
- break;
- }
- freeaddrinfo(res0);
- return (ret);
-}
-libc_hidden_def (ruserok_af)
-
-int
ruserok(rhost, superuser, ruser, luser)
const char *rhost, *ruser, *luser;
int superuser;
{
- return ruserok_af(rhost, superuser, ruser, luser, AF_INET);
-}
-
-/* Extremely paranoid file open function. */
-static FILE *
-iruserfopen (const char *file, uid_t okuser)
-{
- struct stat64 st;
- char *cp = NULL;
- FILE *res = NULL;
-
- /* If not a regular file, if owned by someone other than user or
- root, if writeable by anyone but the owner, or if hardlinked
- anywhere, quit. */
- cp = NULL;
- if (__lxstat64 (_STAT_VER, file, &st))
- cp = _("lstat failed");
- else if (!S_ISREG (st.st_mode))
- cp = _("not regular file");
- else
- {
- res = fopen (file, "rc");
- if (!res)
- cp = _("cannot open");
- else if (__fxstat64 (_STAT_VER, fileno (res), &st) < 0)
- cp = _("fstat failed");
- else if (st.st_uid && st.st_uid != okuser)
- cp = _("bad owner");
- else if (st.st_mode & (S_IWGRP|S_IWOTH))
- cp = _("writeable by other than owner");
- else if (st.st_nlink > 1)
- cp = _("hard linked somewhere");
- }
-
- /* If there were any problems, quit. */
- if (cp != NULL)
- {
- __rcmd_errstr = cp;
- if (res)
- fclose (res);
- return NULL;
- }
-
- /* No threads use this stream. */
- __fsetlocking (res, FSETLOCKING_BYCALLER);
-
- return res;
+ struct addrinfo hints, *res, *r;
+ int error;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = PF_UNSPEC;
+ hints.ai_socktype = SOCK_DGRAM; /*dummy*/
+ error = getaddrinfo(rhost, "0", &hints, &res);
+ if (error)
+ return (-1);
+
+ for (r = res; r; r = r->ai_next) {
+ if (iruserok_sa(r->ai_addr, r->ai_addrlen, superuser, ruser,
+ luser) == 0) {
+ freeaddrinfo(res);
+ return (0);
+ }
+ }
+ freeaddrinfo(res);
+ return (-1);
}
/*
@@ -572,127 +429,110 @@ iruserfopen (const char *file, uid_t okuser)
*
* Returns 0 if ok, -1 if not ok.
*/
-static int
-ruserok2_sa (ra, ralen, superuser, ruser, luser, rhost)
- struct sockaddr *ra;
- size_t ralen;
- int superuser;
- const char *ruser, *luser, *rhost;
+int
+iruserok(raddr, superuser, ruser, luser)
+ unsigned long raddr;
+ int superuser;
+ const char *ruser, *luser;
{
- FILE *hostf = NULL;
- int isbad = -1;
-
- if (!superuser)
- hostf = iruserfopen (_PATH_HEQUIV, 0);
-
- if (hostf)
- {
- isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost);
- fclose (hostf);
-
- if (!isbad)
- return 0;
- }
-
- if (__check_rhosts_file || superuser)
- {
- char *pbuf;
- struct passwd pwdbuf, *pwd;
- size_t dirlen;
- size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
- char *buffer = __alloca (buflen);
- uid_t uid;
-
- if (__getpwnam_r (luser, &pwdbuf, buffer, buflen, &pwd) != 0
- || pwd == NULL)
- return -1;
-
- dirlen = strlen (pwd->pw_dir);
- pbuf = alloca (dirlen + sizeof "/.rhosts");
- __mempcpy (__mempcpy (pbuf, pwd->pw_dir, dirlen),
- "/.rhosts", sizeof "/.rhosts");
-
- /* Change effective uid while reading .rhosts. If root and
- reading an NFS mounted file system, can't read files that
- are protected read/write owner only. */
- uid = __geteuid ();
- seteuid (pwd->pw_uid);
- hostf = iruserfopen (pbuf, pwd->pw_uid);
-
- if (hostf != NULL)
- {
- isbad = __validuser2_sa (hostf, ra, ralen, luser, ruser, rhost);
- fclose (hostf);
- }
-
- seteuid (uid);
- return isbad;
- }
- return -1;
+ struct sockaddr_in sin;
+ int sin_len;
+
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_family = AF_INET;
+ sin_len = sizeof(struct sockaddr_in);
+ memcpy(&sin.sin_addr, &raddr, sizeof(sin.sin_addr));
+ return iruserok_sa((struct sockaddr *)&sin, sin_len, superuser,
+ ruser, luser);
}
+
/*
- * ruserok_sa() is now discussed on ipng, so
- * currently disabled for external use
+ * AF independent extension of iruserok.
+ *
+ * Returns 0 if ok, -1 if not ok.
*/
-static int ruserok_sa(ra, ralen, superuser, ruser, luser)
- struct sockaddr *ra;
- size_t ralen;
- int superuser;
- const char *ruser, *luser;
-{
- return ruserok2_sa(ra, ralen, superuser, ruser, luser, "-");
-}
-
-/* This is the exported version. */
int
-iruserok_af (raddr, superuser, ruser, luser, af)
- const void *raddr;
- int superuser;
- const char *ruser, *luser;
- sa_family_t af;
+iruserok_sa(ra, rlen, superuser, ruser, luser)
+ const void *ra;
+ int rlen;
+ int superuser;
+ const char *ruser, *luser;
{
- struct sockaddr_storage ra;
- size_t ralen;
-
- memset (&ra, '\0', sizeof(ra));
- switch (af){
- case AF_INET:
- ((struct sockaddr_in *)&ra)->sin_family = AF_INET;
- memcpy (&(((struct sockaddr_in *)&ra)->sin_addr), raddr,
- sizeof(struct in_addr));
- ralen = sizeof(struct sockaddr_in);
- break;
- case AF_INET6:
- ((struct sockaddr_in6 *)&ra)->sin6_family = AF_INET6;
- memcpy (&(((struct sockaddr_in6 *)&ra)->sin6_addr), raddr,
- sizeof(struct in6_addr));
- ralen = sizeof(struct sockaddr_in6);
- break;
- default:
- return 0;
- }
- return ruserok_sa ((struct sockaddr *)&ra, ralen, superuser, ruser, luser);
-}
-libc_hidden_def (iruserok_af)
+ char *cp;
+ struct stat sbuf;
+ struct passwd *pwd;
+ FILE *hostf;
+ uid_t uid;
+ int first;
+ char pbuf[MAXPATHLEN];
+ const struct sockaddr *raddr;
+ struct sockaddr_storage ss;
-int
-iruserok (raddr, superuser, ruser, luser)
- u_int32_t raddr;
- int superuser;
- const char *ruser, *luser;
-{
- return iruserok_af (&raddr, superuser, ruser, luser, AF_INET);
+ /* avoid alignment issue */
+ if (rlen > sizeof(ss))
+ return(-1);
+ memcpy(&ss, ra, rlen);
+ raddr = (struct sockaddr *)&ss;
+
+ first = 1;
+ hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r");
+again:
+ if (hostf) {
+ if (__ivaliduser_sa(hostf, raddr, rlen, luser, ruser) == 0) {
+ (void)fclose(hostf);
+ return (0);
+ }
+ (void)fclose(hostf);
+ }
+ if (first == 1 && (__check_rhosts_file || superuser)) {
+ first = 0;
+ if ((pwd = getpwnam(luser)) == NULL)
+ return (-1);
+ (void)strcpy(pbuf, pwd->pw_dir);
+ (void)strcat(pbuf, "/.rhosts");
+
+ /*
+ * Change effective uid while opening .rhosts. If root and
+ * reading an NFS mounted file system, can't read files that
+ * are protected read/write owner only.
+ */
+ uid = geteuid();
+ (void)seteuid(pwd->pw_uid);
+ hostf = fopen(pbuf, "r");
+ (void)seteuid(uid);
+
+ if (hostf == NULL)
+ return (-1);
+ /*
+ * If not a regular file, or is owned by someone other than
+ * user or root or if writeable by anyone but the owner, quit.
+ */
+ cp = NULL;
+ if (lstat(pbuf, &sbuf) < 0)
+ cp = ".rhosts lstat failed";
+ else if (!S_ISREG(sbuf.st_mode))
+ cp = ".rhosts not regular file";
+ else if (fstat(fileno(hostf), &sbuf) < 0)
+ cp = ".rhosts fstat failed";
+ else if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid)
+ cp = "bad .rhosts owner";
+ else if (sbuf.st_mode & (S_IWGRP|S_IWOTH))
+ cp = ".rhosts writeable by other than owner";
+ /* If there were any problems, quit. */
+ if (cp) {
+ __rcmd_errstr = cp;
+ (void)fclose(hostf);
+ return (-1);
+ }
+ goto again;
+ }
+ return (-1);
}
/*
* XXX
* Don't make static, used by lpd(8).
*
- * This function is not used anymore. It is only present because lpd(8)
- * calls it (!?!). We simply call __invaliduser2() with an illegal rhost
- * argument. This means that netgroups won't work in .rhost/hosts.equiv
- * files. If you want lpd to work with netgroups, fix lpd to use ruserok()
- * or PAM.
* Returns 0 if ok, -1 if not ok.
*/
int
@@ -701,185 +541,239 @@ __ivaliduser(hostf, raddr, luser, ruser)
u_int32_t raddr;
const char *luser, *ruser;
{
- struct sockaddr_in ra;
- memset(&ra, '\0', sizeof(ra));
- ra.sin_family = AF_INET;
- ra.sin_addr.s_addr = raddr;
- return __validuser2_sa(hostf, (struct sockaddr *)&ra, sizeof(ra),
- luser, ruser, "-");
+ struct sockaddr_in sin;
+ int sin_len;
+
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_family = AF_INET;
+ sin_len = sizeof(struct sockaddr_in);
+ memcpy(&sin.sin_addr, &raddr, sizeof(sin.sin_addr));
+ return __ivaliduser_sa(hostf, (struct sockaddr *)&sin, sin_len,
+ luser, ruser);
}
-
-/* Returns 1 on positive match, 0 on no match, -1 on negative match. */
-static int
-internal_function
-__checkhost_sa (struct sockaddr *ra, size_t ralen, char *lhost,
- const char *rhost)
+/*
+ * Returns 0 if ok, -1 if not ok.
+ *
+ * XXX obsolete API.
+ */
+int
+__ivaliduser_af(hostf, raddr, luser, ruser, af, len)
+ FILE *hostf;
+ const void *raddr;
+ const char *luser, *ruser;
+ int af, len;
{
- struct addrinfo hints, *res0, *res;
- char raddr[INET6_ADDRSTRLEN];
- int match;
- int negate=1; /* Multiply return with this to get -1 instead of 1 */
-
- /* Check nis netgroup. */
- if (strncmp ("+@", lhost, 2) == 0)
- return innetgr (&lhost[2], rhost, NULL, NULL);
-
- if (strncmp ("-@", lhost, 2) == 0)
- return -innetgr (&lhost[2], rhost, NULL, NULL);
-
- /* -host */
- if (strncmp ("-", lhost,1) == 0) {
- negate = -1;
- lhost++;
- } else if (strcmp ("+",lhost) == 0) {
- return 1; /* asking for trouble, but ok.. */
- }
+ struct sockaddr *sa = NULL;
+ struct sockaddr_in *sin = NULL;
+#ifdef INET6
+ struct sockaddr_in6 *sin6 = NULL;
+#endif
+ struct sockaddr_storage ss;
- /* Try for raw ip address first. */
- /* XXX */
- if (getnameinfo(ra, ralen,
- raddr, sizeof(raddr), NULL, 0,
- NI_NUMERICHOST) == 0
- && strcmp(raddr, lhost) == 0)
- return negate;
-
- /* Better be a hostname. */
- match = 0;
- memset(&hints, '\0', sizeof(hints));
- hints.ai_family = ra->sa_family;
- if (getaddrinfo(lhost, NULL, &hints, &res0) == 0){
- /* Spin through ip addresses. */
- for (res = res0; res; res = res->ai_next)
- {
- if (res->ai_family == ra->sa_family
- && !memcmp(res->ai_addr, ra, res->ai_addrlen))
- {
- match = 1;
- break;
- }
- }
- freeaddrinfo (res0);
+ memset(&ss, 0, sizeof(ss));
+ switch (af) {
+ case AF_INET:
+ if (len != sizeof(sin->sin_addr))
+ return -1;
+ sin = (struct sockaddr_in *)&ss;
+ sin->sin_family = AF_INET;
+ memcpy(&sin->sin_addr, raddr, sizeof(sin->sin_addr));
+ break;
+#ifdef INET6
+ case AF_INET6:
+ if (len != sizeof(sin6->sin6_addr))
+ return -1;
+ /* you will lose scope info */
+ sin6 = (struct sockaddr_in6 *)&ss;
+ sin6->sin6_family = AF_INET6;
+ memcpy(&sin6->sin6_addr, raddr, sizeof(sin6->sin6_addr));
+ break;
+#endif
+ default:
+ return -1;
}
- return negate * match;
-}
-
-/* Returns 1 on positive match, 0 on no match, -1 on negative match. */
-static int
-internal_function
-__icheckuser (const char *luser, const char *ruser)
-{
- /*
- luser is user entry from .rhosts/hosts.equiv file
- ruser is user id on remote host
- */
-
- /* [-+]@netgroup */
- if (strncmp ("+@", luser, 2) == 0)
- return innetgr (&luser[2], NULL, ruser, NULL);
-
- if (strncmp ("-@", luser,2) == 0)
- return -innetgr (&luser[2], NULL, ruser, NULL);
- /* -user */
- if (strncmp ("-", luser, 1) == 0)
- return -(strcmp (&luser[1], ruser) == 0);
-
- /* + */
- if (strcmp ("+", luser) == 0)
- return 1;
-
- /* simple string match */
- return strcmp (ruser, luser) == 0;
+ sa = (struct sockaddr *)&ss;
+ return __ivaliduser_sa(hostf, sa, 0, luser, ruser);
}
-/*
- * Returns 1 for blank lines (or only comment lines) and 0 otherwise
- */
-static int
-__isempty (char *p)
+int
+__ivaliduser_sa(hostf, raddr, salen, luser, ruser)
+ FILE *hostf;
+ const struct sockaddr *raddr;
+ socklen_t salen;
+ const char *luser, *ruser;
{
- while (*p && isspace (*p)) {
- ++p;
- }
-
- return (*p == '\0' || *p == '#') ? 1 : 0 ;
+ char *user, *p;
+ int ch;
+ char buf[MAXHOSTNAMELEN + 128]; /* host + login */
+ char hname[MAXHOSTNAMELEN];
+ /* Presumed guilty until proven innocent. */
+ int userok = 0, hostok = 0;
+#ifdef YP
+ char *ypdomain;
+
+ if (yp_get_default_domain(&ypdomain))
+ ypdomain = NULL;
+#else
+#define ypdomain NULL
+#endif
+ /* We need to get the damn hostname back for netgroup matching. */
+ if (getnameinfo(raddr, salen, hname, sizeof(hname), NULL, 0,
+ NI_NAMEREQD) != 0)
+ return (-1);
+
+ while (fgets(buf, sizeof(buf), hostf)) {
+ p = buf;
+ /* Skip lines that are too long. */
+ if (strchr(p, '\n') == NULL) {
+ while ((ch = getc(hostf)) != '\n' && ch != EOF);
+ continue;
+ }
+ if (*p == '\n' || *p == '#') {
+ /* comment... */
+ continue;
+ }
+ while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') {
+ *p = isupper((unsigned char)*p) ? tolower((unsigned char)*p) : *p;
+ p++;
+ }
+ if (*p == ' ' || *p == '\t') {
+ *p++ = '\0';
+ while (*p == ' ' || *p == '\t')
+ p++;
+ user = p;
+ while (*p != '\n' && *p != ' ' &&
+ *p != '\t' && *p != '\0')
+ p++;
+ } else
+ user = p;
+ *p = '\0';
+ /*
+ * Do +/- and +@/-@ checking. This looks really nasty,
+ * but it matches SunOS's behavior so far as I can tell.
+ */
+ switch(buf[0]) {
+ case '+':
+ if (!buf[1]) { /* '+' matches all hosts */
+ hostok = 1;
+ break;
+ }
+ if (buf[1] == '@') /* match a host by netgroup */
+ hostok = innetgr((char *)&buf[2],
+ (char *)&hname, NULL, ypdomain);
+ else /* match a host by addr */
+ hostok = __icheckhost(raddr, salen,
+ (char *)&buf[1]);
+ break;
+ case '-': /* reject '-' hosts and all their users */
+ if (buf[1] == '@') {
+ if (innetgr((char *)&buf[2],
+ (char *)&hname, NULL, ypdomain))
+ return(-1);
+ } else {
+ if (__icheckhost(raddr, salen,
+ (char *)&buf[1]))
+ return(-1);
+ }
+ break;
+ default: /* if no '+' or '-', do a simple match */
+ hostok = __icheckhost(raddr, salen, buf);
+ break;
+ }
+ switch(*user) {
+ case '+':
+ if (!*(user+1)) { /* '+' matches all users */
+ userok = 1;
+ break;
+ }
+ if (*(user+1) == '@') /* match a user by netgroup */
+ userok = innetgr(user+2, NULL, ruser, ypdomain);
+ else /* match a user by direct specification */
+ userok = !(strcmp(ruser, user+1));
+ break;
+ case '-': /* if we matched a hostname, */
+ if (hostok) { /* check for user field rejections */
+ if (!*(user+1))
+ return(-1);
+ if (*(user+1) == '@') {
+ if (innetgr(user+2, NULL,
+ ruser, ypdomain))
+ return(-1);
+ } else {
+ if (!strcmp(ruser, user+1))
+ return(-1);
+ }
+ }
+ break;
+ default: /* no rejections: try to match the user */
+ if (hostok)
+ userok = !(strcmp(ruser,*user ? user : luser));
+ break;
+ }
+ if (hostok && userok)
+ return(0);
+ }
+ return (-1);
}
/*
- * Returns 0 if positive match, -1 if _not_ ok.
+ * Returns "true" if match, 0 if no match.
+ *
+ * NI_WITHSCOPEID is useful for comparing sin6_scope_id portion
+ * if af == AF_INET6.
*/
static int
-__validuser2_sa(hostf, ra, ralen, luser, ruser, rhost)
- FILE *hostf;
- struct sockaddr *ra;
- size_t ralen;
- const char *luser, *ruser, *rhost;
+__icheckhost(raddr, salen, lhost)
+ const struct sockaddr *raddr;
+ socklen_t salen;
+ const char *lhost;
{
- register const char *user;
- register char *p;
- int hcheck, ucheck;
- char *buf = NULL;
- size_t bufsize = 0;
- int retval = -1;
-
- while (__getline (&buf, &bufsize, hostf) > 0) {
- buf[bufsize - 1] = '\0'; /* Make sure it's terminated. */
- p = buf;
-
- /* Skip empty or comment lines */
- if (__isempty (p)) {
- continue;
- }
-
- for (;*p && !isspace(*p); ++p) {
- *p = _tolower (*p);
+ struct sockaddr_in sin;
+ struct sockaddr_in6 *sin6;
+ struct addrinfo hints, *res, *r;
+ int error;
+ char h1[NI_MAXHOST], h2[NI_MAXHOST];
+
+ if (raddr->sa_family == AF_INET6) {
+ sin6 = (struct sockaddr_in6 *)raddr;
+ if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_family = AF_INET;
+ memcpy(&sin.sin_addr, &sin6->sin6_addr.s6_addr[12],
+ sizeof(sin.sin_addr));
+ raddr = (struct sockaddr *)&sin;
+ salen = sizeof(struct sockaddr_in);
+ }
}
- /* Next we want to find the permitted name for the remote user. */
- if (*p == ' ' || *p == '\t') {
- /* <nul> terminate hostname and skip spaces */
- for (*p++='\0'; *p && isspace (*p); ++p);
-
- user = p; /* this is the user's name */
- while (*p && !isspace (*p))
- ++p; /* find end of user's name */
- } else
- user = p;
-
- *p = '\0'; /* <nul> terminate username (+host?) */
-
- /* buf -> host(?) ; user -> username(?) */
-
- /* First check host part */
- hcheck = __checkhost_sa (ra, ralen, buf, rhost);
-
- if (hcheck < 0)
- break;
-
- if (hcheck) {
- /* Then check user part */
- if (! (*user))
- user = luser;
-
- ucheck = __icheckuser (user, ruser);
-
- /* Positive 'host user' match? */
- if (ucheck > 0) {
- retval = 0;
- break;
- }
-
- /* Negative 'host -user' match? */
- if (ucheck < 0)
- break;
-
- /* Neither, go on looking for match */
+ h1[0] = '\0';
+ if (getnameinfo(raddr, salen, h1, sizeof(h1), NULL, 0,
+ NI_NUMERICHOST | NI_WITHSCOPEID) != 0)
+ return (0);
+
+ /* Resolve laddr into sockaddr */
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = raddr->sa_family;
+ hints.ai_socktype = SOCK_DGRAM; /*XXX dummy*/
+ res = NULL;
+ error = getaddrinfo(lhost, "0", &hints, &res);
+ if (error)
+ return (0);
+
+ for (r = res; r ; r = r->ai_next) {
+ h2[0] = '\0';
+ if (getnameinfo(r->ai_addr, r->ai_addrlen, h2, sizeof(h2),
+ NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) != 0)
+ continue;
+ if (strcmp(h1, h2) == 0) {
+ freeaddrinfo(res);
+ return (1);
+ }
}
- }
-
- if (buf != NULL)
- free (buf);
- return retval;
+ /* No match. */
+ freeaddrinfo(res);
+ return (0);
}
diff --git a/newlib/libc/sys/linux/net/rcmdsh.3 b/newlib/libc/sys/linux/net/rcmdsh.3
new file mode 100644
index 000000000..43e6a8daa
--- /dev/null
+++ b/newlib/libc/sys/linux/net/rcmdsh.3
@@ -0,0 +1,116 @@
+.\" $OpenBSD: rcmdsh.3,v 1.6 1999/07/05 04:41:00 aaron Exp $
+.\"
+.\" Copyright (c) 1983, 1991, 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.
+.\"
+.\" $FreeBSD: src/lib/libc/net/rcmdsh.3,v 1.2 2001/11/09 15:19:25 ru Exp $
+.\"
+.Dd September 1, 1996
+.Dt RCMDSH 3
+.Os
+.Sh NAME
+.Nm rcmdsh
+.Nd return a stream to a remote command without superuser
+.Sh SYNOPSIS
+.In unistd.h
+.Ft int
+.Fo rcmdsh
+.Fa "char **ahost"
+.Fa "int inport"
+.Fa "const char *locuser"
+.Fa "const char *remuser"
+.Fa "const char *cmd"
+.Fa "const char *rshprog"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn rcmdsh
+function
+is used by normal users to execute a command on
+a remote machine using an authentication scheme based
+on reserved port numbers using
+.Xr rshd 8
+or the value of
+.Fa rshprog
+(if
+.No non- Ns Dv NULL ) .
+.Pp
+The
+.Fn rcmdsh
+function
+looks up the host
+.Fa *ahost
+using
+.Xr gethostbyname 3 ,
+returning \-1 if the host does not exist.
+Otherwise
+.Fa *ahost
+is set to the standard name of the host
+and a connection is established to a server
+residing at the well-known Internet port
+.Dq Li shell/tcp
+(or whatever port is used by
+.Fa rshprog ) .
+The parameter
+.Fa inport
+is ignored; it is only included to provide an interface similar to
+.Xr rcmd 3 .
+.Pp
+If the connection succeeds,
+a socket in the
+.Ux
+domain of type
+.Dv SOCK_STREAM
+is returned to the caller, and given to the remote
+command as stdin, stdout, and stderr.
+.Sh RETURN VALUES
+The
+.Fn rcmdsh
+function
+returns a valid socket descriptor on success.
+Otherwise, \-1 is returned
+and a diagnostic message is printed on the standard error.
+.Sh SEE ALSO
+.Xr rsh 1 ,
+.Xr socketpair 2 ,
+.Xr rcmd 3 ,
+.Xr rshd 8
+.Sh BUGS
+If
+.Xr rsh 1
+encounters an error, a file descriptor is still returned instead of \-1.
+.Sh HISTORY
+The
+.Fn rcmdsh
+function first appeared in
+.Ox 2.0 ,
+and made its way into
+.Fx 5.0 .
diff --git a/newlib/libc/sys/linux/net/res_comp.c b/newlib/libc/sys/linux/net/res_comp.c
index 51211f743..12ea02c6d 100644
--- a/newlib/libc/sys/linux/net/res_comp.c
+++ b/newlib/libc/sys/linux/net/res_comp.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1985, 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:
@@ -10,10 +10,14 @@
* 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
@@ -29,14 +33,14 @@
/*
* 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
@@ -48,7 +52,7 @@
*/
/*
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -65,9 +69,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$BINDId: res_comp.c,v 8.15 1999/10/13 16:39:39 vixie Exp $";
+static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
+static char orig_rcsid[] = "From: Id: res_comp.c,v 8.11 1997/05/21 19:31:04 halley Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -78,7 +84,8 @@ static const char rcsid[] = "$BINDId: res_comp.c,v 8.15 1999/10/13 16:39:39 vixi
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include "libc-symbols.h"
+
+#define BIND_4_COMPAT
/*
* Expand compressed domain name 'comp_dn' to full domain name.
@@ -97,7 +104,6 @@ dn_expand(const u_char *msg, const u_char *eom, const u_char *src,
dst[0] = '\0';
return (n);
}
-libresolv_hidden_def (dn_expand)
/*
* Pack domain name 'exp_dn' in presentation form into 'comp_dn'.
@@ -112,7 +118,6 @@ dn_comp(const char *src, u_char *dst, int dstsiz,
(const u_char **)dnptrs,
(const u_char **)lastdnptr));
}
-libresolv_hidden_def (dn_comp)
/*
* Skip over a compressed domain name. Return the size or -1.
@@ -125,7 +130,6 @@ dn_skipname(const u_char *ptr, const u_char *eom) {
return (-1);
return (ptr - saveptr);
}
-libresolv_hidden_def (dn_skipname)
/*
* Verify that a domain name uses an acceptable character set.
@@ -139,7 +143,6 @@ libresolv_hidden_def (dn_skipname)
*/
#define PERIOD 0x2e
#define hyphenchar(c) ((c) == 0x2d)
-#define underscorechar(c) ((c) == 0x5f)
#define bslashchar(c) ((c) == 0x5c)
#define periodchar(c) ((c) == PERIOD)
#define asterchar(c) ((c) == 0x2a)
@@ -148,11 +151,13 @@ libresolv_hidden_def (dn_skipname)
#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
#define borderchar(c) (alphachar(c) || digitchar(c))
-#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
+#define middlechar(c) (borderchar(c) || hyphenchar(c))
#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
int
-res_hnok(const char *dn) {
+res_hnok(dn)
+ const char *dn;
+{
int ppch = '\0', pch = PERIOD, ch = *dn++;
while (ch != '\0') {
@@ -174,14 +179,15 @@ res_hnok(const char *dn) {
}
return (1);
}
-libresolv_hidden_def (res_hnok)
/*
* hostname-like (A, MX, WKS) owners can have "*" as their first label
* but must otherwise be as a host name.
*/
int
-res_ownok(const char *dn) {
+res_ownok(dn)
+ const char *dn;
+{
if (asterchar(dn[0])) {
if (periodchar(dn[1]))
return (res_hnok(dn+2));
@@ -196,7 +202,9 @@ res_ownok(const char *dn) {
* label, but the rest of the name has to look like a host name.
*/
int
-res_mailok(const char *dn) {
+res_mailok(dn)
+ const char *dn;
+{
int ch, escaped = 0;
/* "." is a valid missing representation */
@@ -224,7 +232,9 @@ res_mailok(const char *dn) {
* recommendations.
*/
int
-res_dnok(const char *dn) {
+res_dnok(dn)
+ const char *dn;
+{
int ch;
while ((ch = *dn++) != '\0')
@@ -232,31 +242,27 @@ res_dnok(const char *dn) {
return (0);
return (1);
}
-libresolv_hidden_def (res_dnok)
#ifdef BIND_4_COMPAT
/*
* This module must export the following externally-visible symbols:
- * ___putlong
- * ___putshort
- * __getlong
- * __getshort
+ * ___putlong
+ * ___putshort
+ * __getlong
+ * __getshort
* Note that one _ comes from C and the others come from us.
*/
void __putlong(u_int32_t src, u_char *dst) { ns_put32(src, dst); }
-libresolv_hidden_def (__putlong)
void __putshort(u_int16_t src, u_char *dst) { ns_put16(src, dst); }
-libresolv_hidden_def (__putshort)
-#ifndef __ultrix__
u_int32_t _getlong(const u_char *src) { return (ns_get32(src)); }
u_int16_t _getshort(const u_char *src) { return (ns_get16(src)); }
-#endif /*__ultrix__*/
#endif /*BIND_4_COMPAT*/
-
-#include <shlib-compat.h>
-
-#if SHLIB_COMPAT(libresolv, GLIBC_2_0, GLIBC_2_2)
-# undef dn_expand
-weak_alias (__dn_expand, dn_expand);
-#endif
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <resolv.h>.
+ */
+#undef dn_comp
+__weak_reference(__dn_comp, dn_comp);
+#undef dn_expand
+__weak_reference(__dn_expand, dn_expand);
diff --git a/newlib/libc/sys/linux/net/res_config.h b/newlib/libc/sys/linux/net/res_config.h
new file mode 100644
index 000000000..b7deb38f9
--- /dev/null
+++ b/newlib/libc/sys/linux/net/res_config.h
@@ -0,0 +1,10 @@
+/* $FreeBSD: src/lib/libc/net/res_config.h,v 1.8 2002/03/22 23:41:54 obrien Exp $ */
+
+#define DEBUG 1 /* enable debugging code (needed for dig) */
+#define RESOLVSORT /* allow sorting of addresses in gethostbyname */
+#define RFC1535 /* comply with RFC1535 (STRONGLY reccomended by vixie)*/
+#undef USELOOPBACK /* res_init() bind to localhost */
+#undef SUNSECURITY /* verify gethostbyaddr() calls - WE DONT NEED IT */
+#define MULTI_PTRS_ARE_ALIASES 1 /* fold multiple PTR records into aliases */
+#define CHECK_SRVR_ADDR 1 /* confirm that the server requested sent the reply */
+#define BIND_UPDATE 1 /* update support */
diff --git a/newlib/libc/sys/linux/net/res_data.c b/newlib/libc/sys/linux/net/res_data.c
index cb140eeb7..7db548078 100644
--- a/newlib/libc/sys/linux/net/res_data.c
+++ b/newlib/libc/sys/linux/net/res_data.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995-1999 by Internet Software Consortium.
+ * Copyright (c) 1995,1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -15,30 +15,24 @@
* SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$BINDId: res_data.c,v 8.17 1999/10/13 17:11:31 vixie Exp $";
-#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
-
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
-
#include <ctype.h>
-#include <netdb.h>
#include <resolv.h>
-#ifdef BIND_UPDATE
-#include <res_update.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "libc-symbols.h"
+
+#include "res_config.h"
const char *_res_opcodes[] = {
"QUERY",
@@ -58,278 +52,31 @@ const char *_res_opcodes[] = {
"ZONEINIT",
"ZONEREF",
};
-libresolv_hidden_data_def (_res_opcodes)
+
+const char *_res_resultcodes[] = {
+ "NOERROR",
+ "FORMERR",
+ "SERVFAIL",
+ "NXDOMAIN",
+ "NOTIMP",
+ "REFUSED",
+ "YXDOMAIN",
+ "YXRRSET",
+ "NXRRSET",
+ "NOTAUTH",
+ "ZONEERR",
+ "11",
+ "12",
+ "13",
+ "14",
+ "NOCHANGE",
+};
#ifdef BIND_UPDATE
-const char *_res_sectioncodes[] attribute_hidden = {
+const char *_res_sectioncodes[] = {
"ZONE",
"PREREQUISITES",
"UPDATE",
"ADDITIONAL",
};
#endif
-
-#ifndef __BIND_NOSTATIC
-#ifdef _LIBC
-/* The definition has been moved to res_libc.c. */
-#else
-#undef _res
-struct __res_state _res
-# if defined(__BIND_RES_TEXT)
- = { RES_TIMEOUT, } /* Motorola, et al. */
-# endif
- ;
-#endif
-
-/* Proto. */
-#ifndef _LIBC
-int res_ourserver_p(const res_state, const struct sockaddr_in *);
-void res_pquery(const res_state, const u_char *, int, FILE *);
-#endif
-
-#ifndef _LIBC
-/* Moved to res_libc.c since res_init() should go into libc.so but the
- rest of this file not. */
-int
-res_init(void) {
- extern int __res_vinit(res_state, int);
-
- /*
- * These three fields used to be statically initialized. This made
- * it hard to use this code in a shared library. It is necessary,
- * now that we're doing dynamic initialization here, that we preserve
- * the old semantics: if an application modifies one of these three
- * fields of _res before res_init() is called, res_init() will not
- * alter them. Of course, if an application is setting them to
- * _zero_ before calling res_init(), hoping to override what used
- * to be the static default, we can't detect it and unexpected results
- * will follow. Zero for any of these fields would make no sense,
- * so one can safely assume that the applications were already getting
- * unexpected results.
- *
- * _res.options is tricky since some apps were known to diddle the bits
- * before res_init() was first called. We can't replicate that semantic
- * with dynamic initialization (they may have turned bits off that are
- * set in RES_DEFAULT). Our solution is to declare such applications
- * "broken". They could fool us by setting RES_INIT but none do (yet).
- */
- if (!_res.retrans)
- _res.retrans = RES_TIMEOUT;
- if (!_res.retry)
- _res.retry = 4;
- if (!(_res.options & RES_INIT))
- _res.options = RES_DEFAULT;
-
- /*
- * This one used to initialize implicitly to zero, so unless the app
- * has set it to something in particular, we can randomize it now.
- */
- if (!_res.id)
- _res.id = res_randomid();
-
- return (__res_vinit(&_res, 1));
-}
-#endif
-
-void
-p_query(const u_char *msg) {
- fp_query(msg, stdout);
-}
-
-void
-fp_query(const u_char *msg, FILE *file) {
- fp_nquery(msg, PACKETSZ, file);
-}
-libresolv_hidden_def (fp_query)
-
-void
-fp_nquery(const u_char *msg, int len, FILE *file) {
- if (__res_maybe_init (&_res, 0) == -1)
- return;
-
- res_pquery(&_res, msg, len, file);
-}
-libresolv_hidden_def (fp_nquery)
-
-int
-res_mkquery(int op, /* opcode of query */
- const char *dname, /* domain name */
- int class, int type, /* class and type of query */
- const u_char *data, /* resource record data */
- int datalen, /* length of data */
- const u_char *newrr_in, /* new rr for modify or append */
- u_char *buf, /* buffer to put query */
- int buflen) /* size of buffer */
-{
- if (__res_maybe_init (&_res, 1) == -1) {
- RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
- return (-1);
- }
- return (res_nmkquery(&_res, op, dname, class, type,
- data, datalen,
- newrr_in, buf, buflen));
-}
-
-#ifdef BIND_UPDATE
-int
-res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
- if (__res_maybe_init (&_res, 1) == -1) {
- RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
- return (-1);
- }
-
- return (res_nmkupdate(&_res, rrecp_in, buf, buflen));
-}
-#endif
-
-int
-res_query(const char *name, /* domain name */
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen) /* size of answer buffer */
-{
- if (__res_maybe_init (&_res, 1) == -1) {
- RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
- return (-1);
- }
- return (res_nquery(&_res, name, class, type, answer, anslen));
-}
-
-void
-res_send_setqhook(res_send_qhook hook) {
- _res.qhook = hook;
-}
-
-void
-res_send_setrhook(res_send_rhook hook) {
- _res.rhook = hook;
-}
-
-int
-res_isourserver(const struct sockaddr_in *inp) {
- return (res_ourserver_p(&_res, (const struct sockaddr_in6 *) inp));
-}
-
-int
-res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
- if (__res_maybe_init (&_res, 1) == -1) {
- /* errno should have been set by res_init() in this case. */
- return (-1);
- }
-
- return (res_nsend(&_res, buf, buflen, ans, anssiz));
-}
-
-#ifndef _LIBC
-int
-res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key,
- u_char *ans, int anssiz)
-{
- if (__res_maybe_init (&_res, 1) == -1) {
- /* errno should have been set by res_init() in this case. */
- return (-1);
- }
-
- return (res_nsendsigned(&_res, buf, buflen, key, ans, anssiz));
-}
-#endif
-
-void
-res_close(void) {
-#ifdef _LIBC
- /*
- * Some stupid programs out there call res_close() before res_init().
- * Since _res._vcsock isn't explicitly initialized, these means that
- * we could do a close(0), which might lead to some security problems.
- * Therefore we check if res_init() was called before by looking at
- * the RES_INIT bit in _res.options. If it hasn't been set we bail out
- * early. */
- if ((_res.options & RES_INIT) == 0)
- return;
-#endif
- res_nclose(&_res);
-}
-
-#ifdef BIND_UPDATE
-int
-res_update(ns_updrec *rrecp_in) {
- if (__res_maybe_init (&_res, 1) == -1) {
- RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
- return (-1);
- }
-
- return (res_nupdate(&_res, rrecp_in, NULL));
-}
-#endif
-
-int
-res_search(const char *name, /* domain name */
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen) /* size of answer */
-{
- if (__res_maybe_init (&_res, 1) == -1) {
- RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
- return (-1);
- }
-
- return (res_nsearch(&_res, name, class, type, answer, anslen));
-}
-
-int
-res_querydomain(const char *name,
- const char *domain,
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen) /* size of answer */
-{
- if (__res_maybe_init (&_res, 1) == -1) {
- RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
- return (-1);
- }
-
- return (res_nquerydomain(&_res, name, domain,
- class, type,
- answer, anslen));
-}
-
-const char *
-hostalias(const char *name) {
- static char abuf[MAXDNAME];
-
- return (res_hostalias(&_res, name, abuf, sizeof abuf));
-}
-libresolv_hidden_def (hostalias)
-
-#ifdef ultrix
-int
-local_hostname_length(const char *hostname) {
- int len_host, len_domain;
-
- if (!*_res.defdname)
- res_init();
- len_host = strlen(hostname);
- len_domain = strlen(_res.defdname);
- if (len_host > len_domain &&
- !strcasecmp(hostname + len_host - len_domain, _res.defdname) &&
- hostname[len_host - len_domain - 1] == '.')
- return (len_host - len_domain - 1);
- return (0);
-}
-#endif /*ultrix*/
-
-#endif
-
-
-#include <shlib-compat.h>
-
-#if SHLIB_COMPAT(libresolv, GLIBC_2_0, GLIBC_2_2)
-# undef res_mkquery
-# undef res_query
-# undef res_querydomain
-# undef res_search
-weak_alias (__res_mkquery, res_mkquery);
-weak_alias (__res_query, res_query);
-weak_alias (__res_querydomain, res_querydomain);
-weak_alias (__res_search, res_search);
-#endif
diff --git a/newlib/libc/sys/linux/net/res_debug.c b/newlib/libc/sys/linux/net/res_debug.c
index cd50fe546..786f633f4 100644
--- a/newlib/libc/sys/linux/net/res_debug.c
+++ b/newlib/libc/sys/linux/net/res_debug.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1985
* 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:
@@ -10,10 +10,14 @@
* 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
@@ -29,14 +33,14 @@
/*
* 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
@@ -73,7 +77,7 @@
*/
/*
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -90,9 +94,10 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$BINDId: res_debug.c,v 8.34 2000/02/29 05:30:55 vixie Exp $";
+static char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -111,24 +116,23 @@ static const char rcsid[] = "$BINDId: res_debug.c,v 8.34 2000/02/29 05:30:55 vix
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include "local.h"
-#ifdef SPRINTF_CHAR
-# define SPRINTF(x) strlen(sprintf/**/x)
-#else
-# define SPRINTF(x) sprintf x
-#endif
+#define SPRINTF(x) sprintf x
-extern const char *_res_sectioncodes[] attribute_hidden;
+extern const char *_res_opcodes[];
+extern const char *_res_resultcodes[];
+extern const char *_res_sectioncodes[];
/*
* Print the current options.
*/
void
-fp_resstat(const res_state statp, FILE *file) {
+fp_resstat(struct __res_state *statp, FILE *file) {
u_long mask;
fprintf(file, ";; res options:");
+ if (!statp)
+ statp = &_res;
for (mask = 1; mask != 0; mask <<= 1)
if (statp->options & mask)
fprintf(file, " %s", p_option(mask));
@@ -136,30 +140,20 @@ fp_resstat(const res_state statp, FILE *file) {
}
static void
-do_section(const res_state statp,
- ns_msg *handle, ns_sect section,
- int pflag, FILE *file)
-{
+do_section(ns_msg *handle, ns_sect section, int pflag, FILE *file) {
int n, sflag, rrnum;
- static int buflen = 2048;
- char *buf;
+ char buf[2048]; /* XXX need to malloc */
ns_opcode opcode;
ns_rr rr;
/*
* Print answer records.
*/
- sflag = (statp->pfcode & pflag);
- if (statp->pfcode && !sflag)
+ sflag = (_res.pfcode & pflag);
+ if (_res.pfcode && !sflag)
return;
- buf = malloc(buflen);
- if (buf == NULL) {
- fprintf(file, ";; memory allocation failure\n");
- return;
- }
-
- opcode = (ns_opcode) ns_msg_getflag(*handle, ns_f_opcode);
+ opcode = ns_msg_getflag(*handle, ns_f_opcode);
rrnum = 0;
for (;;) {
if (ns_parserr(handle, section, rrnum, &rr)) {
@@ -167,11 +161,11 @@ do_section(const res_state statp,
fprintf(file, ";; ns_parserr: %s\n",
strerror(errno));
else if (rrnum > 0 && sflag != 0 &&
- (statp->pfcode & RES_PRF_HEAD1))
+ (_res.pfcode & RES_PRF_HEAD1))
putc('\n', file);
- goto cleanup;
+ return;
}
- if (rrnum == 0 && sflag != 0 && (statp->pfcode & RES_PRF_HEAD1))
+ if (rrnum == 0 && sflag != 0 && (_res.pfcode & RES_PRF_HEAD1))
fprintf(file, ";; %s SECTION:\n",
p_section(section, opcode));
if (section == ns_s_qd)
@@ -181,32 +175,27 @@ do_section(const res_state statp,
p_class(ns_rr_class(rr)));
else {
n = ns_sprintrr(handle, &rr, NULL, NULL,
- buf, buflen);
+ buf, sizeof buf);
if (n < 0) {
- if (errno == ENOSPC) {
- free(buf);
- buf = NULL;
- if (buflen < 131072)
- buf = malloc(buflen += 1024);
- if (buf == NULL) {
- fprintf(file,
- ";; memory allocation failure\n");
- return;
- }
- continue;
- }
fprintf(file, ";; ns_sprintrr: %s\n",
strerror(errno));
- goto cleanup;
+ return;
}
fputs(buf, file);
fputc('\n', file);
}
rrnum++;
}
- cleanup:
- if (buf != NULL)
- free(buf);
+}
+
+void
+p_query(const u_char *msg) {
+ fp_query(msg, stdout);
+}
+
+void
+fp_query(const u_char *msg, FILE *file) {
+ fp_nquery(msg, PACKETSZ, file);
}
/*
@@ -214,11 +203,14 @@ do_section(const res_state statp,
* This is intended to be primarily a debugging routine.
*/
void
-res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
+fp_nquery(const u_char *msg, int len, FILE *file) {
ns_msg handle;
int qdcount, ancount, nscount, arcount;
u_int opcode, rcode, id;
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1)
+ return;
+
if (ns_initparse(msg, len, &handle) < 0) {
fprintf(file, ";; ns_initparse: %s\n", strerror(errno));
return;
@@ -234,13 +226,13 @@ res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
/*
* Print header fields.
*/
- if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX) || rcode)
+ if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX) || rcode)
fprintf(file,
";; ->>HEADER<<- opcode: %s, status: %s, id: %d\n",
- _res_opcodes[opcode], p_rcode(rcode), id);
- if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEADX))
+ _res_opcodes[opcode], _res_resultcodes[rcode], id);
+ if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX))
putc(';', file);
- if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD2)) {
+ if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD2)) {
fprintf(file, "; flags:");
if (ns_msg_getflag(handle, ns_f_qr))
fprintf(file, " qr");
@@ -259,7 +251,7 @@ res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
if (ns_msg_getflag(handle, ns_f_cd))
fprintf(file, " cd");
}
- if ((!statp->pfcode) || (statp->pfcode & RES_PRF_HEAD1)) {
+ if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD1)) {
fprintf(file, "; %s: %d",
p_section(ns_s_qd, opcode), qdcount);
fprintf(file, ", %s: %d",
@@ -269,17 +261,17 @@ res_pquery(const res_state statp, const u_char *msg, int len, FILE *file) {
fprintf(file, ", %s: %d",
p_section(ns_s_ar, opcode), arcount);
}
- if ((!statp->pfcode) || (statp->pfcode &
+ if ((!_res.pfcode) || (_res.pfcode &
(RES_PRF_HEADX | RES_PRF_HEAD2 | RES_PRF_HEAD1))) {
putc('\n',file);
}
/*
* Print the various sections.
*/
- do_section(statp, &handle, ns_s_qd, RES_PRF_QUES, file);
- do_section(statp, &handle, ns_s_an, RES_PRF_ANS, file);
- do_section(statp, &handle, ns_s_ns, RES_PRF_AUTH, file);
- do_section(statp, &handle, ns_s_ar, RES_PRF_ADD, file);
+ do_section(&handle, ns_s_qd, RES_PRF_QUES, file);
+ do_section(&handle, ns_s_an, RES_PRF_ANS, file);
+ do_section(&handle, ns_s_ns, RES_PRF_AUTH, file);
+ do_section(&handle, ns_s_ar, RES_PRF_ADD, file);
if (qdcount == 0 && ancount == 0 &&
nscount == 0 && arcount == 0)
putc('\n', file);
@@ -298,7 +290,6 @@ p_cdnname(const u_char *cp, const u_char *msg, int len, FILE *file) {
fputs(name, file);
return (cp + n);
}
-libresolv_hidden_def (p_cdnname)
const u_char *
p_cdname(const u_char *cp, const u_char *msg, FILE *file) {
@@ -328,7 +319,6 @@ p_fqnname(cp, msg, msglen, name, namelen)
}
return (cp + n);
}
-libresolv_hidden_def (p_fqnname)
/* XXX: the rest of these functions need to become length-limited, too. */
@@ -349,8 +339,6 @@ p_fqname(const u_char *cp, const u_char *msg, FILE *file) {
* that C_ANY is a qclass but not a class. (You can ask for records of class
* C_ANY, but you can't have any records of that class in the database.)
*/
-extern const struct res_sym __p_class_syms[];
-libresolv_hidden_proto (__p_class_syms)
const struct res_sym __p_class_syms[] = {
{C_IN, "IN"},
{C_CHAOS, "CHAOS"},
@@ -360,12 +348,11 @@ const struct res_sym __p_class_syms[] = {
{C_NONE, "NONE"},
{C_IN, (char *)0}
};
-libresolv_hidden_data_def (__p_class_syms)
/*
* Names of message sections.
*/
-const struct res_sym __p_default_section_syms[] attribute_hidden = {
+const struct res_sym __p_default_section_syms[] = {
{ns_s_qd, "QUERY"},
{ns_s_an, "ANSWER"},
{ns_s_ns, "AUTHORITY"},
@@ -373,7 +360,7 @@ const struct res_sym __p_default_section_syms[] attribute_hidden = {
{0, (char *)0}
};
-const struct res_sym __p_update_section_syms[] attribute_hidden = {
+const struct res_sym __p_update_section_syms[] = {
{S_ZONE, "ZONE"},
{S_PREREQ, "PREREQUISITE"},
{S_UPDATE, "UPDATE"},
@@ -381,101 +368,54 @@ const struct res_sym __p_update_section_syms[] attribute_hidden = {
{0, (char *)0}
};
-const struct res_sym __p_key_syms[] attribute_hidden = {
- {NS_ALG_MD5RSA, "RSA", "RSA KEY with MD5 hash"},
- {NS_ALG_DH, "DH", "Diffie Hellman"},
- {NS_ALG_DSA, "DSA", "Digital Signature Algorithm"},
- {NS_ALG_EXPIRE_ONLY, "EXPIREONLY", "No algorithm"},
- {NS_ALG_PRIVATE_OID, "PRIVATE", "Algorithm obtained from OID"},
- {0, NULL, NULL}
-};
-
-const struct res_sym __p_cert_syms[] attribute_hidden = {
- {cert_t_pkix, "PKIX", "PKIX (X.509v3) Certificate"},
- {cert_t_spki, "SPKI", "SPKI certificate"},
- {cert_t_pgp, "PGP", "PGP certificate"},
- {cert_t_url, "URL", "URL Private"},
- {cert_t_oid, "OID", "OID Private"},
- {0, NULL, NULL}
-};
-
/*
* Names of RR types and qtypes. Types and qtypes are the same, except
* that T_ANY is a qtype but not a type. (You can ask for records of type
* T_ANY, but you can't have any records of that type in the database.)
*/
-extern const struct res_sym __p_type_syms[];
-libresolv_hidden_proto (__p_type_syms)
const struct res_sym __p_type_syms[] = {
- {ns_t_a, "A", "address"},
- {ns_t_ns, "NS", "name server"},
- {ns_t_md, "MD", "mail destination (deprecated)"},
- {ns_t_mf, "MF", "mail forwarder (deprecated)"},
- {ns_t_cname, "CNAME", "canonical name"},
- {ns_t_soa, "SOA", "start of authority"},
- {ns_t_mb, "MB", "mailbox"},
- {ns_t_mg, "MG", "mail group member"},
- {ns_t_mr, "MR", "mail rename"},
- {ns_t_null, "NULL", "null"},
- {ns_t_wks, "WKS", "well-known service (deprecated)"},
- {ns_t_ptr, "PTR", "domain name pointer"},
- {ns_t_hinfo, "HINFO", "host information"},
- {ns_t_minfo, "MINFO", "mailbox information"},
- {ns_t_mx, "MX", "mail exchanger"},
- {ns_t_txt, "TXT", "text"},
- {ns_t_rp, "RP", "responsible person"},
- {ns_t_afsdb, "AFSDB", "DCE or AFS server"},
- {ns_t_x25, "X25", "X25 address"},
- {ns_t_isdn, "ISDN", "ISDN address"},
- {ns_t_rt, "RT", "router"},
- {ns_t_nsap, "NSAP", "nsap address"},
- {ns_t_nsap_ptr, "NSAP_PTR", "domain name pointer"},
- {ns_t_sig, "SIG", "signature"},
- {ns_t_key, "KEY", "key"},
- {ns_t_px, "PX", "mapping information"},
- {ns_t_gpos, "GPOS", "geographical position (withdrawn)"},
- {ns_t_aaaa, "AAAA", "IPv6 address"},
- {ns_t_loc, "LOC", "location"},
- {ns_t_nxt, "NXT", "next valid name (unimplemented)"},
- {ns_t_eid, "EID", "endpoint identifier (unimplemented)"},
- {ns_t_nimloc, "NIMLOC", "NIMROD locator (unimplemented)"},
- {ns_t_srv, "SRV", "server selection"},
- {ns_t_atma, "ATMA", "ATM address (unimplemented)"},
- {ns_t_tsig, "TSIG", "transaction signature"},
- {ns_t_ixfr, "IXFR", "incremental zone transfer"},
- {ns_t_axfr, "AXFR", "zone transfer"},
- {ns_t_zxfr, "ZXFR", "compressed zone transfer"},
- {ns_t_mailb, "MAILB", "mailbox-related data (deprecated)"},
- {ns_t_maila, "MAILA", "mail agent (deprecated)"},
- {ns_t_naptr, "NAPTR", "URN Naming Authority"},
- {ns_t_kx, "KX", "Key Exchange"},
- {ns_t_cert, "CERT", "Certificate"},
- {ns_t_any, "ANY", "\"any\""},
+ {T_A, "A", "address"},
+ {T_NS, "NS", "name server"},
+ {T_MD, "MD", "mail destination (deprecated)"},
+ {T_MF, "MF", "mail forwarder (deprecated)"},
+ {T_CNAME, "CNAME", "canonical name"},
+ {T_SOA, "SOA", "start of authority"},
+ {T_MB, "MB", "mailbox"},
+ {T_MG, "MG", "mail group member"},
+ {T_MR, "MR", "mail rename"},
+ {T_NULL, "NULL", "null"},
+ {T_WKS, "WKS", "well-known service (deprecated)"},
+ {T_PTR, "PTR", "domain name pointer"},
+ {T_HINFO, "HINFO", "host information"},
+ {T_MINFO, "MINFO", "mailbox information"},
+ {T_MX, "MX", "mail exchanger"},
+ {T_TXT, "TXT", "text"},
+ {T_RP, "RP", "responsible person"},
+ {T_AFSDB, "AFSDB", "DCE or AFS server"},
+ {T_X25, "X25", "X25 address"},
+ {T_ISDN, "ISDN", "ISDN address"},
+ {T_RT, "RT", "router"},
+ {T_NSAP, "NSAP", "nsap address"},
+ {T_NSAP_PTR, "NSAP_PTR", "domain name pointer"},
+ {T_SIG, "SIG", "signature"},
+ {T_KEY, "KEY", "key"},
+ {T_PX, "PX", "mapping information"},
+ {T_GPOS, "GPOS", "geographical position (withdrawn)"},
+ {T_AAAA, "AAAA", "IPv6 address"},
+ {T_LOC, "LOC", "location"},
+ {T_NXT, "NXT", "next valid name (unimplemented)"},
+ {T_EID, "EID", "endpoint identifier (unimplemented)"},
+ {T_NIMLOC, "NIMLOC", "NIMROD locator (unimplemented)"},
+ {T_SRV, "SRV", "server selection"},
+ {T_ATMA, "ATMA", "ATM address (unimplemented)"},
+ {T_IXFR, "IXFR", "incremental zone transfer"},
+ {T_AXFR, "AXFR", "zone transfer"},
+ {T_MAILB, "MAILB", "mailbox-related data (deprecated)"},
+ {T_MAILA, "MAILA", "mail agent (deprecated)"},
+ {T_NAPTR, "NAPTR", "URN Naming Authority"},
+ {T_ANY, "ANY", "\"any\""},
{0, NULL, NULL}
};
-libresolv_hidden_data_def (__p_type_syms)
-
-/*
- * Names of DNS rcodes.
- */
-const struct res_sym __p_rcode_syms[] attribute_hidden = {
- {ns_r_noerror, "NOERROR", "no error"},
- {ns_r_formerr, "FORMERR", "format error"},
- {ns_r_servfail, "SERVFAIL", "server failed"},
- {ns_r_nxdomain, "NXDOMAIN", "no such domain name"},
- {ns_r_notimpl, "NOTIMP", "not implemented"},
- {ns_r_refused, "REFUSED", "refused"},
- {ns_r_yxdomain, "YXDOMAIN", "domain name exists"},
- {ns_r_yxrrset, "YXRRSET", "rrset exists"},
- {ns_r_nxrrset, "NXRRSET", "rrset doesn't exist"},
- {ns_r_notauth, "NOTAUTH", "not authoritative"},
- {ns_r_notzone, "NOTZONE", "Not in zone"},
- {ns_r_max, "", ""},
- {ns_r_badsig, "BADSIG", "bad signature"},
- {ns_r_badkey, "BADKEY", "bad key"},
- {ns_r_badtime, "BADTIME", "bad time"},
- {0, NULL, NULL}
-};
int
sym_ston(const struct res_sym *syms, const char *name, int *success) {
@@ -503,12 +443,11 @@ sym_ntos(const struct res_sym *syms, int number, int *success) {
}
}
- sprintf(unname, "%d", number); /* XXX nonreentrant */
+ sprintf(unname, "%d", number);
if (success)
*success = 0;
return (unname);
}
-libresolv_hidden_def (sym_ntos)
const char *
sym_ntop(const struct res_sym *syms, int number, int *success) {
@@ -521,7 +460,7 @@ sym_ntop(const struct res_sym *syms, int number, int *success) {
return (syms->humanname);
}
}
- sprintf(unname, "%d", number); /* XXX nonreentrant */
+ sprintf(unname, "%d", number);
if (success)
*success = 0;
return (unname);
@@ -534,7 +473,6 @@ const char *
p_type(int type) {
return (sym_ntos(__p_type_syms, type, (int *)0));
}
-libresolv_hidden_def (p_type)
/*
* Return a string for the type.
@@ -561,7 +499,6 @@ const char *
p_class(int class) {
return (sym_ntos(__p_class_syms, class, (int *)0));
}
-libresolv_hidden_def (p_class)
/*
* Return a mnemonic for an option
@@ -583,37 +520,27 @@ p_option(u_long option) {
case RES_DNSRCH: return "dnsrch";
case RES_INSECURE1: return "insecure1";
case RES_INSECURE2: return "insecure2";
+ case RES_NOALIASES: return "noaliases";
case RES_USE_INET6: return "inet6";
- case RES_ROTATE: return "rotate";
- case RES_NOCHECKNAME: return "no-check-names";
- case RES_USEBSTRING: return "ip6-bytstring";
- /* XXX nonreentrant */
+ case RES_NOTLDQUERY: return "no-tld-query";
+ case RES_USE_EDNS0: return "edns0";
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
return (nbuf);
}
}
-libresolv_hidden_def (p_option)
/*
* Return a mnemonic for a time to live.
*/
const char *
p_time(u_int32_t value) {
- static char nbuf[40]; /* XXX nonreentrant */
+ static char nbuf[40];
if (ns_format_ttl(value, nbuf, sizeof nbuf) < 0)
sprintf(nbuf, "%u", value);
return (nbuf);
}
-/*
- * Return a string for the rcode.
- */
-const char *
-p_rcode(int rcode) {
- return (sym_ntos(__p_rcode_syms, rcode, (int *)0));
-}
-libresolv_hidden_def (p_rcode)
/*
* routines to convert between on-the-wire RR format and zone file format.
@@ -621,16 +548,15 @@ libresolv_hidden_def (p_rcode)
* by 60*60*1000 for that.
*/
-static const unsigned int poweroften[10]=
- { 1, 10, 100, 1000, 10000, 100000,
- 1000000,10000000,100000000,1000000000};
+static unsigned int poweroften[10] = {1, 10, 100, 1000, 10000, 100000,
+ 1000000,10000000,100000000,1000000000};
/* takes an XeY precision/size value, returns a string representation. */
static const char *
precsize_ntoa(prec)
u_int8_t prec;
{
- static char retbuf[sizeof "90000000.00"]; /* XXX nonreentrant */
+ static char retbuf[sizeof "90000000.00"];
unsigned long val;
int mantissa, exponent;
@@ -646,24 +572,24 @@ precsize_ntoa(prec)
/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
static u_int8_t
precsize_aton(strptr)
- const char **strptr;
+ char **strptr;
{
unsigned int mval = 0, cmval = 0;
u_int8_t retval = 0;
- const char *cp;
+ char *cp;
int exponent;
int mantissa;
cp = *strptr;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
mval = mval * 10 + (*cp++ - '0');
if (*cp == '.') { /* centimeters */
cp++;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
cmval = (*cp++ - '0') * 10;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
cmval += (*cp++ - '0');
}
}
@@ -688,53 +614,53 @@ precsize_aton(strptr)
/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
static u_int32_t
latlon2ul(latlonstrptr,which)
- const char **latlonstrptr;
+ char **latlonstrptr;
int *which;
{
- const char *cp;
+ char *cp;
u_int32_t retval;
int deg = 0, min = 0, secs = 0, secsfrac = 0;
cp = *latlonstrptr;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
deg = deg * 10 + (*cp++ - '0');
- while (isspace(*cp))
+ while (isspace((unsigned char)*cp))
cp++;
- if (!(isdigit(*cp)))
+ if (!(isdigit((unsigned char)*cp)))
goto fndhemi;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
min = min * 10 + (*cp++ - '0');
- while (isspace(*cp))
+ while (isspace((unsigned char)*cp))
cp++;
- if (!(isdigit(*cp)))
+ if (!(isdigit((unsigned char)*cp)))
goto fndhemi;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
secs = secs * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal seconds */
cp++;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
secsfrac = (*cp++ - '0') * 100;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
secsfrac += (*cp++ - '0') * 10;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
secsfrac += (*cp++ - '0');
}
}
}
}
- while (!isspace(*cp)) /* if any trailing garbage */
+ while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
cp++;
- while (isspace(*cp))
+ while (isspace((unsigned char)*cp))
cp++;
fndhemi:
@@ -772,10 +698,10 @@ latlon2ul(latlonstrptr,which)
cp++; /* skip the hemisphere */
- while (!isspace(*cp)) /* if any trailing garbage */
+ while (!isspace((unsigned char)*cp)) /* if any trailing garbage */
cp++;
- while (isspace(*cp)) /* move to next field */
+ while (isspace((unsigned char)*cp)) /* move to next field */
cp++;
*latlonstrptr = cp;
@@ -829,18 +755,18 @@ loc_aton(ascii, binary)
altsign = -1;
cp++;
}
-
+
if (*cp == '+')
cp++;
- while (isdigit(*cp))
+ while (isdigit((unsigned char)*cp))
altmeters = altmeters * 10 + (*cp++ - '0');
if (*cp == '.') { /* decimal meters */
cp++;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
altfrac = (*cp++ - '0') * 10;
- if (isdigit(*cp)) {
+ if (isdigit((unsigned char)*cp)) {
altfrac += (*cp++ - '0');
}
}
@@ -848,21 +774,21 @@ loc_aton(ascii, binary)
alt = (10000000 + (altsign * (altmeters * 100 + altfrac)));
- while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
- while (isspace(*cp) && (cp < maxcp))
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
if (cp >= maxcp)
goto defaults;
siz = precsize_aton(&cp);
-
- while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
- while (isspace(*cp) && (cp < maxcp))
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
if (cp >= maxcp)
@@ -870,10 +796,10 @@ loc_aton(ascii, binary)
hp = precsize_aton(&cp);
- while (!isspace(*cp) && (cp < maxcp)) /* if trailing garbage or m */
+ while (!isspace((unsigned char)*cp) && (cp < maxcp)) /* if trailing garbage or m */
cp++;
- while (isspace(*cp) && (cp < maxcp))
+ while (isspace((unsigned char)*cp) && (cp < maxcp))
cp++;
if (cp >= maxcp)
@@ -891,7 +817,7 @@ loc_aton(ascii, binary)
PUTLONG(latit,bcp);
PUTLONG(longit,bcp);
PUTLONG(alt,bcp);
-
+
return (16); /* size of RR in octets */
}
@@ -902,8 +828,6 @@ loc_ntoa(binary, ascii)
char *ascii;
{
static char *error = "?";
- static char tmpbuf[sizeof
-"1000 60 60.000 N 1000 60 60.000 W -12345678.00m 90000000.00m 90000000.00m 90000000.00m"];
const u_char *cp = binary;
int latdeg, latmin, latsec, latsecfrac;
@@ -916,13 +840,12 @@ loc_ntoa(binary, ascii)
int32_t latval, longval, altval;
u_int32_t templ;
u_int8_t sizeval, hpval, vpval, versionval;
-
+
char *sizestr, *hpstr, *vpstr;
- versionval = *cp++;
+ size_t len;
- if (ascii == NULL)
- ascii = tmpbuf;
+ versionval = *cp++;
if (versionval) {
(void) sprintf(ascii, "; error: unknown LOC RR version");
@@ -980,12 +903,21 @@ loc_ntoa(binary, ascii)
altfrac = altval % 100;
altmeters = (altval / 100) * altsign;
- if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL)
+ len = strlen (precsize_ntoa(sizeval)) + 1;
+ if ((sizestr = malloc(len)) == NULL)
sizestr = error;
- if ((hpstr = strdup(precsize_ntoa(hpval))) == NULL)
+ else
+ memcpy (sizestr, precsize_ntoa(sizeval), len);
+ len = strlen (precsize_ntoa(hpval)) + 1;
+ if ((hpstr = malloc (len)) == NULL)
hpstr = error;
- if ((vpstr = strdup(precsize_ntoa(vpval))) == NULL)
+ else
+ memcpy (hpstr, precsize_ntoa(hpval), len);
+ len = strlen (precsize_ntoa(vpval)) + 1;
+ if ((vpstr = malloc (len)) == NULL)
vpstr = error;
+ else
+ memcpy (vpstr, precsize_ntoa(vpval), len);
sprintf(ascii,
"%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm",
@@ -1002,7 +934,6 @@ loc_ntoa(binary, ascii)
return (ascii);
}
-libresolv_hidden_def (loc_ntoa)
/* Return the number of DNS hierarchy levels in the name. */
@@ -1031,24 +962,17 @@ dn_count_labels(const char *name) {
}
-/*
- * Make dates expressed in seconds-since-Jan-1-1970 easy to read.
+/*
+ * Make dates expressed in seconds-since-Jan-1-1970 easy to read.
* SIG records are required to be printed like this, by the Secure DNS RFC.
*/
char *
p_secstodate (u_long secs) {
- /* XXX nonreentrant */
static char output[15]; /* YYYYMMDDHHMMSS and null */
time_t clock = secs;
struct tm *time;
-
-#ifdef HAVE_TIME_R
- struct tm timebuf;
-
- time = gmtime_r(&clock, &timebuf);
-#else
+
time = gmtime(&clock);
-#endif
time->tm_year += 1900;
time->tm_mon += 1;
sprintf(output, "%04d%02d%02d%02d%02d%02d",
@@ -1056,3 +980,24 @@ p_secstodate (u_long secs) {
time->tm_hour, time->tm_min, time->tm_sec);
return (output);
}
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <resolv.h>.
+ */
+#undef fp_resstat
+__weak_reference(__fp_resstat, fp_resstat);
+#undef p_query
+__weak_reference(__p_query, p_query);
+#undef p_fqnname
+__weak_reference(__p_fqnname, p_fqnname);
+#undef sym_ston
+__weak_reference(__sym_ston, sym_ston);
+#undef sym_ntos
+__weak_reference(__sym_ntos, sym_ntos);
+#undef sym_ntop
+__weak_reference(__sym_ntop, sym_ntop);
+#undef dn_count_labels
+__weak_reference(__dn_count_labels, dn_count_labels);
+#undef p_secstodate
+__weak_reference(__p_secstodate, p_secstodate);
diff --git a/newlib/libc/sys/linux/net/res_debug.h b/newlib/libc/sys/linux/net/res_debug.h
deleted file mode 100644
index 4a0aa99ab..000000000
--- a/newlib/libc/sys/linux/net/res_debug.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 1999 by Internet Software Consortium.
- *
- * 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.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#ifndef _RES_DEBUG_H_
-#define _RES_DEBUG_H_
-
-#ifndef DEBUG
-# define Dprint(cond, args) /*empty*/
-# define DprintQ(cond, args, query, size) /*empty*/
-# define Aerror(statp, file, string, error, address) /*empty*/
-# define Perror(statp, file, string, error) /*empty*/
-#else
-# define Dprint(cond, args) if (cond) {fprintf args;} else {}
-# define DprintQ(cond, args, query, size) if (cond) {\
- fprintf args;\
- res_pquery(statp, query, size, stdout);\
- } else {}
-#endif
-
-#endif /* _RES_DEBUG_H_ */
diff --git a/newlib/libc/sys/linux/net/res_hconf.c b/newlib/libc/sys/linux/net/res_hconf.c
deleted file mode 100644
index ad1594040..000000000
--- a/newlib/libc/sys/linux/net/res_hconf.c
+++ /dev/null
@@ -1,676 +0,0 @@
-/* Copyright (C) 1993, 1995-2003, 2004 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by David Mosberger (davidm@azstarnet.com).
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-/* This file provides a Linux /etc/host.conf compatible front end to
- the various name resolvers (/etc/hosts, named, NIS server, etc.).
- Though mostly compatibly, the following differences exist compared
- to the original implementation:
-
- - new command "spoof" takes an arguments like RESOLV_SPOOF_CHECK
- environment variable (i.e., `off', `nowarn', or `warn').
-
- - line comments can appear anywhere (not just at the beginning of
- a line)
-*/
-
-#include <assert.h>
-#include <errno.h>
-#include <ctype.h>
-#include <libintl.h>
-#include <memory.h>
-#include <stdio.h>
-#include <stdio_ext.h>
-#include <stdlib.h>
-#include <string.h>
-#include <net/if.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#define _IO_MTSAFE_IO
-#include <bits/libc-lock.h>
-#include "ifreq.h"
-#include "res_hconf.h"
-#include "local.h"
-#ifdef USE_IN_LIBIO
-# include <wchar.h>
-#endif
-
-#define _PATH_HOSTCONF "/etc/host.conf"
-
-/* Environment vars that all user to override default behavior: */
-#define ENV_HOSTCONF "RESOLV_HOST_CONF"
-#define ENV_SERVORDER "RESOLV_SERV_ORDER"
-#define ENV_SPOOF "RESOLV_SPOOF_CHECK"
-#define ENV_TRIM_OVERR "RESOLV_OVERRIDE_TRIM_DOMAINS"
-#define ENV_TRIM_ADD "RESOLV_ADD_TRIM_DOMAINS"
-#define ENV_MULTI "RESOLV_MULTI"
-#define ENV_REORDER "RESOLV_REORDER"
-
-static const char *arg_service_list (const char *, int, const char *,
- unsigned int);
-static const char *arg_trimdomain_list (const char *, int, const char *,
- unsigned int);
-static const char *arg_spoof (const char *, int, const char *, unsigned int);
-static const char *arg_bool (const char *, int, const char *, unsigned int);
-
-static struct cmd
-{
- const char *name;
- const char *(*parse_args) (const char * filename, int line_num,
- const char * args, unsigned int arg);
- unsigned int arg;
-} cmd[] =
-{
- {"order", arg_service_list, 0},
- {"trim", arg_trimdomain_list, 0},
- {"spoof", arg_spoof, 0},
- {"multi", arg_bool, HCONF_FLAG_MULTI},
- {"nospoof", arg_bool, HCONF_FLAG_SPOOF},
- {"spoofalert", arg_bool, HCONF_FLAG_SPOOFALERT},
- {"reorder", arg_bool, HCONF_FLAG_REORDER}
-};
-
-/* Structure containing the state. */
-struct hconf _res_hconf;
-
-/* Skip white space. */
-static const char *
-skip_ws (const char *str)
-{
- while (isspace (*str)) ++str;
- return str;
-}
-
-
-/* Skip until whitespace, comma, end of line, or comment character. */
-static const char *
-skip_string (const char *str)
-{
- while (*str && !isspace (*str) && *str != '#' && *str != ',')
- ++str;
- return str;
-}
-
-
-static const char *
-arg_service_list (const char *fname, int line_num, const char *args,
- unsigned int arg)
-{
- enum Name_Service service;
- const char *start;
- size_t len;
- size_t i;
- static struct
- {
- const char * name;
- enum Name_Service service;
- } svcs[] =
- {
- {"bind", SERVICE_BIND},
- {"hosts", SERVICE_HOSTS},
- {"nis", SERVICE_NIS},
- };
-
- do
- {
- start = args;
- args = skip_string (args);
- len = args - start;
-
- service = SERVICE_NONE;
- for (i = 0; i < sizeof (svcs) / sizeof (svcs[0]); ++i)
- {
- if (strncasecmp (start, svcs[i].name, len) == 0
- && len == strlen (svcs[i].name))
- {
- service = svcs[i].service;
- break;
- }
- }
- if (service == SERVICE_NONE)
- {
- char *buf;
-
- if (asprintf (&buf,
- _("%s: line %d: expected service, found `%s'\n"),
- fname, line_num, start) < 0)
- return 0;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- return 0;
- }
- if (_res_hconf.num_services >= SERVICE_MAX)
- {
- char *buf;
-
- if (asprintf (&buf, _("\
-%s: line %d: cannot specify more than %d services"),
- fname, line_num, SERVICE_MAX) < 0)
- return 0;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- return 0;
- }
- _res_hconf.service[_res_hconf.num_services++] = service;
-
- args = skip_ws (args);
- switch (*args)
- {
- case ',':
- case ';':
- case ':':
- args = skip_ws (++args);
- if (!*args || *args == '#')
- {
- char *buf;
-
- if (asprintf (&buf, _("\
-%s: line %d: list delimiter not followed by keyword"),
- fname, line_num) < 0)
- return 0;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- return 0;
- }
- default:
- break;
- }
- }
- while (*args && *args != '#');
- return args;
-}
-
-
-static const char *
-arg_trimdomain_list (const char *fname, int line_num, const char *args,
- unsigned int flag)
-{
- const char * start;
- size_t len;
-
- do
- {
- start = args;
- args = skip_string (args);
- len = args - start;
-
- if (_res_hconf.num_trimdomains >= TRIMDOMAINS_MAX)
- {
- char *buf;
-
- if (asprintf (&buf, _("\
-%s: line %d: cannot specify more than %d trim domains"),
- fname, line_num, TRIMDOMAINS_MAX) < 0)
- return 0;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- return 0;
- }
- _res_hconf.trimdomain[_res_hconf.num_trimdomains++] =
- strndup (start, len);
- args = skip_ws (args);
- switch (*args)
- {
- case ',': case ';': case ':':
- args = skip_ws (++args);
- if (!*args || *args == '#')
- {
- char *buf;
-
- if (asprintf (&buf, _("\
-%s: line %d: list delimiter not followed by domain"),
- fname, line_num) < 0)
- return 0;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- return 0;
- }
- default:
- break;
- }
- }
- while (*args && *args != '#');
- return args;
-}
-
-
-static const char *
-arg_spoof (const char *fname, int line_num, const char *args, unsigned flag)
-{
- const char *start = args;
- size_t len;
-
- args = skip_string (args);
- len = args - start;
-
- if (len == 3 && strncasecmp (start, "off", len) == 0)
- _res_hconf.flags &= ~(HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT);
- else
- {
- _res_hconf.flags |= (HCONF_FLAG_SPOOF | HCONF_FLAG_SPOOFALERT);
- if ((len == 6 && strncasecmp (start, "nowarn", len) == 0)
- || !(len == 4 && strncasecmp (start, "warn", len) == 0))
- _res_hconf.flags &= ~HCONF_FLAG_SPOOFALERT;
- }
- return args;
-}
-
-
-static const char *
-arg_bool (const char *fname, int line_num, const char *args, unsigned flag)
-{
- if (strncasecmp (args, "on", 2) == 0)
- {
- args += 2;
- _res_hconf.flags |= flag;
- }
- else if (strncasecmp (args, "off", 3) == 0)
- {
- args += 3;
- _res_hconf.flags &= ~flag;
- }
- else
- {
- char *buf;
-
- if (asprintf (&buf,
- _("%s: line %d: expected `on' or `off', found `%s'\n"),
- fname, line_num, args) < 0)
- return 0;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- return 0;
- }
- return args;
-}
-
-
-static void
-parse_line (const char *fname, int line_num, const char *str)
-{
- const char *start;
- struct cmd *c = 0;
- size_t len;
- size_t i;
-
- str = skip_ws (str);
-
- /* skip line comment and empty lines: */
- if (*str == '\0' || *str == '#') return;
-
- start = str;
- str = skip_string (str);
- len = str - start;
-
- for (i = 0; i < sizeof (cmd) / sizeof (cmd[0]); ++i)
- {
- if (strncasecmp (start, cmd[i].name, len) == 0
- && strlen (cmd[i].name) == len)
- {
- c = &cmd[i];
- break;
- }
- }
- if (c == NULL)
- {
- char *buf;
-
- if (asprintf (&buf, _("%s: line %d: bad command `%s'\n"),
- fname, line_num, start) < 0)
- return;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- return;
- }
-
- /* process args: */
- str = skip_ws (str);
- str = (*c->parse_args) (fname, line_num, str, c->arg);
- if (!str)
- return;
-
- /* rest of line must contain white space or comment only: */
- while (*str)
- {
- if (!isspace (*str)) {
- if (*str != '#')
- {
- char *buf;
-
- if (asprintf (&buf,
- _("%s: line %d: ignoring trailing garbage `%s'\n"),
- fname, line_num, str) < 0)
- break;
-
-#ifdef USE_IN_LIBIO
- if (_IO_fwide (stderr, 0) > 0)
- __fwprintf (stderr, L"%s", buf);
- else
-#endif
- fputs (buf, stderr);
-
- free (buf);
- }
- break;
- }
- ++str;
- }
-}
-
-
-static void
-do_init (void)
-{
- const char *hconf_name;
- int line_num = 0;
- char buf[256], *envval;
- FILE *fp;
-
- memset (&_res_hconf, '\0', sizeof (_res_hconf));
-
- hconf_name = getenv (ENV_HOSTCONF);
- if (hconf_name == NULL)
- hconf_name = _PATH_HOSTCONF;
-
- fp = fopen (hconf_name, "rc");
- if (!fp)
- /* make up something reasonable: */
- _res_hconf.service[_res_hconf.num_services++] = SERVICE_BIND;
- else
- {
- /* No threads using this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- while (fgets (buf, sizeof (buf), fp))
- {
- char *tmp;
- ++line_num;
- tmp = strchr (buf, '\n');
- if (tmp != NULL)
- *tmp = '\0';
- parse_line (hconf_name, line_num, buf);
- }
- fclose (fp);
- }
-
- envval = getenv (ENV_SERVORDER);
- if (envval)
- {
- _res_hconf.num_services = 0;
- arg_service_list (ENV_SERVORDER, 1, envval, 0);
- }
-
- envval = getenv (ENV_SPOOF);
- if (envval)
- arg_spoof (ENV_SPOOF, 1, envval, 0);
-
- envval = getenv (ENV_MULTI);
- if (envval)
- arg_bool (ENV_MULTI, 1, envval, HCONF_FLAG_MULTI);
-
- envval = getenv (ENV_REORDER);
- if (envval)
- arg_bool (ENV_REORDER, 1, envval, HCONF_FLAG_REORDER);
-
- envval = getenv (ENV_TRIM_ADD);
- if (envval)
- arg_trimdomain_list (ENV_TRIM_ADD, 1, envval, 0);
-
- envval = getenv (ENV_TRIM_OVERR);
- if (envval)
- {
- _res_hconf.num_trimdomains = 0;
- arg_trimdomain_list (ENV_TRIM_OVERR, 1, envval, 0);
- }
-
- _res_hconf.initialized = 1;
-}
-
-
-/* Initialize hconf datastructure by reading host.conf file and
- environment variables. */
-void
-_res_hconf_init (void)
-{
- __libc_once_define (static, once);
-
- __libc_once (once, do_init);
-}
-
-
-/* List of known interfaces. */
-libc_freeres_ptr (
-static struct netaddr
-{
- int addrtype;
- union
- {
- struct
- {
- u_int32_t addr;
- u_int32_t mask;
- } ipv4;
- } u;
-} *ifaddrs);
-
-/* We need to protect the dynamic buffer handling. */
-__libc_lock_define_initialized (static, lock);
-
-/* Reorder addresses returned in a hostent such that the first address
- is an address on the local subnet, if there is such an address.
- Otherwise, nothing is changed.
-
- Note that this function currently only handles IPv4 addresses. */
-
-void
-_res_hconf_reorder_addrs (struct hostent *hp)
-{
-#if defined SIOCGIFCONF && defined SIOCGIFNETMASK
- int i, j;
- /* Number of interfaces. */
- static int num_ifs = -1;
-
- /* Only reorder if we're supposed to. */
- if ((_res_hconf.flags & HCONF_FLAG_REORDER) == 0)
- return;
-
- /* Can't deal with anything but IPv4 for now... */
- if (hp->h_addrtype != AF_INET)
- return;
-
- if (num_ifs <= 0)
- {
- struct ifreq *ifr, *cur_ifr;
- int sd, num, i;
- /* Save errno. */
- int save = errno;
-
- /* Initialize interface table. */
-
- num_ifs = 0;
-
- /* The SIOCGIFNETMASK ioctl will only work on an AF_INET socket. */
- sd = socket (AF_INET, SOCK_DGRAM, 0);
- if (sd < 0)
- return;
-
- /* Get lock. */
- __libc_lock_lock (lock);
-
- /* Get a list of interfaces. */
- __ifreq (&ifr, &num, sd);
- if (!ifr)
- goto cleanup;
-
- ifaddrs = malloc (num * sizeof (ifaddrs[0]));
- if (!ifaddrs)
- goto cleanup1;
-
- /* Copy usable interfaces in ifaddrs structure. */
- for (cur_ifr = ifr, i = 0; i < num; cur_ifr = __if_nextreq (cur_ifr), ++i)
- {
- if (cur_ifr->ifr_addr.sa_family != AF_INET)
- continue;
-
- ifaddrs[num_ifs].addrtype = AF_INET;
- ifaddrs[num_ifs].u.ipv4.addr =
- ((struct sockaddr_in *) &cur_ifr->ifr_addr)->sin_addr.s_addr;
-
- if (ioctl (sd, SIOCGIFNETMASK, cur_ifr) < 0)
- continue;
-
- ifaddrs[num_ifs].u.ipv4.mask =
- ((struct sockaddr_in *) &cur_ifr->ifr_netmask)->sin_addr.s_addr;
-
- /* Now we're committed to this entry. */
- ++num_ifs;
- }
- /* Just keep enough memory to hold all the interfaces we want. */
- ifaddrs = realloc (ifaddrs, num_ifs * sizeof (ifaddrs[0]));
- assert (ifaddrs != NULL);
-
- cleanup1:
- __if_freereq (ifr, num);
-
- cleanup:
- /* Release lock, preserve error value, and close socket. */
- save = errno;
- __libc_lock_unlock (lock);
- close (sd);
- }
-
- if (num_ifs == 0)
- return;
-
- /* Find an address for which we have a direct connection. */
- for (i = 0; hp->h_addr_list[i]; ++i)
- {
- struct in_addr *haddr = (struct in_addr *) hp->h_addr_list[i];
-
- for (j = 0; j < num_ifs; ++j)
- {
- u_int32_t if_addr = ifaddrs[j].u.ipv4.addr;
- u_int32_t if_netmask = ifaddrs[j].u.ipv4.mask;
-
- if (((haddr->s_addr ^ if_addr) & if_netmask) == 0)
- {
- void *tmp;
-
- tmp = hp->h_addr_list[i];
- hp->h_addr_list[i] = hp->h_addr_list[0];
- hp->h_addr_list[0] = tmp;
- return;
- }
- }
- }
-#endif /* defined(SIOCGIFCONF) && ... */
-}
-
-
-/* If HOSTNAME has a postfix matching any of the trimdomains, trim away
- that postfix. Notice that HOSTNAME is modified inplace. Also, the
- original code applied all trimdomains in order, meaning that the
- same domainname could be trimmed multiple times. I believe this
- was unintentional. */
-void
-_res_hconf_trim_domain (char *hostname)
-{
- size_t hostname_len, trim_len;
- int i;
-
- hostname_len = strlen (hostname);
-
- for (i = 0; i < _res_hconf.num_trimdomains; ++i)
- {
- const char *trim = _res_hconf.trimdomain[i];
-
- trim_len = strlen (trim);
- if (hostname_len > trim_len
- && strcasecmp (&hostname[hostname_len - trim_len], trim) == 0)
- {
- hostname[hostname_len - trim_len] = '\0';
- break;
- }
- }
-}
-
-
-/* Trim all hostnames/aliases in HP according to the trimdomain list.
- Notice that HP is modified inplace! */
-void
-_res_hconf_trim_domains (struct hostent *hp)
-{
- int i;
-
- if (_res_hconf.num_trimdomains == 0)
- return;
-
- _res_hconf_trim_domain (hp->h_name);
- for (i = 0; hp->h_aliases[i]; ++i)
- _res_hconf_trim_domain (hp->h_aliases[i]);
-}
diff --git a/newlib/libc/sys/linux/net/res_hconf.h b/newlib/libc/sys/linux/net/res_hconf.h
deleted file mode 100644
index 77eeca4de..000000000
--- a/newlib/libc/sys/linux/net/res_hconf.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by David Mosberger (davidm@azstarnet.com).
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _RES_HCONF_H_
-#define _RES_HCONF_H_
-
-#include <netdb.h>
-
-#define TRIMDOMAINS_MAX 4
-
-enum Name_Service
-{
- SERVICE_NONE = 0,
- SERVICE_BIND, SERVICE_HOSTS, SERVICE_NIS,
- SERVICE_MAX
-};
-
-struct hconf
-{
- int initialized;
- int num_services;
- enum Name_Service service[SERVICE_MAX];
- int num_trimdomains;
- const char *trimdomain[TRIMDOMAINS_MAX];
- unsigned int flags;
-# define HCONF_FLAG_INITED (1 << 0) /* initialized? */
-# define HCONF_FLAG_SPOOF (1 << 1) /* refuse spoofed addresses */
-# define HCONF_FLAG_SPOOFALERT (1 << 2) /* syslog warning of spoofed */
-# define HCONF_FLAG_REORDER (1 << 3) /* list best address first */
-# define HCONF_FLAG_MULTI (1 << 4) /* see comments for gethtbyname() */
-};
-extern struct hconf _res_hconf;
-
-extern void _res_hconf_init (void);
-extern void _res_hconf_trim_domain (char *domain);
-extern void _res_hconf_trim_domains (struct hostent *hp);
-extern void _res_hconf_reorder_addrs (struct hostent *hp);
-
-#endif /* _RES_HCONF_H_ */
diff --git a/newlib/libc/sys/linux/net/res_init.c b/newlib/libc/sys/linux/net/res_init.c
index 81b06e710..21f2696cd 100644
--- a/newlib/libc/sys/linux/net/res_init.c
+++ b/newlib/libc/sys/linux/net/res_init.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1985, 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:
@@ -10,10 +10,14 @@
* 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
@@ -29,14 +33,14 @@
/*
* 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
@@ -48,7 +52,7 @@
*/
/*
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -65,56 +69,53 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$BINDId: res_init.c,v 8.16 2000/05/09 07:10:12 vixie Exp $";
+static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
+static char orig_rcsid[] = "From: Id: res_init.c,v 8.7 1996/11/18 09:10:04 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
-
+#include <sys/cdefs.h>
#include <sys/types.h>
+#include <machine/endian.h>
+
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/time.h>
-
#include <netinet/in.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
-
#include <ctype.h>
+#include <resolv.h>
#include <stdio.h>
-#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <netdb.h>
-#include <not-cancel.h>
-#include "local.h"
-#include <resolv.h>
-
-/* Options. Should all be left alone. */
-#define RESOLVSORT
-#define RFC1535
-/* #undef DEBUG */
+#include "res_config.h"
-static void res_setoptions (res_state, const char *, const char *)
- internal_function;
+static void res_setoptions(char *, char *);
#ifdef RESOLVSORT
-static const char sort_mask_chars[] = "/&";
-#define ISSORTMASK(ch) (strchr(sort_mask_chars, ch) != NULL)
-static u_int32_t net_mask (struct in_addr) __THROW;
+static const char sort_mask[] = "/&";
+#define ISSORTMASK(ch) (strchr(sort_mask, ch) != NULL)
+static u_int32_t net_mask(struct in_addr);
#endif
-#if !defined(isascii) /* XXX - could be a function */
+#if !defined(isascii) /* XXX - could be a function */
# define isascii(c) (!(c & 0200))
#endif
-#ifdef _LIBC
-unsigned long long int __res_initstamp attribute_hidden;
-#endif
-
/*
* Resolver state default settings.
*/
+struct __res_state _res
+# if defined(__BIND_RES_TEXT)
+ = { RES_TIMEOUT, } /* Motorola, et al. */
+# endif
+ ;
+
+struct __res_state_ext _res_ext;
+
/*
* Set up default settings. If the configuration file exist, the values
* there will have precedence. Otherwise, the server address is set to
@@ -125,7 +126,7 @@ unsigned long long int __res_initstamp attribute_hidden;
* since it was noted that INADDR_ANY actually meant ``the first interface
* you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface,
* it had to be "up" in order for you to reach your own name server. It
- * was later decided that since the recommended practice is to always
+ * was later decided that since the recommended practice is to always
* install local static routes through 127.0.0.1 for all your network
* interfaces, that we could solve this problem without a code change.
*
@@ -137,26 +138,13 @@ unsigned long long int __res_initstamp attribute_hidden;
* Return 0 if completes successfully, -1 on error
*/
int
-res_ninit(res_state statp) {
- extern int __res_vinit(res_state, int);
-
- return (__res_vinit(statp, 0));
-}
-#ifdef _LIBC
-libc_hidden_def (__res_ninit)
-#endif
-
-/* This function has to be reachable by res_data.c but not publically. */
-int
-__res_vinit(res_state statp, int preinit) {
- register FILE *fp;
- register char *cp, **pp;
- register int n;
- char buf[BUFSIZ];
+res_init()
+{
+ FILE *fp;
+ char *cp, **pp;
+ int n;
+ char buf[MAXDNAME];
int nserv = 0; /* number of nameserver records read from file */
-#ifdef _LIBC
- int nservall = 0; /* number of NS records read, nserv IPv4 only */
-#endif
int haveenv = 0;
int havesearch = 0;
#ifdef RESOLVSORT
@@ -166,45 +154,59 @@ __res_vinit(res_state statp, int preinit) {
#ifndef RFC1535
int dots;
#endif
-#ifdef _LIBC
- statp->_u._ext.initstamp = __res_initstamp;
-#endif
-
- if (!preinit) {
- statp->retrans = RES_TIMEOUT;
- statp->retry = RES_DFLRETRY;
- statp->options = RES_DEFAULT;
- statp->id = res_randomid();
- }
+ int sin_len;
+
+ /*
+ * These three fields used to be statically initialized. This made
+ * it hard to use this code in a shared library. It is necessary,
+ * now that we're doing dynamic initialization here, that we preserve
+ * the old semantics: if an application modifies one of these three
+ * fields of _res before res_init() is called, res_init() will not
+ * alter them. Of course, if an application is setting them to
+ * _zero_ before calling res_init(), hoping to override what used
+ * to be the static default, we can't detect it and unexpected results
+ * will follow. Zero for any of these fields would make no sense,
+ * so one can safely assume that the applications were already getting
+ * unexpected results.
+ *
+ * _res.options is tricky since some apps were known to diddle the bits
+ * before res_init() was first called. We can't replicate that semantic
+ * with dynamic initialization (they may have turned bits off that are
+ * set in RES_DEFAULT). Our solution is to declare such applications
+ * "broken". They could fool us by setting RES_INIT but none do (yet).
+ */
+ if (!_res.retrans)
+ _res.retrans = RES_TIMEOUT;
+ if (!_res.retry)
+ _res.retry = 4;
+ if (!(_res.options & RES_INIT))
+ _res.options = RES_DEFAULT;
+
+ /*
+ * This one used to initialize implicitly to zero, so unless the app
+ * has set it to something in particular, we can randomize it now.
+ */
+ if (!_res.id)
+ _res.id = res_randomid();
#ifdef USELOOPBACK
- statp->nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
+ _res.nsaddr.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
#else
- statp->nsaddr.sin_addr.s_addr = INADDR_ANY;
-#endif
- statp->nsaddr.sin_family = AF_INET;
- statp->nsaddr.sin_port = htons(NAMESERVER_PORT);
- statp->nscount = 1;
- statp->ndots = 1;
- statp->pfcode = 0;
- statp->_vcsock = -1;
- statp->_flags = 0;
- statp->qhook = NULL;
- statp->rhook = NULL;
- statp->_u._ext.nsinit = 0;
- statp->_u._ext.nscount = 0;
-#ifdef _LIBC
- statp->_u._ext.nscount6 = 0;
- for (n = 0; n < MAXNS; n++) {
- statp->_u._ext.nsaddrs[n] = NULL;
- statp->_u._ext.nsmap[n] = MAXNS;
- }
+ _res.nsaddr.sin_addr.s_addr = INADDR_ANY;
#endif
+ _res.nsaddr.sin_family = AF_INET;
+ _res.nsaddr.sin_port = htons(NAMESERVER_PORT);
+ sin_len = sizeof(struct sockaddr_in);
+ if (sizeof(_res_ext.nsaddr) >= sin_len)
+ memcpy(&_res_ext.nsaddr, &_res.nsaddr, sin_len);
+ _res.nscount = 1;
+ _res.ndots = 1;
+ _res.pfcode = 0;
/* Allow user to override the local domain definition */
- if ((cp = getenv("LOCALDOMAIN")) != NULL) {
- (void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
- statp->defdname[sizeof(statp->defdname) - 1] = '\0';
+ if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) {
+ (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
+ _res.defdname[sizeof(_res.defdname) - 1] = '\0';
haveenv++;
/*
@@ -214,10 +216,10 @@ __res_vinit(res_state statp, int preinit) {
* one that they want to use as an individual (even more
* important now that the rfc1535 stuff restricts searches)
*/
- cp = statp->defdname;
- pp = statp->dnsrch;
+ cp = _res.defdname;
+ pp = _res.dnsrch;
*pp++ = cp;
- for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) {
+ for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) {
if (*cp == '\n') /* silly backwards compat */
break;
else if (*cp == ' ' || *cp == '\t') {
@@ -241,9 +243,7 @@ __res_vinit(res_state statp, int preinit) {
(line[sizeof(name) - 1] == ' ' || \
line[sizeof(name) - 1] == '\t'))
- if ((fp = fopen(_PATH_RESCONF, "rc")) != NULL) {
- /* No threads use this stream. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
+ if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
/* read the config file */
while (fgets(buf, sizeof(buf), fp) != NULL) {
/* skip comments */
@@ -258,9 +258,9 @@ __res_vinit(res_state statp, int preinit) {
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
- strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
- statp->defdname[sizeof(statp->defdname) - 1] = '\0';
- if ((cp = strpbrk(statp->defdname, " \t\n")) != NULL)
+ strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
+ _res.defdname[sizeof(_res.defdname) - 1] = '\0';
+ if ((cp = strpbrk(_res.defdname, " \t\n")) != NULL)
*cp = '\0';
havesearch = 0;
continue;
@@ -274,18 +274,18 @@ __res_vinit(res_state statp, int preinit) {
cp++;
if ((*cp == '\0') || (*cp == '\n'))
continue;
- strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
- statp->defdname[sizeof(statp->defdname) - 1] = '\0';
- if ((cp = strchr(statp->defdname, '\n')) != NULL)
+ strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
+ _res.defdname[sizeof(_res.defdname) - 1] = '\0';
+ if ((cp = strchr(_res.defdname, '\n')) != NULL)
*cp = '\0';
/*
* Set search list to be blank-separated strings
* on rest of line.
*/
- cp = statp->defdname;
- pp = statp->dnsrch;
+ cp = _res.defdname;
+ pp = _res.dnsrch;
*pp++ = cp;
- for (n = 0; *cp && pp < statp->dnsrch + MAXDNSRCH; cp++) {
+ for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) {
if (*cp == ' ' || *cp == '\t') {
*cp = 0;
n = 1;
@@ -303,53 +303,54 @@ __res_vinit(res_state statp, int preinit) {
continue;
}
/* read nameservers to query */
-#ifdef _LIBC
- if (MATCH(buf, "nameserver") && nservall < MAXNS) {
-#else
if (MATCH(buf, "nameserver") && nserv < MAXNS) {
-#endif
- struct in_addr a;
+ char *q;
+ struct addrinfo hints, *res;
+ char pbuf[NI_MAXSERV];
cp = buf + sizeof("nameserver") - 1;
while (*cp == ' ' || *cp == '\t')
cp++;
- if ((*cp != '\0') && (*cp != '\n')
- && inet_aton(cp, &a)) {
- statp->nsaddr_list[nserv].sin_addr = a;
- statp->nsaddr_list[nserv].sin_family = AF_INET;
- statp->nsaddr_list[nserv].sin_port =
- htons(NAMESERVER_PORT);
+ if ((*cp == '\0') || (*cp == '\n'))
+ continue;
+ for (q = cp; *q; q++) {
+ if (isspace(*q)) {
+ *q = '\0';
+ break;
+ }
+ }
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_NUMERICHOST;
+ hints.ai_socktype = SOCK_DGRAM;
+ snprintf(pbuf, sizeof(pbuf), "%d", NAMESERVER_PORT);
+ if (getaddrinfo(cp, pbuf, &hints, &res) == 0 &&
+ res->ai_next == NULL) {
+ if (res->ai_addrlen <= sizeof(_res_ext.nsaddr_list[nserv])) {
+ memcpy(&_res_ext.nsaddr_list[nserv], res->ai_addr,
+ res->ai_addrlen);
+ } else {
+ memset(&_res_ext.nsaddr_list[nserv], 0,
+ sizeof(_res_ext.nsaddr_list[nserv]));
+ }
+ if (res->ai_addrlen <= sizeof(_res.nsaddr_list[nserv])) {
+ memcpy(&_res.nsaddr_list[nserv], res->ai_addr,
+ res->ai_addrlen);
+ } else {
+ memset(&_res.nsaddr_list[nserv], 0,
+ sizeof(_res.nsaddr_list[nserv]));
+ }
nserv++;
-#ifdef _LIBC
- nservall++;
- } else {
- struct in6_addr a6;
- char *el;
-
- if ((el = strchr(cp, '\n')) != NULL)
- *el = '\0';
- if ((*cp != '\0') &&
- (inet_pton(AF_INET6, cp, &a6) > 0)) {
- struct sockaddr_in6 *sa6;
-
- sa6 = malloc(sizeof(*sa6));
- if (sa6 != NULL) {
- sa6->sin6_addr = a6;
- sa6->sin6_family = AF_INET6;
- sa6->sin6_port = htons(NAMESERVER_PORT);
- statp->_u._ext.nsaddrs[nservall] = sa6;
- statp->_u._ext.nssocks[nservall] = -1;
- statp->_u._ext.nsmap[nservall] = MAXNS + 1;
- nservall++;
- }
- }
-#endif
}
+ if (res)
+ freeaddrinfo(res);
continue;
}
#ifdef RESOLVSORT
if (MATCH(buf, "sortlist")) {
struct in_addr a;
+ struct in6_addr a6;
+ int m, i;
+ u_char *u;
cp = buf + sizeof("sortlist") - 1;
while (nsort < MAXRESOLVSORT) {
@@ -364,7 +365,7 @@ __res_vinit(res_state statp, int preinit) {
n = *cp;
*cp = 0;
if (inet_aton(net, &a)) {
- statp->sort_list[nsort].addr = a;
+ _res.sort_list[nsort].addr = a;
if (ISSORTMASK(n)) {
*cp++ = n;
net = cp;
@@ -374,15 +375,65 @@ __res_vinit(res_state statp, int preinit) {
n = *cp;
*cp = 0;
if (inet_aton(net, &a)) {
- statp->sort_list[nsort].mask = a.s_addr;
+ _res.sort_list[nsort].mask = a.s_addr;
} else {
- statp->sort_list[nsort].mask =
- net_mask(statp->sort_list[nsort].addr);
+ _res.sort_list[nsort].mask =
+ net_mask(_res.sort_list[nsort].addr);
}
} else {
- statp->sort_list[nsort].mask =
- net_mask(statp->sort_list[nsort].addr);
+ _res.sort_list[nsort].mask =
+ net_mask(_res.sort_list[nsort].addr);
+ }
+ _res_ext.sort_list[nsort].af = AF_INET;
+ _res_ext.sort_list[nsort].addr.ina =
+ _res.sort_list[nsort].addr;
+ _res_ext.sort_list[nsort].mask.ina.s_addr =
+ _res.sort_list[nsort].mask;
+ nsort++;
+ }
+ else if (inet_pton(AF_INET6, net, &a6) == 1) {
+
+ _res_ext.sort_list[nsort].af = AF_INET6;
+ _res_ext.sort_list[nsort].addr.in6a = a6;
+ u = (u_char *)&_res_ext.sort_list[nsort].mask.in6a;
+ *cp++ = n;
+ net = cp;
+ while (*cp && *cp != ';' &&
+ isascii(*cp) && !isspace(*cp))
+ cp++;
+ m = n;
+ n = *cp;
+ *cp = 0;
+ switch (m) {
+ case '/':
+ m = atoi(net);
+ break;
+ case '&':
+ if (inet_pton(AF_INET6, net, u) == 1) {
+ m = -1;
+ break;
+ }
+ /*FALLTHROUGH*/
+ default:
+ m = sizeof(struct in6_addr) * NBBY;
+ break;
}
+ if (m >= 0) {
+ for (i = 0; i < sizeof(struct in6_addr); i++) {
+ if (m <= 0) {
+ *u = 0;
+ } else {
+ m -= NBBY;
+ *u = (u_char)~0;
+ if (m < 0)
+ *u <<= -m;
+ }
+ u++;
+ }
+ }
+ _res.sort_list[nsort].addr.s_addr =
+ (u_int32_t)0xffffffff;
+ _res.sort_list[nsort].mask = (u_int32_t)0xffffffff;
nsort++;
}
*cp = n;
@@ -391,50 +442,46 @@ __res_vinit(res_state statp, int preinit) {
}
#endif
if (MATCH(buf, "options")) {
- res_setoptions(statp, buf + sizeof("options") - 1, "conf");
+ res_setoptions(buf + sizeof("options") - 1, "conf");
continue;
}
}
- if (nserv > 1)
- statp->nscount = nserv;
-#ifdef _LIBC
- if (nservall - nserv > 0)
- statp->_u._ext.nscount6 = nservall - nserv;
-#endif
+ if (nserv > 1)
+ _res.nscount = nserv;
#ifdef RESOLVSORT
- statp->nsort = nsort;
+ _res.nsort = nsort;
#endif
(void) fclose(fp);
}
- if (statp->defdname[0] == 0 &&
- __gethostname(buf, sizeof(statp->defdname) - 1) == 0 &&
+ if (_res.defdname[0] == 0 &&
+ gethostname(buf, sizeof(_res.defdname) - 1) == 0 &&
(cp = strchr(buf, '.')) != NULL)
- strcpy(statp->defdname, cp + 1);
+ strcpy(_res.defdname, cp + 1);
/* find components of local domain that might be searched */
if (havesearch == 0) {
- pp = statp->dnsrch;
- *pp++ = statp->defdname;
+ pp = _res.dnsrch;
+ *pp++ = _res.defdname;
*pp = NULL;
#ifndef RFC1535
dots = 0;
- for (cp = statp->defdname; *cp; cp++)
+ for (cp = _res.defdname; *cp; cp++)
dots += (*cp == '.');
- cp = statp->defdname;
- while (pp < statp->dnsrch + MAXDFLSRCH) {
+ cp = _res.defdname;
+ while (pp < _res.dnsrch + MAXDFLSRCH) {
if (dots < LOCALDOMAINPARTS)
break;
- cp = memchr(cp, '.') + 1; /* we know there is one */
+ cp = strchr(cp, '.') + 1; /* we know there is one */
*pp++ = cp;
dots--;
}
*pp = NULL;
#ifdef DEBUG
- if (statp->options & RES_DEBUG) {
+ if (_res.options & RES_DEBUG) {
printf(";; res_init()... default dnsrch list:\n");
- for (pp = statp->dnsrch; *pp; pp++)
+ for (pp = _res.dnsrch; *pp; pp++)
printf(";;\t%s\n", *pp);
printf(";;\t..END..\n");
}
@@ -442,20 +489,23 @@ __res_vinit(res_state statp, int preinit) {
#endif /* !RFC1535 */
}
- if ((cp = getenv("RES_OPTIONS")) != NULL)
- res_setoptions(statp, cp, "env");
- statp->options |= RES_INIT;
+ if (issetugid())
+ _res.options |= RES_NOALIASES;
+ else if ((cp = getenv("RES_OPTIONS")) != NULL)
+ res_setoptions(cp, "env");
+ _res.options |= RES_INIT;
return (0);
}
static void
-internal_function
-res_setoptions(res_state statp, const char *options, const char *source) {
- const char *cp = options;
+res_setoptions(options, source)
+ char *options, *source;
+{
+ char *cp = options;
int i;
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
+ if (_res.options & RES_DEBUG)
printf(";; res_setoptions(\"%s\", \"%s\")...\n",
options, source);
#endif
@@ -467,50 +517,32 @@ res_setoptions(res_state statp, const char *options, const char *source) {
if (!strncmp(cp, "ndots:", sizeof("ndots:") - 1)) {
i = atoi(cp + sizeof("ndots:") - 1);
if (i <= RES_MAXNDOTS)
- statp->ndots = i;
+ _res.ndots = i;
else
- statp->ndots = RES_MAXNDOTS;
+ _res.ndots = RES_MAXNDOTS;
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
- printf(";;\tndots=%d\n", statp->ndots);
+ if (_res.options & RES_DEBUG)
+ printf(";;\tndots=%d\n", _res.ndots);
#endif
- } else if (!strncmp(cp, "timeout:", sizeof("timeout:") - 1)) {
- i = atoi(cp + sizeof("timeout:") - 1);
- if (i <= RES_MAXRETRANS)
- statp->retrans = i;
- else
- statp->retrans = RES_MAXRETRANS;
- } else if (!strncmp(cp, "attempts:", sizeof("attempts:") - 1)){
- i = atoi(cp + sizeof("attempts:") - 1);
- if (i <= RES_MAXRETRY)
- statp->retry = i;
- else
- statp->retry = RES_MAXRETRY;
} else if (!strncmp(cp, "debug", sizeof("debug") - 1)) {
#ifdef DEBUG
- if (!(statp->options & RES_DEBUG)) {
+ if (!(_res.options & RES_DEBUG)) {
printf(";; res_setoptions(\"%s\", \"%s\")..\n",
options, source);
- statp->options |= RES_DEBUG;
+ _res.options |= RES_DEBUG;
}
printf(";;\tdebug\n");
#endif
} else if (!strncmp(cp, "inet6", sizeof("inet6") - 1)) {
- statp->options |= RES_USE_INET6;
- } else if (!strncmp(cp, "ip6-bytestring",
- sizeof("ip6-bytestring") - 1)) {
- statp->options |= RES_USEBSTRING;
- } else if (!strncmp(cp, "no-ip6-dotint",
- sizeof("no-ip6-dotint") - 1)) {
- statp->options |= RES_NOIP6DOTINT;
- } else if (!strncmp(cp, "ip6-dotint",
- sizeof("ip6-dotint") - 1)) {
- statp->options &= ~RES_NOIP6DOTINT;
- } else if (!strncmp(cp, "rotate", sizeof("rotate") - 1)) {
- statp->options |= RES_ROTATE;
- } else if (!strncmp(cp, "no-check-names",
- sizeof("no-check-names") - 1)) {
- statp->options |= RES_NOCHECKNAME;
+ _res.options |= RES_USE_INET6;
+ } else if (!strncmp(cp, "insecure1", sizeof("insecure1") - 1)) {
+ _res.options |= RES_INSECURE1;
+ } else if (!strncmp(cp, "insecure2", sizeof("insecure2") - 1)) {
+ _res.options |= RES_INSECURE2;
+ } else if (!strncmp(cp, "no_tld_query", sizeof("no_tld_query") - 1)) {
+ _res.options |= RES_NOTLDQUERY;
+ } else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
+ _res.options |= RES_USE_EDNS0;
} else {
/* XXX - print a warning here? */
}
@@ -526,7 +558,7 @@ static u_int32_t
net_mask(in) /* XXX - should really use system's version of this */
struct in_addr in;
{
- register u_int32_t i = ntohl(in.s_addr);
+ u_int32_t i = ntohl(in.s_addr);
if (IN_CLASSA(i))
return (htonl(IN_CLASSA_NET));
@@ -537,72 +569,17 @@ net_mask(in) /* XXX - should really use system's version of this */
#endif
u_int
-res_randomid(void) {
+res_randomid()
+{
struct timeval now;
gettimeofday(&now, NULL);
return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
}
-#ifdef _LIBC
-libc_hidden_def (__res_randomid)
-#endif
-
/*
- * This routine is for closing the socket if a virtual circuit is used and
- * the program wants to close it. This provides support for endhostent()
- * which expects to close the socket.
- *
- * This routine is not expected to be user visible.
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <resolv.h>.
*/
-void
-res_nclose(res_state statp) {
- int ns;
-
- if (statp->_vcsock >= 0) {
- close_not_cancel_no_status(statp->_vcsock);
- statp->_vcsock = -1;
- statp->_flags &= ~(RES_F_VC | RES_F_CONN);
- }
-#ifdef _LIBC
- for (ns = 0; ns < MAXNS; ns++)
-#else
- for (ns = 0; ns < statp->_u._ext.nscount; ns++)
-#endif
- if (statp->_u._ext.nsaddrs[ns]
- && statp->_u._ext.nssocks[ns] != -1) {
- close_not_cancel_no_status(statp->_u._ext.nssocks[ns]);
- statp->_u._ext.nssocks[ns] = -1;
- }
- statp->_u._ext.nsinit = 0;
-}
-#ifdef _LIBC
-libc_hidden_def (__res_nclose)
-#endif
-
-#ifdef _LIBC
-# ifdef _LIBC_REENTRANT
-/* This is called when a thread is exiting to free resources held in _res. */
-static void __attribute__ ((section ("__libc_thread_freeres_fn")))
-res_thread_freeres (void)
-{
- if (_res.nscount == 0)
- /* Never called res_ninit. */
- return;
-
- __res_nclose (&_res); /* Close any VC sockets. */
-
- for (int ns = 0; ns < MAXNS; ns++)
- if (_res._u._ext.nsaddrs[ns] != NULL)
- {
- free (_res._u._ext.nsaddrs[ns]);
- _res._u._ext.nsaddrs[ns] = NULL;
- }
-
- /* Make sure we do a full re-initialization the next time. */
- _res.options = 0;
-}
-text_set_element (__libc_thread_subfreeres, res_thread_freeres);
-text_set_element (__libc_subfreeres, res_thread_freeres);
-# endif
-#endif
+#undef res_init
+__weak_reference(__res_init, res_init);
diff --git a/newlib/libc/sys/linux/net/res_libc.c b/newlib/libc/sys/linux/net/res_libc.c
deleted file mode 100644
index 739a51f58..000000000
--- a/newlib/libc/sys/linux/net/res_libc.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (c) 1995-1999 by Internet Software Consortium.
- *
- * 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.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
- * CONSORTIUM 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.
- */
-
-#include <machine/atomic.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#include <bits/libc-lock.h>
-
-#include "libc-symbols.h"
-
-
-/* The following bit is copied from res_data.c (where it is #ifdef'ed
- out) since res_init() should go into libc.so but the rest of that
- file should not. */
-
-extern unsigned long long int __res_initstamp attribute_hidden;
-/* We have atomic increment operations on 64-bit platforms. */
-#if __WORDSIZE == 64
-# define atomicinclock(lock) (void) 0
-# define atomicincunlock(lock) (void) 0
-# define atomicinc(var) atomic_increment (&(var))
-#else
-__libc_lock_define_initialized (static, lock);
-# define atomicinclock(lock) __libc_lock_lock (lock)
-# define atomicincunlock(lock) __libc_lock_unlock (lock)
-# define atomicinc(var) ++var
-#endif
-
-int
-res_init(void) {
- extern int __res_vinit(res_state, int);
-
- /*
- * These three fields used to be statically initialized. This made
- * it hard to use this code in a shared library. It is necessary,
- * now that we're doing dynamic initialization here, that we preserve
- * the old semantics: if an application modifies one of these three
- * fields of _res before res_init() is called, res_init() will not
- * alter them. Of course, if an application is setting them to
- * _zero_ before calling res_init(), hoping to override what used
- * to be the static default, we can't detect it and unexpected results
- * will follow. Zero for any of these fields would make no sense,
- * so one can safely assume that the applications were already getting
- * unexpected results.
- *
- * _res.options is tricky since some apps were known to diddle the bits
- * before res_init() was first called. We can't replicate that semantic
- * with dynamic initialization (they may have turned bits off that are
- * set in RES_DEFAULT). Our solution is to declare such applications
- * "broken". They could fool us by setting RES_INIT but none do (yet).
- */
- if (!_res.retrans)
- _res.retrans = RES_TIMEOUT;
- if (!_res.retry)
- _res.retry = 4;
- if (!(_res.options & RES_INIT))
- _res.options = RES_DEFAULT;
- else if (_res.nscount > 0) {
- __res_nclose (&_res); /* Close any VC sockets. */
- int ns;
- for (ns = 0; ns < MAXNS; ns++) {
- free (_res._u._ext.nsaddrs[ns]);
- _res._u._ext.nsaddrs[ns] = NULL;
- }
- }
-
- /*
- * This one used to initialize implicitly to zero, so unless the app
- * has set it to something in particular, we can randomize it now.
- */
- if (!_res.id)
- _res.id = res_randomid();
-
- atomicinclock (lock);
- /* Request all threads to re-initialize their resolver states,
- resolv.conf might have changed. */
- atomicinc (__res_initstamp);
- atomicincunlock (lock);
-
- return (__res_vinit(&_res, 1));
-}
-
-/* Initialize resp if RES_INIT is not yet set or if res_init in some other
- thread requested re-initializing. */
-int
-__res_maybe_init (res_state resp, int preinit)
-{
- if (resp->options & RES_INIT) {
- if (__res_initstamp != resp->_u._ext.initstamp) {
- if (resp->nscount > 0) {
- __res_nclose (resp);
- int ns;
- for (ns = 0; ns < MAXNS; ns++) {
- free (resp->_u._ext.nsaddrs[ns]);
- resp->_u._ext.nsaddrs[ns] = NULL;
- }
- return __res_vinit (resp, 1);
- }
- }
- return 0;
- } else if (preinit) {
- if (!resp->retrans)
- resp->retrans = RES_TIMEOUT;
- if (!resp->retry)
- resp->retry = 4;
- resp->options = RES_DEFAULT;
- if (!resp->id)
- resp->id = res_randomid ();
- return __res_vinit (resp, 1);
- } else
- return __res_ninit (resp);
-}
-libc_hidden_def (__res_maybe_init)
-
-/* This needs to be after the use of _res in res_init, above. */
-#undef _res
-
-/* The resolver state for use by single-threaded programs.
- This differs from plain `struct __res_state _res;' in that it doesn't
- create a common definition, but a plain symbol that resides in .bss,
- which can have an alias. */
-struct __res_state _res __attribute__((section (".bss")));
-
-#define USE___THREAD 1
-
-#if USE___THREAD
-#undef __resp
-__thread struct __res_state *__resp = &_res;
-extern __thread struct __res_state *__libc_resp
- __attribute__ ((alias ("__resp"))) attribute_hidden;
-#endif
-
-/* We declare this with compat_symbol so that it's not
- visible at link time. Programs must use the accessor functions. */
-#if defined HAVE_ELF && defined SHARED && defined DO_VERSIONING
-# include <shlib-compat.h>
-compat_symbol (libc, _res, _res, GLIBC_2_0);
-#endif
-
-#include <shlib-compat.h>
-
-#if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_2)
-# undef res_init
-extern int __res_init_weak (void);
-weak_extern (__res_init_weak);
-strong_alias (__res_init, __res_init_weak);
-compat_symbol (libc, __res_init_weak, res_init, GLIBC_2_0);
-#endif
diff --git a/newlib/libc/sys/linux/net/res_mkquery.c b/newlib/libc/sys/linux/net/res_mkquery.c
index fa1ccd87f..0c6cca9c4 100644
--- a/newlib/libc/sys/linux/net/res_mkquery.c
+++ b/newlib/libc/sys/linux/net/res_mkquery.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1985, 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:
@@ -10,10 +10,14 @@
* 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
@@ -29,14 +33,14 @@
/*
* 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
@@ -48,7 +52,7 @@
*/
/*
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -65,9 +69,12 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$BINDId: res_mkquery.c,v 8.12 1999/10/13 16:39:40 vixie Exp $";
+static char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
+static char orig_rcsid[] = "From: Id: res_mkquery.c,v 8.9 1997/04/24 22:22:36 vixie Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -77,43 +84,37 @@ static const char rcsid[] = "$BINDId: res_mkquery.c,v 8.12 1999/10/13 16:39:40 v
#include <resolv.h>
#include <stdio.h>
#include <string.h>
-#include <time.h>
-#include "local.h"
-
-/* Options. Leave them on. */
-/* #define DEBUG */
-#ifdef _LIBC
-# include <hp-timing.h>
-# if HP_TIMING_AVAIL
-# define RANDOM_BITS(Var) { uint64_t v64; HP_TIMING_NOW (v64); Var = v64; }
-# endif
-#endif
+#include "res_config.h"
/*
* Form all types of queries.
* Returns the size of the result or -1.
*/
int
-res_nmkquery(res_state statp,
- int op, /* opcode of query */
- const char *dname, /* domain name */
- int class, int type, /* class and type of query */
- const u_char *data, /* resource record data */
- int datalen, /* length of data */
- const u_char *newrr_in, /* new rr for modify or append */
- u_char *buf, /* buffer to put query */
- int buflen) /* size of buffer */
+res_mkquery(op, dname, class, type, data, datalen, newrr_in, buf, buflen)
+ int op; /* opcode of query */
+ const char *dname; /* domain name */
+ int class, type; /* class and type of query */
+ const u_char *data; /* resource record data */
+ int datalen; /* length of data */
+ const u_char *newrr_in; /* new rr for modify or append */
+ u_char *buf; /* buffer to put query */
+ int buflen; /* size of buffer */
{
- register HEADER *hp;
- register u_char *cp;
- register int n;
+ HEADER *hp;
+ u_char *cp;
+ int n;
u_char *dnptrs[20], **dpp, **lastdnptr;
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
- printf(";; res_nmkquery(%s, %s, %s, %s)\n",
- _res_opcodes[op], dname, p_class(class), p_type(type));
+ if (_res.options & RES_DEBUG)
+ printf(";; res_mkquery(%d, %s, %d, %d)\n",
+ op, dname, class, type);
#endif
/*
* Initialize header fields.
@@ -122,30 +123,9 @@ res_nmkquery(res_state statp,
return (-1);
memset(buf, 0, HFIXEDSZ);
hp = (HEADER *) buf;
- /* We randomize the IDs every time. The old code just
- incremented by one after the initial randomization which
- still predictable if the application does multiple
- requests. */
-#if 0
- hp->id = htons(++statp->id);
-#else
- hp->id = htons(statp->id);
- int randombits;
- do
- {
-#ifdef RANDOM_BITS
- RANDOM_BITS (randombits);
-#else
- struct timeval tv;
- gettimeofday (&tv, NULL);
- randombits = (tv.tv_sec << 8) ^ tv.tv_usec;
-#endif
- }
- while ((randombits & 0xffff) == 0);
- statp->id = (statp->id + randombits) & 0xffff;
-#endif
+ hp->id = htons(++_res.id);
hp->opcode = op;
- hp->rd = (statp->options & RES_RECURSE) != 0;
+ hp->rd = (_res.options & RES_RECURSE) != 0;
hp->rcode = NOERROR;
cp = buf + HFIXEDSZ;
buflen -= HFIXEDSZ;
@@ -219,4 +199,47 @@ res_nmkquery(res_state statp,
}
return (cp - buf);
}
-libresolv_hidden_def (res_nmkquery)
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <resolv.h>.
+ */
+#undef res_mkquery
+__weak_reference(__res_mkquery, res_mkquery);
+
+/* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */
+int
+res_opt(n0, buf, buflen, anslen)
+ int n0;
+ u_char *buf; /* buffer to put query */
+ int buflen; /* size of buffer */
+ int anslen; /* answer buffer length */
+{
+ HEADER *hp;
+ u_char *cp;
+
+ hp = (HEADER *) buf;
+ cp = buf + n0;
+ buflen -= n0;
+
+ if (buflen < 1 + RRFIXEDSZ)
+ return -1;
+
+ *cp++ = 0; /* "." */
+ buflen--;
+
+ __putshort(T_OPT, cp); /* TYPE */
+ cp += INT16SZ;
+ __putshort(anslen & 0xffff, cp); /* CLASS = UDP payload size */
+ cp += INT16SZ;
+ *cp++ = NOERROR; /* extended RCODE */
+ *cp++ = 0; /* EDNS version */
+ __putshort(0, cp); /* MBZ */
+ cp += INT16SZ;
+ __putshort(0, cp); /* RDLEN */
+ cp += INT16SZ;
+ hp->arcount = htons(ntohs(hp->arcount) + 1);
+ buflen -= RRFIXEDSZ;
+
+ return cp - buf;
+}
diff --git a/newlib/libc/sys/linux/net/res_mkupdate.c b/newlib/libc/sys/linux/net/res_mkupdate.c
new file mode 100644
index 000000000..4e21fe8cf
--- /dev/null
+++ b/newlib/libc/sys/linux/net/res_mkupdate.c
@@ -0,0 +1,412 @@
+/*
+ * Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
+ */
+
+/*
+ * Based on the Dynamic DNS reference implementation by Viraj Bais
+ * <viraj_bais@ccm.fm.intel.com>
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <limits.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+
+#include "res_config.h"
+
+static int getnum_str(u_char **, u_char *);
+static int getword_str(char *, int, u_char **, u_char *);
+
+#define ShrinkBuffer(x) if ((buflen -= x) < 0) return (-2);
+
+/*
+ * Form update packets.
+ * Returns the size of the resulting packet if no error
+ * On error,
+ * returns -1 if error in reading a word/number in rdata
+ * portion for update packets
+ * -2 if length of buffer passed is insufficient
+ * -3 if zone section is not the first section in
+ * the linked list, or section order has a problem
+ * -4 on a number overflow
+ * -5 unknown operation or no records
+ */
+int
+res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
+ ns_updrec *rrecp_start = rrecp_in;
+ HEADER *hp;
+ u_char *cp, *sp1, *sp2, *startp, *endp;
+ int n, i, soanum, multiline;
+ ns_updrec *rrecp;
+ struct in_addr ina;
+ char buf2[MAXDNAME];
+ int section, numrrs = 0, counts[ns_s_max];
+ u_int16_t rtype, rclass;
+ u_int32_t n1, rttl;
+ u_char *dnptrs[20], **dpp, **lastdnptr;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
+
+ /*
+ * Initialize header fields.
+ */
+ if ((buf == NULL) || (buflen < HFIXEDSZ))
+ return (-1);
+ memset(buf, 0, HFIXEDSZ);
+ hp = (HEADER *) buf;
+ hp->id = htons(++_res.id);
+ hp->opcode = ns_o_update;
+ hp->rcode = NOERROR;
+ sp1 = buf + 2*INT16SZ; /* save pointer to zocount */
+ cp = buf + HFIXEDSZ;
+ buflen -= HFIXEDSZ;
+ dpp = dnptrs;
+ *dpp++ = buf;
+ *dpp++ = NULL;
+ lastdnptr = dnptrs + sizeof dnptrs / sizeof dnptrs[0];
+
+ if (rrecp_start == NULL)
+ return (-5);
+ else if (rrecp_start->r_section != S_ZONE)
+ return (-3);
+
+ memset(counts, 0, sizeof counts);
+ for (rrecp = rrecp_start; rrecp; rrecp = rrecp->r_grpnext) {
+ numrrs++;
+ section = rrecp->r_section;
+ if (section < 0 || section >= ns_s_max)
+ return (-1);
+ counts[section]++;
+ for (i = section + 1; i < ns_s_max; i++)
+ if (counts[i])
+ return (-3);
+ rtype = rrecp->r_type;
+ rclass = rrecp->r_class;
+ rttl = rrecp->r_ttl;
+ /* overload class and type */
+ if (section == S_PREREQ) {
+ rttl = 0;
+ switch (rrecp->r_opcode) {
+ case YXDOMAIN:
+ rclass = C_ANY;
+ rtype = T_ANY;
+ rrecp->r_size = 0;
+ break;
+ case NXDOMAIN:
+ rclass = C_NONE;
+ rtype = T_ANY;
+ rrecp->r_size = 0;
+ break;
+ case NXRRSET:
+ rclass = C_NONE;
+ rrecp->r_size = 0;
+ break;
+ case YXRRSET:
+ if (rrecp->r_size == 0)
+ rclass = C_ANY;
+ break;
+ default:
+ fprintf(stderr,
+ "res_mkupdate: incorrect opcode: %d\n",
+ rrecp->r_opcode);
+ fflush(stderr);
+ return (-1);
+ }
+ } else if (section == S_UPDATE) {
+ switch (rrecp->r_opcode) {
+ case DELETE:
+ rclass = rrecp->r_size == 0 ? C_ANY : C_NONE;
+ break;
+ case ADD:
+ break;
+ default:
+ fprintf(stderr,
+ "res_mkupdate: incorrect opcode: %d\n",
+ rrecp->r_opcode);
+ fflush(stderr);
+ return (-1);
+ }
+ }
+
+ /*
+ * XXX appending default domain to owner name is omitted,
+ * fqdn must be provided
+ */
+ if ((n = dn_comp(rrecp->r_dname, cp, buflen, dnptrs,
+ lastdnptr)) < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n + 2*INT16SZ);
+ PUTSHORT(rtype, cp);
+ PUTSHORT(rclass, cp);
+ if (section == S_ZONE) {
+ if (numrrs != 1 || rrecp->r_type != T_SOA)
+ return (-3);
+ continue;
+ }
+ ShrinkBuffer(INT32SZ + INT16SZ);
+ PUTLONG(rttl, cp);
+ sp2 = cp; /* save pointer to length byte */
+ cp += INT16SZ;
+ if (rrecp->r_size == 0) {
+ if (section == S_UPDATE && rclass != C_ANY)
+ return (-1);
+ else {
+ PUTSHORT(0, sp2);
+ continue;
+ }
+ }
+ startp = rrecp->r_data;
+ endp = startp + rrecp->r_size - 1;
+ /* XXX this should be done centrally. */
+ switch (rrecp->r_type) {
+ case T_A:
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ if (!inet_aton(buf2, &ina))
+ return (-1);
+ n1 = ntohl(ina.s_addr);
+ ShrinkBuffer(INT32SZ);
+ PUTLONG(n1, cp);
+ break;
+ case T_CNAME:
+ case T_MB:
+ case T_MG:
+ case T_MR:
+ case T_NS:
+ case T_PTR:
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ break;
+ case T_MINFO:
+ case T_SOA:
+ case T_RP:
+ for (i = 0; i < 2; i++) {
+ if (!getword_str(buf2, sizeof buf2, &startp,
+ endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen,
+ dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ }
+ if (rrecp->r_type == T_SOA) {
+ ShrinkBuffer(5 * INT32SZ);
+ while (isspace(*startp) || !*startp)
+ startp++;
+ if (*startp == '(') {
+ multiline = 1;
+ startp++;
+ } else
+ multiline = 0;
+ /* serial, refresh, retry, expire, minimum */
+ for (i = 0; i < 5; i++) {
+ soanum = getnum_str(&startp, endp);
+ if (soanum < 0)
+ return (-1);
+ PUTLONG(soanum, cp);
+ }
+ if (multiline) {
+ while (isspace(*startp) || !*startp)
+ startp++;
+ if (*startp != ')')
+ return (-1);
+ }
+ }
+ break;
+ case T_MX:
+ case T_AFSDB:
+ case T_RT:
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ PUTSHORT(n, cp);
+ ShrinkBuffer(INT16SZ);
+ if (!getword_str(buf2, sizeof buf2, &startp, endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, dnptrs, lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ break;
+ case T_PX:
+ n = getnum_str(&startp, endp);
+ if (n < 0)
+ return (-1);
+ PUTSHORT(n, cp);
+ ShrinkBuffer(INT16SZ);
+ for (i = 0; i < 2; i++) {
+ if (!getword_str(buf2, sizeof buf2, &startp,
+ endp))
+ return (-1);
+ n = dn_comp(buf2, cp, buflen, dnptrs,
+ lastdnptr);
+ if (n < 0)
+ return (-1);
+ cp += n;
+ ShrinkBuffer(n);
+ }
+ break;
+ case T_WKS:
+ case T_HINFO:
+ case T_TXT:
+ case T_X25:
+ case T_ISDN:
+ case T_NSAP:
+ case T_LOC:
+ /* XXX - more fine tuning needed here */
+ ShrinkBuffer(rrecp->r_size);
+ memcpy(cp, rrecp->r_data, rrecp->r_size);
+ cp += rrecp->r_size;
+ break;
+ default:
+ return (-1);
+ } /*switch*/
+ n = (u_int16_t)((cp - sp2) - INT16SZ);
+ PUTSHORT(n, sp2);
+ } /*for*/
+
+ hp->qdcount = htons(counts[0]);
+ hp->ancount = htons(counts[1]);
+ hp->nscount = htons(counts[2]);
+ hp->arcount = htons(counts[3]);
+ return (cp - buf);
+}
+
+/*
+ * Get a whitespace delimited word from a string (not file)
+ * into buf. modify the start pointer to point after the
+ * word in the string.
+ */
+static int
+getword_str(char *buf, int size, u_char **startpp, u_char *endp) {
+ char *cp;
+ int c;
+
+ for (cp = buf; *startpp <= endp; ) {
+ c = **startpp;
+ if (isspace(c) || c == '\0') {
+ if (cp != buf) /* trailing whitespace */
+ break;
+ else { /* leading whitespace */
+ (*startpp)++;
+ continue;
+ }
+ }
+ (*startpp)++;
+ if (cp >= buf+size-1)
+ break;
+ *cp++ = (u_char)c;
+ }
+ *cp = '\0';
+ return (cp != buf);
+}
+
+/*
+ * Get a whitespace delimited number from a string (not file) into buf
+ * update the start pointer to point after the number in the string.
+ */
+static int
+getnum_str(u_char **startpp, u_char *endp) {
+ int c, n;
+ int seendigit = 0;
+ int m = 0;
+
+ for (n = 0; *startpp <= endp; ) {
+ c = **startpp;
+ if (isspace(c) || c == '\0') {
+ if (seendigit) /* trailing whitespace */
+ break;
+ else { /* leading whitespace */
+ (*startpp)++;
+ continue;
+ }
+ }
+ if (c == ';') {
+ while ((*startpp <= endp) &&
+ ((c = **startpp) != '\n'))
+ (*startpp)++;
+ if (seendigit)
+ break;
+ continue;
+ }
+ if (!isdigit(c)) {
+ if (c == ')' && seendigit) {
+ (*startpp)--;
+ break;
+ }
+ return (-1);
+ }
+ (*startpp)++;
+ n = n * 10 + (c - '0');
+ seendigit = 1;
+ }
+ return (n + m);
+}
+
+/*
+ * Allocate a resource record buffer & save rr info.
+ */
+ns_updrec *
+res_mkupdrec(int section, const char *dname,
+ u_int class, u_int type, u_long ttl) {
+ ns_updrec *rrecp = (ns_updrec *)calloc(1, sizeof(ns_updrec));
+
+ if (!rrecp || !(rrecp->r_dname = strdup(dname)))
+ return (NULL);
+ rrecp->r_class = class;
+ rrecp->r_type = type;
+ rrecp->r_ttl = ttl;
+ rrecp->r_section = section;
+ return (rrecp);
+}
+
+/*
+ * Free a resource record buffer created by res_mkupdrec.
+ */
+void
+res_freeupdrec(ns_updrec *rrecp) {
+ /* Note: freeing r_dp is the caller's responsibility. */
+ if (rrecp->r_dname != NULL)
+ free(rrecp->r_dname);
+ free(rrecp);
+}
diff --git a/newlib/libc/sys/linux/net/res_query.c b/newlib/libc/sys/linux/net/res_query.c
index fcb624e8e..ee6775d99 100644
--- a/newlib/libc/sys/linux/net/res_query.c
+++ b/newlib/libc/sys/linux/net/res_query.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1988, 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:
@@ -10,10 +10,14 @@
* 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
@@ -29,14 +33,14 @@
/*
* 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
@@ -48,7 +52,7 @@
*/
/*
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -65,9 +69,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$BINDId: res_query.c,v 8.20 2000/02/29 05:39:12 vixie Exp $";
+static char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
+static char orig_rcsid = "From: Id: res_query.c,v 8.14 1997/06/09 17:47:05 halley Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -81,190 +87,144 @@ static const char rcsid[] = "$BINDId: res_query.c,v 8.20 2000/02/29 05:39:12 vix
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "libc-symbols.h"
-/* Options. Leave them on. */
-/* #undef DEBUG */
+#include "res_config.h"
-#if PACKETSZ > 65536
+#if PACKETSZ > 1024
#define MAXPACKET PACKETSZ
#else
-#define MAXPACKET 65536
+#define MAXPACKET 1024
#endif
-#define QUERYSIZE (HFIXEDSZ + QFIXEDSZ + MAXCDNAME + 1)
-
-static int
-__libc_res_nquerydomain(res_state statp, const char *name, const char *domain,
- int class, int type, u_char *answer, int anslen,
- u_char **answerp);
-
/*
* Formulate a normal query, send, and await answer.
* Returned answer is placed in supplied buffer "answer".
* Perform preliminary check of answer, returning success only
* if no error is indicated and the answer count is nonzero.
* Return the size of the response on success, -1 on error.
- * Error number is left in H_ERRNO.
+ * Error number is left in h_errno.
*
* Caller must parse answer and determine whether it answers the question.
*/
int
-__libc_res_nquery(res_state statp,
- const char *name, /* domain name */
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen, /* size of answer buffer */
- u_char **answerp) /* if buffer needs to be enlarged */
+res_query(name, class, type, answer, anslen)
+ const char *name; /* domain name */
+ int class, type; /* class and type of query */
+ u_char *answer; /* buffer to put answer */
+ int anslen; /* size of answer buffer */
{
- u_char *buf;
+ u_char buf[MAXPACKET];
HEADER *hp = (HEADER *) answer;
- int n, use_malloc = 0;
+ int n;
hp->rcode = NOERROR; /* default */
- buf = alloca (QUERYSIZE);
-
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
+ if (_res.options & RES_DEBUG)
printf(";; res_query(%s, %d, %d)\n", name, class, type);
#endif
- n = res_nmkquery(statp, QUERY, name, class, type, NULL, 0, NULL,
- buf, QUERYSIZE);
- if (__builtin_expect (n <= 0, 0)) {
- /* Retry just in case res_nmkquery failed because of too
- short buffer. Shouldn't happen. */
- buf = malloc (MAXPACKET);
- if (buf != NULL) {
- use_malloc = 1;
- n = res_nmkquery(statp, QUERY, name, class, type, NULL,
- 0, NULL, buf, MAXPACKET);
- }
- }
- if (__builtin_expect (n <= 0, 0)) {
+ n = res_mkquery(QUERY, name, class, type, NULL, 0, NULL,
+ buf, sizeof(buf));
+ if (n > 0 && (_res.options & RES_USE_EDNS0) != 0)
+ n = res_opt(n, buf, sizeof(buf), anslen);
+ if (n <= 0) {
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
+ if (_res.options & RES_DEBUG)
printf(";; res_query: mkquery failed\n");
#endif
- RES_SET_H_ERRNO(statp, NO_RECOVERY);
- if (use_malloc)
- free (buf);
+ h_errno = NO_RECOVERY;
return (n);
}
- n = __libc_res_nsend(statp, buf, n, answer, anslen, answerp);
- if (use_malloc)
- free (buf);
+ n = res_send(buf, n, answer, anslen);
if (n < 0) {
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
+ if (_res.options & RES_DEBUG)
printf(";; res_query: send error\n");
#endif
- RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ h_errno = TRY_AGAIN;
return (n);
}
if (hp->rcode != NOERROR || ntohs(hp->ancount) == 0) {
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
+ if (_res.options & RES_DEBUG)
printf(";; rcode = %d, ancount=%d\n", hp->rcode,
ntohs(hp->ancount));
#endif
switch (hp->rcode) {
case NXDOMAIN:
- RES_SET_H_ERRNO(statp, HOST_NOT_FOUND);
+ h_errno = HOST_NOT_FOUND;
break;
case SERVFAIL:
- RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ h_errno = TRY_AGAIN;
break;
case NOERROR:
- RES_SET_H_ERRNO(statp, NO_DATA);
+ h_errno = NO_DATA;
break;
case FORMERR:
case NOTIMP:
case REFUSED:
default:
- RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ h_errno = NO_RECOVERY;
break;
}
return (-1);
}
return (n);
}
-libresolv_hidden_def (__libc_res_nquery)
-
-int
-res_nquery(res_state statp,
- const char *name, /* domain name */
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen) /* size of answer buffer */
-{
- return __libc_res_nquery(statp, name, class, type, answer, anslen,
- NULL);
-}
-libresolv_hidden_def (res_nquery)
/*
* Formulate a normal query, send, and retrieve answer in supplied buffer.
* Return the size of the response on success, -1 on error.
* If enabled, implement search rules until answer or unrecoverable failure
- * is detected. Error code, if any, is left in H_ERRNO.
+ * is detected. Error code, if any, is left in h_errno.
*/
int
-__libc_res_nsearch(res_state statp,
- const char *name, /* domain name */
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen, /* size of answer */
- u_char **answerp)
+res_search(name, class, type, answer, anslen)
+ const char *name; /* domain name */
+ int class, type; /* class and type of query */
+ u_char *answer; /* buffer to put answer */
+ int anslen; /* size of answer */
{
const char *cp, * const *domain;
HEADER *hp = (HEADER *) answer;
- char tmp[NS_MAXDNAME];
u_int dots;
int trailing_dot, ret, saved_herrno;
- int got_nodata = 0, got_servfail = 0, root_on_list = 0;
- int tried_as_is = 0;
-
- __set_errno (0);
- RES_SET_H_ERRNO(statp, HOST_NOT_FOUND); /* True if we never query. */
+ int got_nodata = 0, got_servfail = 0, tried_as_is = 0;
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
+ errno = 0;
+ h_errno = HOST_NOT_FOUND; /* default, if we never query */
dots = 0;
- for (cp = name; *cp != '\0'; cp++)
+ for (cp = name; *cp; cp++)
dots += (*cp == '.');
trailing_dot = 0;
if (cp > name && *--cp == '.')
trailing_dot++;
- /* If there aren't any dots, it could be a user-level alias. */
- if (!dots && (cp = res_hostalias(statp, name, tmp, sizeof tmp))!= NULL)
- return (__libc_res_nquery(statp, cp, class, type, answer,
- anslen, answerp));
-
-#ifdef DEBUG
- if (statp->options & RES_DEBUG)
- printf("dots=%d, statp->ndots=%d, trailing_dot=%d, name=%s\n",
- (int)dots,(int)statp->ndots,(int)trailing_dot,name);
-#endif
+ /* If there aren't any dots, it could be a user-level alias */
+ if (!dots && (cp = hostalias(name)) != NULL)
+ return (res_query(cp, class, type, answer, anslen));
/*
- * If there are enough dots in the name, let's just give it a
- * try 'as is'. The threshold can be set with the "ndots" option.
- * Also, query 'as is', if there is a trailing dot in the name.
+ * If there are dots in the name already, let's just give it a try
+ * 'as is'. The threshold can be set with the "ndots" option.
*/
saved_herrno = -1;
- if (dots >= statp->ndots || trailing_dot) {
- ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
- answer, anslen, answerp);
- if (ret > 0 || trailing_dot)
+ if (dots >= _res.ndots) {
+ ret = res_querydomain(name, NULL, class, type, answer, anslen);
+ if (ret > 0)
return (ret);
saved_herrno = h_errno;
tried_as_is++;
- if (answerp && *answerp != answer) {
- answer = *answerp;
- anslen = MAXPACKET;
- }
}
/*
@@ -273,29 +233,19 @@ __libc_res_nsearch(res_state statp,
* - there is at least one dot, there is no trailing dot,
* and RES_DNSRCH is set.
*/
- if ((!dots && (statp->options & RES_DEFNAMES) != 0) ||
- (dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0)) {
+ if ((!dots && (_res.options & RES_DEFNAMES)) ||
+ (dots && !trailing_dot && (_res.options & RES_DNSRCH))) {
int done = 0;
- for (domain = (const char * const *)statp->dnsrch;
+ for (domain = (const char * const *)_res.dnsrch;
*domain && !done;
domain++) {
- if (domain[0][0] == '\0' ||
- (domain[0][0] == '.' && domain[0][1] == '\0'))
- root_on_list++;
-
- ret = __libc_res_nquerydomain(statp, name, *domain,
- class, type,
- answer, anslen, answerp);
+ ret = res_querydomain(name, *domain, class, type,
+ answer, anslen);
if (ret > 0)
return (ret);
- if (answerp && *answerp != answer) {
- answer = *answerp;
- anslen = MAXPACKET;
- }
-
/*
* If no server present, give up.
* If name isn't found in this domain,
@@ -310,11 +260,11 @@ __libc_res_nsearch(res_state statp,
* fully-qualified.
*/
if (errno == ECONNREFUSED) {
- RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ h_errno = TRY_AGAIN;
return (-1);
}
- switch (statp->res_h_errno) {
+ switch (h_errno) {
case NO_DATA:
got_nodata++;
/* FALLTHROUGH */
@@ -336,72 +286,60 @@ __libc_res_nsearch(res_state statp,
/* if we got here for some reason other than DNSRCH,
* we only wanted one iteration of the loop, so stop.
*/
- if ((statp->options & RES_DNSRCH) == 0)
+ if (!(_res.options & RES_DNSRCH))
done++;
}
}
/*
- * If the name has any dots at all, and no earlier 'as-is' query
- * for the name, and "." is not on the search list, then try an as-is
- * query now.
+ * If we have not already tried the name "as is", do that now.
+ * note that we do this regardless of how many dots were in the
+ * name or whether it ends with a dot unless NOTLDQUERY is set.
*/
- if (dots && !(tried_as_is || root_on_list)) {
- ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
- answer, anslen, answerp);
+ if (!tried_as_is && (dots || !(_res.options & RES_NOTLDQUERY))) {
+ ret = res_querydomain(name, NULL, class, type, answer, anslen);
if (ret > 0)
return (ret);
}
/* if we got here, we didn't satisfy the search.
- * if we did an initial full query, return that query's H_ERRNO
+ * if we did an initial full query, return that query's h_errno
* (note that we wouldn't be here if that query had succeeded).
* else if we ever got a nodata, send that back as the reason.
- * else send back meaningless H_ERRNO, that being the one from
+ * else send back meaningless h_errno, that being the one from
* the last DNSRCH we did.
*/
if (saved_herrno != -1)
- RES_SET_H_ERRNO(statp, saved_herrno);
+ h_errno = saved_herrno;
else if (got_nodata)
- RES_SET_H_ERRNO(statp, NO_DATA);
+ h_errno = NO_DATA;
else if (got_servfail)
- RES_SET_H_ERRNO(statp, TRY_AGAIN);
+ h_errno = TRY_AGAIN;
return (-1);
}
-libresolv_hidden_def (__libc_res_nsearch)
-
-int
-res_nsearch(res_state statp,
- const char *name, /* domain name */
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen) /* size of answer */
-{
- return __libc_res_nsearch(statp, name, class, type, answer,
- anslen, NULL);
-}
-libresolv_hidden_def (res_nsearch)
/*
* Perform a call on res_query on the concatenation of name and domain,
* removing a trailing dot from name if domain is NULL.
*/
-static int
-__libc_res_nquerydomain(res_state statp,
- const char *name,
- const char *domain,
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen, /* size of answer */
- u_char **answerp)
+int
+res_querydomain(name, domain, class, type, answer, anslen)
+ const char *name, *domain;
+ int class, type; /* class and type of query */
+ u_char *answer; /* buffer to put answer */
+ int anslen; /* size of answer */
{
char nbuf[MAXDNAME];
const char *longname = nbuf;
int n, d;
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
#ifdef DEBUG
- if (statp->options & RES_DEBUG)
- printf(";; res_nquerydomain(%s, %s, %d, %d)\n",
+ if (_res.options & RES_DEBUG)
+ printf(";; res_querydomain(%s, %s, %d, %d)\n",
name, domain?domain:"<Nil>", class, type);
#endif
if (domain == NULL) {
@@ -411,7 +349,7 @@ __libc_res_nquerydomain(res_state statp,
*/
n = strlen(name);
if (n >= MAXDNAME) {
- RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ h_errno = NO_RECOVERY;
return (-1);
}
n--;
@@ -424,35 +362,27 @@ __libc_res_nquerydomain(res_state statp,
n = strlen(name);
d = strlen(domain);
if (n + d + 1 >= MAXDNAME) {
- RES_SET_H_ERRNO(statp, NO_RECOVERY);
+ h_errno = NO_RECOVERY;
return (-1);
}
sprintf(nbuf, "%s.%s", name, domain);
}
- return (__libc_res_nquery(statp, longname, class, type, answer,
- anslen, answerp));
+ return (res_query(longname, class, type, answer, anslen));
}
-int
-res_nquerydomain(res_state statp,
- const char *name,
- const char *domain,
- int class, int type, /* class and type of query */
- u_char *answer, /* buffer to put answer */
- int anslen) /* size of answer */
-{
- return __libc_res_nquerydomain(statp, name, domain, class, type,
- answer, anslen, NULL);
-}
-libresolv_hidden_def (res_nquerydomain)
-
const char *
-res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
- char *file, *cp1, *cp2;
- char buf[BUFSIZ];
+hostalias(name)
+ const char *name;
+{
+ char *cp1, *cp2;
FILE *fp;
+ char *file;
+ char buf[BUFSIZ];
+ static char abuf[MAXDNAME];
- if (statp->options & RES_NOALIASES)
+ if (_res.options & RES_NOALIASES)
+ return (NULL);
+ if (issetugid())
return (NULL);
file = getenv("HOSTALIASES");
if (file == NULL || (fp = fopen(file, "r")) == NULL)
@@ -460,26 +390,35 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
setbuf(fp, NULL);
buf[sizeof(buf) - 1] = '\0';
while (fgets(buf, sizeof(buf), fp)) {
- for (cp1 = buf; *cp1 && !isspace(*cp1); ++cp1)
+ for (cp1 = buf; *cp1 && !isspace((unsigned char)*cp1); ++cp1)
;
if (!*cp1)
break;
*cp1 = '\0';
- if (ns_samename(buf, name) == 1) {
- while (isspace(*++cp1))
+ if (!strcasecmp(buf, name)) {
+ while (isspace((unsigned char)*++cp1))
;
if (!*cp1)
break;
- for (cp2 = cp1 + 1; *cp2 && !isspace(*cp2); ++cp2)
+ for (cp2 = cp1 + 1; *cp2 && !isspace((unsigned char)*cp2); ++cp2)
;
- *cp2 = '\0';
- strncpy(dst, cp1, siz - 1);
- dst[siz - 1] = '\0';
+ abuf[sizeof(abuf) - 1] = *cp2 = '\0';
+ strncpy(abuf, cp1, sizeof(abuf) - 1);
fclose(fp);
- return (dst);
+ return (abuf);
}
}
fclose(fp);
return (NULL);
}
-libresolv_hidden_def (res_hostalias)
+
+/*
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <resolv.h>.
+ */
+#undef res_query
+__weak_reference(__res_query, res_query);
+#undef res_search
+__weak_reference(__res_search, res_search);
+#undef res_querydomain
+__weak_reference(__res_querydomain, res_querydomain);
diff --git a/newlib/libc/sys/linux/net/res_send.c b/newlib/libc/sys/linux/net/res_send.c
index 5c2bcf746..153d2f5d9 100644
--- a/newlib/libc/sys/linux/net/res_send.c
+++ b/newlib/libc/sys/linux/net/res_send.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1985, 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:
@@ -10,10 +10,14 @@
* 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
@@ -29,14 +33,14 @@
/*
* 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
@@ -48,7 +52,7 @@
*/
/*
- * Portions Copyright (c) 1996-1999 by Internet Software Consortium.
+ * Portions Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -65,136 +69,144 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$BINDId: res_send.c,v 8.38 2000/03/30 20:16:51 vixie Exp $";
+static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
+static char orig_rcsid[] = "From: Id: res_send.c,v 8.20 1998/04/06 23:27:51 halley Exp $";
#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
-#define s6_addr32 __u6_addr.__u6_addr32
/*
* Send query to name server and wait for reply.
*/
-#include <assert.h>
#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/poll.h>
#include <sys/param.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/uio.h>
-#include <sys/poll.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <arpa/inet.h>
-#include <sys/ioctl.h>
#include <errno.h>
-#include <fcntl.h>
#include <netdb.h>
#include <resolv.h>
-#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include "libc-symbols.h"
-
-#if PACKETSZ > 65536
-#define MAXPACKET PACKETSZ
-#else
-#define MAXPACKET 65536
-#endif
+#include "res_config.h"
-/* From ev_streams.c. */
+static int s = -1; /* socket used for communications */
+static int connected = 0; /* is the socket connected */
+static int vc = 0; /* is the socket a virtual circuit? */
+static int af = 0; /* address family of socket */
+static res_send_qhook Qhook = NULL;
+static res_send_rhook Rhook = NULL;
-static inline void
-__attribute ((always_inline))
-evConsIovec(void *buf, size_t cnt, struct iovec *vec) {
- memset(vec, 0xf5, sizeof (*vec));
- vec->iov_base = buf;
- vec->iov_len = cnt;
-}
-
-/* From ev_timers.c. */
-#define BILLION 1000000000
+#define CAN_RECONNECT 1
-static inline void
-evConsTime(struct timespec *res, time_t sec, long nsec) {
- res->tv_sec = sec;
- res->tv_nsec = nsec;
-}
+#ifndef DEBUG
+# define Dprint(cond, args) /*empty*/
+# define DprintQ(cond, args, query, size) /*empty*/
+# define Aerror(file, string, error, address) /*empty*/
+# define Perror(file, string, error) /*empty*/
+#else
+# define Dprint(cond, args) if (cond) {fprintf args;} else {}
+# define DprintQ(cond, args, query, size) if (cond) {\
+ fprintf args;\
+ __fp_nquery(query, size, stdout);\
+ } else {}
+static char abuf[NI_MAXHOST];
+static char pbuf[NI_MAXSERV];
+static void Aerror(FILE *, char *, int, struct sockaddr *);
+static void Perror(FILE *, char *, int);
+
+ static void
+ Aerror(file, string, error, address)
+ FILE *file;
+ char *string;
+ int error;
+ struct sockaddr *address;
+ {
+ int save = errno;
-static inline void
-evAddTime(struct timespec *res, const struct timespec *addend1,
- const struct timespec *addend2) {
- res->tv_sec = addend1->tv_sec + addend2->tv_sec;
- res->tv_nsec = addend1->tv_nsec + addend2->tv_nsec;
- if (res->tv_nsec >= BILLION) {
- res->tv_sec++;
- res->tv_nsec -= BILLION;
+ if (_res.options & RES_DEBUG) {
+ if (getnameinfo(address, 0, abuf, sizeof(abuf),
+ pbuf, sizeof(pbuf),
+ NI_NUMERICHOST|NI_NUMERICSERV|NI_WITHSCOPEID) != 0) {
+ strncpy(abuf, "?", sizeof(abuf));
+ strncpy(pbuf, "?", sizeof(pbuf));
+ }
+ fprintf(file, "res_send: %s ([%s].%s): %s\n",
+ string, abuf, pbuf, strerror(error));
}
-}
+ errno = save;
+ }
+ static void
+ Perror(file, string, error)
+ FILE *file;
+ char *string;
+ int error;
+ {
+ int save = errno;
-static inline void
-evSubTime(struct timespec *res, const struct timespec *minuend,
- const struct timespec *subtrahend) {
- res->tv_sec = minuend->tv_sec - subtrahend->tv_sec;
- if (minuend->tv_nsec >= subtrahend->tv_nsec)
- res->tv_nsec = minuend->tv_nsec - subtrahend->tv_nsec;
- else {
- res->tv_nsec = (BILLION
- - subtrahend->tv_nsec + minuend->tv_nsec);
- res->tv_sec--;
+ if (_res.options & RES_DEBUG) {
+ fprintf(file, "res_send: %s: %s\n",
+ string, strerror(error));
}
-}
+ errno = save;
+ }
+#endif
-static inline int
-evCmpTime(struct timespec a, struct timespec b) {
- long x = a.tv_sec - b.tv_sec;
+void
+res_send_setqhook(hook)
+ res_send_qhook hook;
+{
- if (x == 0L)
- x = a.tv_nsec - b.tv_nsec;
- return (x < 0L ? (-1) : x > 0L ? (1) : (0));
+ Qhook = hook;
}
-static inline void
-evNowTime(struct timespec *res) {
- struct timeval now;
+void
+res_send_setrhook(hook)
+ res_send_rhook hook;
+{
- if (gettimeofday(&now, NULL) < 0)
- evConsTime(res, 0, 0);
- else
- TIMEVAL_TO_TIMESPEC (&now, res);
+ Rhook = hook;
}
+static struct sockaddr * get_nsaddr(size_t);
-/* Options. Leave them on. */
-/* #undef DEBUG */
-#include "res_debug.h"
-
-#define EXT(res) ((res)->_u._ext)
-
-/* Forward. */
-
-static int send_vc(res_state, const u_char *, int,
- u_char **, int *, int *, int, u_char **);
-static int send_dg(res_state, const u_char *, int,
- u_char **, int *, int *, int,
- int *, int *, u_char **);
-#ifdef DEBUG
-static void Aerror(const res_state, FILE *, const char *, int,
- const struct sockaddr *);
-static void Perror(const res_state, FILE *, const char *, int);
-#endif
-static int sock_eq(struct sockaddr_in6 *, struct sockaddr_in6 *);
-
-/* Reachover. */
-
-static void convaddr4to6(struct sockaddr_in6 *sa);
-void res_pquery(const res_state, const u_char *, int, FILE *);
+/*
+ * pick appropriate nsaddr_list for use. see res_init() for initialization.
+ */
+static struct sockaddr *
+get_nsaddr(n)
+ size_t n;
+{
-/* Public. */
+ if (!_res.nsaddr_list[n].sin_family) {
+ /*
+ * - _res_ext.nsaddr_list[n] holds an address that is larger
+ * than struct sockaddr, and
+ * - user code did not update _res.nsaddr_list[n].
+ */
+ return (struct sockaddr *)&_res_ext.nsaddr_list[n];
+ } else {
+ /*
+ * - user code updated _res.nsaddr_list[n], or
+ * - _res.nsaddr_list[n] has the same content as
+ * _res_ext.nsaddr_list[n].
+ */
+ return (struct sockaddr *)&_res.nsaddr_list[n];
+ }
+}
/* int
* res_isourserver(ina)
@@ -206,38 +218,44 @@ void res_pquery(const res_state, const u_char *, int, FILE *);
* paul vixie, 29may94
*/
int
-res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
+res_isourserver(inp)
+ const struct sockaddr_in *inp;
{
- int ns;
-
- if (inp->sin6_family == AF_INET) {
- struct sockaddr_in *in4p = (struct sockaddr_in *) inp;
- in_port_t port = in4p->sin_port;
- in_addr_t addr = in4p->sin_addr.s_addr;
-
- for (ns = 0; ns < MAXNS; ns++) {
- const struct sockaddr_in *srv =
- (struct sockaddr_in *)EXT(statp).nsaddrs[ns];
-
- if ((srv != NULL) && (srv->sin_family == AF_INET) &&
- (srv->sin_port == port) &&
- (srv->sin_addr.s_addr == INADDR_ANY ||
- srv->sin_addr.s_addr == addr))
- return (1);
- }
- } else if (inp->sin6_family == AF_INET6) {
- for (ns = 0; ns < MAXNS; ns++) {
- const struct sockaddr_in6 *srv = EXT(statp).nsaddrs[ns];
- if ((srv != NULL) && (srv->sin6_family == AF_INET6) &&
- (srv->sin6_port == inp->sin6_port) &&
- !(memcmp(&srv->sin6_addr, &in6addr_any,
- sizeof (struct in6_addr)) &&
- memcmp(&srv->sin6_addr, &inp->sin6_addr,
- sizeof (struct in6_addr))))
- return (1);
- }
- }
- return (0);
+ const struct sockaddr_in6 *in6p = (const struct sockaddr_in6 *)inp;
+ const struct sockaddr_in6 *srv6;
+ const struct sockaddr_in *srv;
+ int ns, ret;
+
+ ret = 0;
+ switch (inp->sin_family) {
+ case AF_INET6:
+ for (ns = 0; ns < _res.nscount; ns++) {
+ srv6 = (struct sockaddr_in6 *)get_nsaddr(ns);
+ if (srv6->sin6_family == in6p->sin6_family &&
+ srv6->sin6_port == in6p->sin6_port &&
+ srv6->sin6_scope_id == in6p->sin6_scope_id &&
+ (IN6_IS_ADDR_UNSPECIFIED(&srv6->sin6_addr) ||
+ IN6_ARE_ADDR_EQUAL(&srv6->sin6_addr,
+ &in6p->sin6_addr))) {
+ ret++;
+ break;
+ }
+ }
+ break;
+ case AF_INET:
+ for (ns = 0; ns < _res.nscount; ns++) {
+ srv = (struct sockaddr_in *)get_nsaddr(ns);
+ if (srv->sin_family == inp->sin_family &&
+ srv->sin_port == inp->sin_port &&
+ (srv->sin_addr.s_addr == INADDR_ANY ||
+ srv->sin_addr.s_addr == inp->sin_addr.s_addr)) {
+ ret++;
+ break;
+ }
+ }
+ break;
+ }
+ return (ret);
}
/* int
@@ -253,8 +271,10 @@ res_ourserver_p(const res_state statp, const struct sockaddr_in6 *inp)
* paul vixie, 29may94
*/
int
-res_nameinquery(const char *name, int type, int class,
- const u_char *buf, const u_char *eom)
+res_nameinquery(name, type, class, buf, eom)
+ const char *name;
+ int type, class;
+ const u_char *buf, *eom;
{
const u_char *cp = buf + HFIXEDSZ;
int qdcount = ntohs(((HEADER*)buf)->qdcount);
@@ -271,13 +291,13 @@ res_nameinquery(const char *name, int type, int class,
return (-1);
ttype = ns_get16(cp); cp += INT16SZ;
tclass = ns_get16(cp); cp += INT16SZ;
- if (ttype == type && tclass == class &&
- ns_samename(tname, name) == 1)
+ if (ttype == type &&
+ tclass == class &&
+ strcasecmp(tname, name) == 0)
return (1);
}
return (0);
}
-libresolv_hidden_def (res_nameinquery)
/* int
* res_queriesmatch(buf1, eom1, buf2, eom2)
@@ -291,8 +311,9 @@ libresolv_hidden_def (res_nameinquery)
* paul vixie, 29may94
*/
int
-res_queriesmatch(const u_char *buf1, const u_char *eom1,
- const u_char *buf2, const u_char *eom2)
+res_queriesmatch(buf1, eom1, buf2, eom2)
+ const u_char *buf1, *eom1;
+ const u_char *buf2, *eom2;
{
const u_char *cp = buf1 + HFIXEDSZ;
int qdcount = ntohs(((HEADER*)buf1)->qdcount);
@@ -304,8 +325,8 @@ res_queriesmatch(const u_char *buf1, const u_char *eom1,
* Only header section present in replies to
* dynamic update packets.
*/
- if ((((HEADER *)buf1)->opcode == ns_o_update) &&
- (((HEADER *)buf2)->opcode == ns_o_update))
+ if ( (((HEADER *)buf1)->opcode == ns_o_update) &&
+ (((HEADER *)buf2)->opcode == ns_o_update) )
return (1);
if (qdcount != ntohs(((HEADER*)buf2)->qdcount))
@@ -327,172 +348,75 @@ res_queriesmatch(const u_char *buf1, const u_char *eom1,
}
return (1);
}
-libresolv_hidden_def (res_queriesmatch)
int
-__libc_res_nsend(res_state statp, const u_char *buf, int buflen,
- u_char *ans, int anssiz, u_char **ansp)
+res_send(buf, buflen, ans, anssiz)
+ const u_char *buf;
+ int buflen;
+ u_char *ans;
+ int anssiz;
{
- int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
+ HEADER *hp = (HEADER *) buf;
+ HEADER *anhp = (HEADER *) ans;
+ int gotsomewhere, connreset, terrno, try, v_circuit, resplen, ns, n;
+ int kq;
+ u_int badns; /* XXX NSMAX can't exceed #/bits in this variable */
- if (statp->nscount == 0) {
- __set_errno (ESRCH);
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ /* errno should have been set by res_init() in this case. */
return (-1);
}
-
if (anssiz < HFIXEDSZ) {
- __set_errno (EINVAL);
+ errno = EINVAL;
return (-1);
}
-
- if ((statp->qhook || statp->rhook) && anssiz < MAXPACKET && ansp) {
- u_char *buf = malloc (MAXPACKET);
- if (buf == NULL)
- return (-1);
- memcpy (buf, ans, HFIXEDSZ);
- *ansp = buf;
- ans = buf;
- anssiz = MAXPACKET;
- }
-
- DprintQ((statp->options & RES_DEBUG) || (statp->pfcode & RES_PRF_QUERY),
+ DprintQ((_res.options & RES_DEBUG) || (_res.pfcode & RES_PRF_QUERY),
(stdout, ";; res_send()\n"), buf, buflen);
- v_circuit = (statp->options & RES_USEVC) || buflen > PACKETSZ;
+ v_circuit = (_res.options & RES_USEVC) || buflen > PACKETSZ;
gotsomewhere = 0;
+ connreset = 0;
terrno = ETIMEDOUT;
+ badns = 0;
/*
- * If the ns_addr_list in the resolver context has changed, then
- * invalidate our cached copy and the associated timing data.
+ * Send request, RETRY times, or until successful
*/
- if (EXT(statp).nsinit) {
- int needclose = 0;
-
- if (EXT(statp).nscount != statp->nscount)
- needclose++;
+ for (try = 0; try < _res.retry; try++) {
+ for (ns = 0; ns < _res.nscount; ns++) {
+ struct sockaddr *nsap = get_nsaddr(ns);
+ socklen_t salen;
+
+ if (nsap->sa_family == AF_INET6)
+ salen = sizeof(struct sockaddr_in6);
+ else if (nsap->sa_family == AF_INET)
+ salen = sizeof(struct sockaddr_in);
else
- for (ns = 0; ns < MAXNS; ns++) {
- unsigned int map = EXT(statp).nsmap[ns];
- if (map < MAXNS
- && !sock_eq((struct sockaddr_in6 *)
- &statp->nsaddr_list[map],
- EXT(statp).nsaddrs[ns]))
- {
- needclose++;
- break;
- }
- }
- if (needclose)
- res_nclose(statp);
- }
-
- /*
- * Maybe initialize our private copy of the ns_addr_list.
- */
- if (EXT(statp).nsinit == 0) {
- unsigned char map[MAXNS];
+ salen = 0; /*unknown, die on connect*/
- memset (map, MAXNS, sizeof (map));
- for (n = 0; n < MAXNS; n++) {
- ns = EXT(statp).nsmap[n];
- if (ns < statp->nscount)
- map[ns] = n;
- else if (ns < MAXNS) {
- free(EXT(statp).nsaddrs[n]);
- EXT(statp).nsaddrs[n] = NULL;
- EXT(statp).nsmap[n] = MAXNS;
- }
- }
- n = statp->nscount;
- if (statp->nscount > EXT(statp).nscount)
- for (n = EXT(statp).nscount, ns = 0;
- n < statp->nscount; n++) {
- while (ns < MAXNS
- && EXT(statp).nsmap[ns] != MAXNS)
- ns++;
- if (ns == MAXNS)
- break;
- EXT(statp).nsmap[ns] = n;
- map[n] = ns++;
- }
- EXT(statp).nscount = n;
- for (ns = 0; ns < EXT(statp).nscount; ns++) {
- n = map[ns];
- if (EXT(statp).nsaddrs[n] == NULL)
- EXT(statp).nsaddrs[n] =
- malloc(sizeof (struct sockaddr_in6));
- if (EXT(statp).nsaddrs[n] != NULL) {
- memcpy(EXT(statp).nsaddrs[n],
- &statp->nsaddr_list[ns],
- sizeof (struct sockaddr_in));
- EXT(statp).nssocks[n] = -1;
- n++;
- }
- }
- EXT(statp).nsinit = 1;
- }
-
- /*
- * Some resolvers want to even out the load on their nameservers.
- * Note that RES_BLAST overrides RES_ROTATE.
- */
- if ((statp->options & RES_ROTATE) != 0 &&
- (statp->options & RES_BLAST) == 0) {
- struct sockaddr_in6 *ina;
- unsigned int map;
-
- n = 0;
- while (n < MAXNS && EXT(statp).nsmap[n] == MAXNS)
- n++;
- if (n < MAXNS) {
- ina = EXT(statp).nsaddrs[n];
- map = EXT(statp).nsmap[n];
- for (;;) {
- ns = n + 1;
- while (ns < MAXNS
- && EXT(statp).nsmap[ns] == MAXNS)
- ns++;
- if (ns == MAXNS)
- break;
- EXT(statp).nsaddrs[n] = EXT(statp).nsaddrs[ns];
- EXT(statp).nsmap[n] = EXT(statp).nsmap[ns];
- n = ns;
- }
- EXT(statp).nsaddrs[n] = ina;
- EXT(statp).nsmap[n] = map;
+ same_ns:
+ if (badns & (1 << ns)) {
+ res_close();
+ goto next_ns;
}
- }
-
- /*
- * Send request, RETRY times, or until successful.
- */
- for (try = 0; try < statp->retry; try++) {
- for (ns = 0; ns < MAXNS; ns++)
- {
- struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
- if (nsap == NULL)
- goto next_ns;
- same_ns:
- if (statp->qhook) {
+ if (Qhook) {
int done = 0, loops = 0;
do {
res_sendhookact act;
- struct sockaddr_in *nsap4;
- nsap4 = (struct sockaddr_in *) nsap;
- act = (*statp->qhook)(&nsap4, &buf, &buflen,
- ans, anssiz, &resplen);
- nsap = (struct sockaddr_in6 *) nsap4;
+ act = (*Qhook)((struct sockaddr_in **)&nsap,
+ &buf, &buflen,
+ ans, anssiz, &resplen);
switch (act) {
case res_goahead:
done = 1;
break;
case res_nextns:
- res_nclose(statp);
+ res_close();
goto next_ns;
case res_done:
+ close(kq);
return (resplen);
case res_modified:
/* give the hook another try */
@@ -502,77 +426,473 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
case res_error:
/*FALLTHROUGH*/
default:
+ close(kq);
return (-1);
}
} while (!done);
}
-#ifdef DEBUG
- char tmpbuf[40];
-#endif
- Dprint(statp->options & RES_DEBUG,
+ Dprint((_res.options & RES_DEBUG) &&
+ getnameinfo(nsap, salen, abuf, sizeof(abuf),
+ NULL, 0, NI_NUMERICHOST | NI_WITHSCOPEID) == 0,
(stdout, ";; Querying server (# %d) address = %s\n",
- ns + 1, inet_ntop(AF_INET6, &nsap->sin6_addr,
- tmpbuf, sizeof (tmpbuf))));
+ ns + 1, abuf));
if (v_circuit) {
- /* Use VC; at most one attempt per server. */
- try = statp->retry;
- n = send_vc(statp, buf, buflen, &ans, &anssiz, &terrno,
- ns, ansp);
- if (n < 0)
- return (-1);
- if (n == 0)
+ int truncated;
+ u_short len;
+ u_char *cp;
+ ssize_t rc;
+
+ /*
+ * Use virtual circuit;
+ * at most one attempt per server.
+ */
+ try = _res.retry;
+ truncated = 0;
+ if (s < 0 || !vc || hp->opcode == ns_o_update ||
+ af != nsap->sa_family) {
+ if (s >= 0)
+ res_close();
+
+ af = nsap->sa_family;
+ s = socket(af, SOCK_STREAM, 0);
+ if (s < 0) {
+ terrno = errno;
+ Perror(stderr, "socket(vc)", errno);
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+ errno = 0;
+ if (connect(s, nsap, salen) < 0) {
+ terrno = errno;
+ Aerror(stderr, "connect/vc",
+ errno, nsap);
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+ vc = 1;
+ }
+ /*
+ * Send length & message
+ */
+ putshort((u_short)buflen, (u_char*)&len);
+#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2
+ {
+ struct iovec iov[2];
+ iov[0].iov_base = (caddr_t)&len;
+ iov[0].iov_len = INT16SZ;
+ iov[1].iov_base = (caddr_t)buf;
+ iov[1].iov_len = buflen;
+ rc = writev(s, iov, 2);
+ }
+#else /* EL/IX level 1 */
+ {
+ char *tmpbuf;
+ tmpbuf = malloc (INT16SZ + buflen);
+ memcpy (tmpbuf, &len, INT16SZ);
+ memcpy (tmpbuf + INT16SZ, buf, buflen);
+ rc = write (s, tmpbuf, INT16SZ + buflen);
+ }
+#endif /* EL/IX level 1 */
+ if (rc != (INT16SZ + buflen)) {
+ terrno = errno;
+ Perror(stderr, "write failed", errno);
+ badns |= (1 << ns);
+ res_close();
goto next_ns;
- resplen = n;
- } else {
- /* Use datagrams. */
- n = send_dg(statp, buf, buflen, &ans, &anssiz, &terrno,
- ns, &v_circuit, &gotsomewhere, ansp);
- if (n < 0)
- return (-1);
- if (n == 0)
+ }
+ /*
+ * Receive length & response
+ */
+ read_len:
+ cp = ans;
+ len = INT16SZ;
+ while ((n = read(s, (char *)cp, (int)len)) > 0) {
+ cp += n;
+ if ((len -= n) <= 0)
+ break;
+ }
+ if (n <= 0) {
+ terrno = errno;
+ Perror(stderr, "read failed", errno);
+ res_close();
+ /*
+ * A long running process might get its TCP
+ * connection reset if the remote server was
+ * restarted. Requery the server instead of
+ * trying a new one. When there is only one
+ * server, this means that a query might work
+ * instead of failing. We only allow one reset
+ * per query to prevent looping.
+ */
+ if (terrno == ECONNRESET && !connreset) {
+ connreset = 1;
+ res_close();
+ goto same_ns;
+ }
+ res_close();
goto next_ns;
- if (v_circuit)
- goto same_ns;
- resplen = n;
- }
+ }
+ resplen = ns_get16(ans);
+ if (resplen > anssiz) {
+ Dprint(_res.options & RES_DEBUG,
+ (stdout, ";; response truncated\n")
+ );
+ truncated = 1;
+ len = anssiz;
+ } else
+ len = resplen;
+ if (len < HFIXEDSZ) {
+ /*
+ * Undersized message.
+ */
+ Dprint(_res.options & RES_DEBUG,
+ (stdout, ";; undersized: %d\n", len));
+ terrno = EMSGSIZE;
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+ cp = ans;
+ while (len != 0 &&
+ (n = read(s, (char *)cp, (int)len)) > 0) {
+ cp += n;
+ len -= n;
+ }
+ if (n <= 0) {
+ terrno = errno;
+ Perror(stderr, "read(vc)", errno);
+ res_close();
+ goto next_ns;
+ }
+ if (truncated) {
+ /*
+ * Flush rest of answer
+ * so connection stays in synch.
+ */
+ anhp->tc = 1;
+ len = resplen - anssiz;
+ while (len != 0) {
+ char junk[PACKETSZ];
+
+ n = (len > sizeof(junk)
+ ? sizeof(junk)
+ : len);
+ if ((n = read(s, junk, n)) > 0)
+ len -= n;
+ else
+ break;
+ }
+ }
+ /*
+ * The calling applicating has bailed out of
+ * a previous call and failed to arrange to have
+ * the circuit closed or the server has got
+ * itself confused. Anyway drop the packet and
+ * wait for the correct one.
+ */
+ if (hp->id != anhp->id) {
+ DprintQ((_res.options & RES_DEBUG) ||
+ (_res.pfcode & RES_PRF_REPLY),
+ (stdout, ";; old answer (unexpected):\n"),
+ ans, (resplen>anssiz)?anssiz:resplen);
+ goto read_len;
+ }
+ } else {
+ /*
+ * Use datagrams.
+ */
+ struct pollfd pfd[1];
+ int ptimeout;
+ struct timespec ts;
+ struct timeval timeout, ctv;
+ struct sockaddr_storage from;
+ int fromlen;
+
+ if (s < 0 || vc || af != nsap->sa_family) {
+ if (vc)
+ res_close();
+ af = nsap->sa_family;
+ s = socket(af, SOCK_DGRAM, 0);
+ if (s < 0) {
+#ifndef CAN_RECONNECT
+ bad_dg_sock:
+#endif
+ terrno = errno;
+ Perror(stderr, "socket(dg)", errno);
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+ connected = 0;
+ }
+#ifndef CANNOT_CONNECT_DGRAM
+ /*
+ * On a 4.3BSD+ machine (client and server,
+ * actually), sending to a nameserver datagram
+ * port with no nameserver will cause an
+ * ICMP port unreachable message to be returned.
+ * If our datagram socket is "connected" to the
+ * server, we get an ECONNREFUSED error on the next
+ * socket operation, and select returns if the
+ * error message is received. We can thus detect
+ * the absence of a nameserver without timing out.
+ * If we have sent queries to at least two servers,
+ * however, we don't want to remain connected,
+ * as we wish to receive answers from the first
+ * server to respond.
+ *
+ * When the option "insecure1" is specified, we'd
+ * rather expect to see responses from an "unknown"
+ * address. In order to let the kernel accept such
+ * responses, do not connect the socket here.
+ * XXX: or do we need an explicit option to disable
+ * connecting?
+ */
+ if (!(_res.options & RES_INSECURE1) &&
+ (_res.nscount == 1 || (try == 0 && ns == 0))) {
+ /*
+ * Connect only if we are sure we won't
+ * receive a response from another server.
+ */
+ if (!connected) {
+ if (connect(s, nsap, salen) < 0) {
+ Aerror(stderr,
+ "connect(dg)",
+ errno, nsap);
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+ connected = 1;
+ }
- Dprint((statp->options & RES_DEBUG) ||
- ((statp->pfcode & RES_PRF_REPLY) &&
- (statp->pfcode & RES_PRF_HEAD1)),
- (stdout, ";; got answer:\n"));
+ if (send(s, (char*)buf, buflen, 0) != buflen) {
+ Perror(stderr, "send", errno);
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+ } else {
+ /*
+ * Disconnect if we want to listen
+ * for responses from more than one server.
+ */
+ if (connected) {
+#ifdef CAN_RECONNECT
+ /* XXX: any errornous address */
+ struct sockaddr_in no_addr;
+
+ no_addr.sin_family = AF_INET;
+ no_addr.sin_addr.s_addr = INADDR_ANY;
+ no_addr.sin_port = 0;
+ (void) connect(s,
+ (struct sockaddr *)
+ &no_addr,
+ sizeof no_addr);
+#else
+ int s1 = socket(af, SOCK_DGRAM,0);
+ if (s1 < 0)
+ goto bad_dg_sock;
+ (void)_dup2(s1, s);
+ (void)close(s1);
+ Dprint(_res.options & RES_DEBUG,
+ (stdout, ";; new DG socket\n"))
+#endif /* CAN_RECONNECT */
+ connected = 0;
+ errno = 0;
+ }
+#endif /* !CANNOT_CONNECT_DGRAM */
+ if (sendto(s, (char*)buf, buflen, 0,
+ nsap, salen) != buflen) {
+ Aerror(stderr, "sendto", errno, nsap);
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+#ifndef CANNOT_CONNECT_DGRAM
+ }
+#endif /* !CANNOT_CONNECT_DGRAM */
+
+ /*
+ * Wait for reply
+ */
- DprintQ((statp->options & RES_DEBUG) ||
- (statp->pfcode & RES_PRF_REPLY),
- (stdout, "%s", ""),
- ans, (resplen > anssiz) ? anssiz : resplen);
+ timeout.tv_sec = (_res.retrans << try);
+ if (try > 0)
+ timeout.tv_sec /= _res.nscount;
+ if ((long) timeout.tv_sec <= 0)
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+ TIMEVAL_TO_TIMESPEC(&timeout, &ts);
+ (void) gettimeofday(&ctv, NULL);
+ timeradd(&timeout, &ctv, &timeout);
+
+ /* Convert struct timespec in milliseconds. */
+ ptimeout = timeout.tv_sec * 1000 + timeout.tv_usec / 1000;
+ wait:
+ pfd[0].fd = s;
+ pfd[0].events = POLLIN;
+ n = poll (pfd, 1, ptimeout);
+
+ if (s < 0) {
+ Perror(stderr, "s out-of-bounds", EMFILE);
+ res_close();
+ goto next_ns;
+ }
+ if (n < 0) {
+ if (errno == EINTR) {
+ (void) gettimeofday(&ctv, NULL);
+ if (timercmp(&ctv, &timeout, <)) {
+ timersub(&timeout, &ctv, &ctv);
+ TIMEVAL_TO_TIMESPEC(&ctv, &ts);
+ goto wait;
+ }
+ }
+ Perror(stderr, "poll", errno);
+ res_close();
+ goto next_ns;
+ }
+
+ if (n == 0) {
+ /*
+ * timeout
+ */
+ Dprint(_res.options & RES_DEBUG,
+ (stdout, ";; timeout\n"));
+ gotsomewhere = 1;
+ res_close();
+ goto next_ns;
+ }
+ errno = 0;
+ fromlen = sizeof(from);
+ resplen = recvfrom(s, (char*)ans, anssiz, 0,
+ (struct sockaddr *)&from, &fromlen);
+ if (resplen <= 0) {
+ Perror(stderr, "recvfrom", errno);
+ res_close();
+ goto next_ns;
+ }
+ gotsomewhere = 1;
+ if (resplen < HFIXEDSZ) {
+ /*
+ * Undersized message.
+ */
+ Dprint(_res.options & RES_DEBUG,
+ (stdout, ";; undersized: %d\n",
+ resplen));
+ terrno = EMSGSIZE;
+ badns |= (1 << ns);
+ res_close();
+ goto next_ns;
+ }
+ if (hp->id != anhp->id) {
+ /*
+ * response from old query, ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((_res.options & RES_DEBUG) ||
+ (_res.pfcode & RES_PRF_REPLY),
+ (stdout, ";; old answer:\n"),
+ ans, (resplen>anssiz)?anssiz:resplen);
+ goto wait;
+ }
+#ifdef CHECK_SRVR_ADDR
+ if (!(_res.options & RES_INSECURE1) &&
+ !res_isourserver((struct sockaddr_in *)&from)) {
+ /*
+ * response from wrong server? ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((_res.options & RES_DEBUG) ||
+ (_res.pfcode & RES_PRF_REPLY),
+ (stdout, ";; not our server:\n"),
+ ans, (resplen>anssiz)?anssiz:resplen);
+ goto wait;
+ }
+#endif
+ if (!(_res.options & RES_INSECURE2) &&
+ !res_queriesmatch(buf, buf + buflen,
+ ans, ans + anssiz)) {
+ /*
+ * response contains wrong query? ignore it.
+ * XXX - potential security hazard could
+ * be detected here.
+ */
+ DprintQ((_res.options & RES_DEBUG) ||
+ (_res.pfcode & RES_PRF_REPLY),
+ (stdout, ";; wrong query name:\n"),
+ ans, (resplen>anssiz)?anssiz:resplen);
+ goto wait;
+ }
+ if (anhp->rcode == SERVFAIL ||
+ anhp->rcode == NOTIMP ||
+ anhp->rcode == REFUSED) {
+ DprintQ(_res.options & RES_DEBUG,
+ (stdout, "server rejected query:\n"),
+ ans, (resplen>anssiz)?anssiz:resplen);
+ badns |= (1 << ns);
+ res_close();
+ /* don't retry if called from dig */
+ if (!_res.pfcode)
+ goto next_ns;
+ }
+ if (!(_res.options & RES_IGNTC) && anhp->tc) {
+ /*
+ * get rest of answer;
+ * use TCP with same server.
+ */
+ Dprint(_res.options & RES_DEBUG,
+ (stdout, ";; truncated answer\n"));
+ v_circuit = 1;
+ res_close();
+ goto same_ns;
+ }
+ } /*if vc/dg*/
+ Dprint((_res.options & RES_DEBUG) ||
+ ((_res.pfcode & RES_PRF_REPLY) &&
+ (_res.pfcode & RES_PRF_HEAD1)),
+ (stdout, ";; got answer:\n"));
+#if 0
+ DprintQ((_res.options & RES_DEBUG) ||
+ (_res.pfcode & RES_PRF_REPLY),
+ (stdout, ""),
+ ans, (resplen>anssiz)?anssiz:resplen);
+#endif
/*
+ * If using virtual circuits, we assume that the first server
+ * is preferred over the rest (i.e. it is on the local
+ * machine) and only keep that one open.
* If we have temporarily opened a virtual circuit,
* or if we haven't been asked to keep a socket open,
* close the socket.
*/
- if ((v_circuit && (statp->options & RES_USEVC) == 0) ||
- (statp->options & RES_STAYOPEN) == 0) {
- res_nclose(statp);
+ if ((v_circuit && (!(_res.options & RES_USEVC) || ns != 0)) ||
+ !(_res.options & RES_STAYOPEN)) {
+ res_close();
}
- if (statp->rhook) {
+ if (Rhook) {
int done = 0, loops = 0;
do {
res_sendhookact act;
- act = (*statp->rhook)((struct sockaddr_in *)
- nsap, buf, buflen,
- ans, anssiz, &resplen);
+ act = (*Rhook)((struct sockaddr_in *)nsap,
+ buf, buflen,
+ ans, anssiz, &resplen);
switch (act) {
case res_goahead:
case res_done:
done = 1;
break;
case res_nextns:
- res_nclose(statp);
+ res_close();
goto next_ns;
case res_modified:
/* give the hook another try */
@@ -582,535 +902,53 @@ __libc_res_nsend(res_state statp, const u_char *buf, int buflen,
case res_error:
/*FALLTHROUGH*/
default:
+ close(kq);
return (-1);
}
} while (!done);
}
+ close(kq);
return (resplen);
- next_ns: ;
+ next_ns: ;
} /*foreach ns*/
} /*foreach retry*/
- res_nclose(statp);
+ res_close();
+ close(kq);
if (!v_circuit) {
if (!gotsomewhere)
- __set_errno (ECONNREFUSED); /* no nameservers found */
+ errno = ECONNREFUSED; /* no nameservers found */
else
- __set_errno (ETIMEDOUT); /* no answer obtained */
+ errno = ETIMEDOUT; /* no answer obtained */
} else
- __set_errno (terrno);
+ errno = terrno;
return (-1);
}
-int
-res_nsend(res_state statp,
- const u_char *buf, int buflen, u_char *ans, int anssiz)
-{
- return __libc_res_nsend(statp, buf, buflen, ans, anssiz, NULL);
-}
-libresolv_hidden_def (res_nsend)
-
-/* Private */
-
-static int
-send_vc(res_state statp,
- const u_char *buf, int buflen, u_char **ansp, int *anssizp,
- int *terrno, int ns, u_char **anscp)
-{
- const HEADER *hp = (HEADER *) buf;
- u_char *ans = *ansp;
- int anssiz = *anssizp;
- HEADER *anhp = (HEADER *) ans;
- struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
- int truncating, connreset, resplen, n;
- struct iovec iov[2];
- u_short len;
- u_char *cp;
-
- connreset = 0;
- same_ns:
- truncating = 0;
-
- /* Are we still talking to whom we want to talk to? */
- if (statp->_vcsock >= 0 && (statp->_flags & RES_F_VC) != 0) {
- struct sockaddr_in6 peer;
- int size = sizeof peer;
-
- if (getpeername(statp->_vcsock,
- (struct sockaddr *)&peer, &size) < 0 ||
- !sock_eq(&peer, nsap)) {
- res_nclose(statp);
- statp->_flags &= ~RES_F_VC;
- }
- }
-
- if (statp->_vcsock < 0 || (statp->_flags & RES_F_VC) == 0) {
- if (statp->_vcsock >= 0)
- res_nclose(statp);
-
- statp->_vcsock = socket(nsap->sin6_family, SOCK_STREAM, 0);
- if (statp->_vcsock < 0) {
- *terrno = errno;
- Perror(statp, stderr, "socket(vc)", errno);
- return (-1);
- }
- __set_errno (0);
- if (connect(statp->_vcsock, (struct sockaddr *)nsap,
- sizeof *nsap) < 0) {
- *terrno = errno;
- Aerror(statp, stderr, "connect/vc", errno,
- (struct sockaddr *) nsap);
- res_nclose(statp);
- return (0);
- }
- statp->_flags |= RES_F_VC;
- }
-
- /*
- * Send length & message
- */
- putshort((u_short)buflen, (u_char*)&len);
- evConsIovec(&len, INT16SZ, &iov[0]);
- evConsIovec((void*)buf, buflen, &iov[1]);
- if (TEMP_FAILURE_RETRY (writev(statp->_vcsock, iov, 2))
- != (INT16SZ + buflen)) {
- *terrno = errno;
- Perror(statp, stderr, "write failed", errno);
- res_nclose(statp);
- return (0);
- }
- /*
- * Receive length & response
- */
- read_len:
- cp = ans;
- len = INT16SZ;
- while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, (char *)cp,
- (int)len))) > 0) {
- cp += n;
- if ((len -= n) <= 0)
- break;
- }
- if (n <= 0) {
- *terrno = errno;
- Perror(statp, stderr, "read failed", errno);
- res_nclose(statp);
- /*
- * A long running process might get its TCP
- * connection reset if the remote server was
- * restarted. Requery the server instead of
- * trying a new one. When there is only one
- * server, this means that a query might work
- * instead of failing. We only allow one reset
- * per query to prevent looping.
- */
- if (*terrno == ECONNRESET && !connreset) {
- connreset = 1;
- res_nclose(statp);
- goto same_ns;
- }
- res_nclose(statp);
- return (0);
- }
- resplen = ns_get16(ans);
- if (resplen > anssiz) {
- if (anscp) {
- ans = malloc (MAXPACKET);
- if (ans == NULL) {
- *terrno = ENOMEM;
- res_nclose(statp);
- return (0);
- }
- anssiz = MAXPACKET;
- *anssizp = MAXPACKET;
- *ansp = ans;
- *anscp = ans;
- anhp = (HEADER *) ans;
- len = resplen;
- } else {
- Dprint(statp->options & RES_DEBUG,
- (stdout, ";; response truncated\n")
- );
- truncating = 1;
- len = anssiz;
- }
- } else
- len = resplen;
- if (len < HFIXEDSZ) {
- /*
- * Undersized message.
- */
- Dprint(statp->options & RES_DEBUG,
- (stdout, ";; undersized: %d\n", len));
- *terrno = EMSGSIZE;
- res_nclose(statp);
- return (0);
- }
- cp = ans;
- while (len != 0 && (n = read(statp->_vcsock, (char *)cp, (int)len)) > 0){
- cp += n;
- len -= n;
- }
- if (n <= 0) {
- *terrno = errno;
- Perror(statp, stderr, "read(vc)", errno);
- res_nclose(statp);
- return (0);
- }
- if (truncating) {
- /*
- * Flush rest of answer so connection stays in synch.
- */
- anhp->tc = 1;
- len = resplen - anssiz;
- while (len != 0) {
- char junk[PACKETSZ];
-
- n = read(statp->_vcsock, junk,
- (len > sizeof junk) ? sizeof junk : len);
- if (n > 0)
- len -= n;
- else
- break;
- }
- }
- /*
- * If the calling applicating has bailed out of
- * a previous call and failed to arrange to have
- * the circuit closed or the server has got
- * itself confused, then drop the packet and
- * wait for the correct one.
- */
- if (hp->id != anhp->id) {
- DprintQ((statp->options & RES_DEBUG) ||
- (statp->pfcode & RES_PRF_REPLY),
- (stdout, ";; old answer (unexpected):\n"),
- ans, (resplen > anssiz) ? anssiz: resplen);
- goto read_len;
- }
-
- /*
- * All is well, or the error is fatal. Signal that the
- * next nameserver ought not be tried.
- */
- return (resplen);
-}
-
-static int
-send_dg(res_state statp,
- const u_char *buf, int buflen, u_char **ansp, int *anssizp,
- int *terrno, int ns, int *v_circuit, int *gotsomewhere, u_char **anscp)
-{
- const HEADER *hp = (HEADER *) buf;
- u_char *ans = *ansp;
- int anssiz = *anssizp;
- HEADER *anhp = (HEADER *) ans;
- struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
- struct timespec now, timeout, finish;
- struct pollfd pfd[1];
- int ptimeout;
- struct sockaddr_in6 from;
- static int socket_pf = 0;
- int fromlen, resplen, seconds, n;
-
- if (EXT(statp).nssocks[ns] == -1) {
- /* only try IPv6 if IPv6 NS and if not failed before */
- if ((EXT(statp).nscount6 > 0) && (socket_pf != PF_INET)) {
- EXT(statp).nssocks[ns] =
- socket(PF_INET6, SOCK_DGRAM, 0);
- socket_pf = EXT(statp).nssocks[ns] < 0 ? PF_INET
- : PF_INET6;
- }
- if (EXT(statp).nssocks[ns] < 0)
- EXT(statp).nssocks[ns] = socket(PF_INET, SOCK_DGRAM, 0);
- if (EXT(statp).nssocks[ns] < 0) {
- *terrno = errno;
- Perror(statp, stderr, "socket(dg)", errno);
- return (-1);
- }
- /* If IPv6 socket and nsap is IPv4, make it IPv4-mapped */
- if ((socket_pf == PF_INET6) && (nsap->sin6_family == AF_INET))
- convaddr4to6(nsap);
- /*
- * On a 4.3BSD+ machine (client and server,
- * actually), sending to a nameserver datagram
- * port with no nameserver will cause an
- * ICMP port unreachable message to be returned.
- * If our datagram socket is "connected" to the
- * server, we get an ECONNREFUSED error on the next
- * socket operation, and select returns if the
- * error message is received. We can thus detect
- * the absence of a nameserver without timing out.
- */
- if (connect(EXT(statp).nssocks[ns], (struct sockaddr *)nsap,
- sizeof *nsap) < 0) {
- Aerror(statp, stderr, "connect(dg)", errno,
- (struct sockaddr *) nsap);
- res_nclose(statp);
- return (0);
- }
- /* Make socket non-blocking. */
- int fl = fcntl (EXT(statp).nssocks[ns], F_GETFL);
- if (fl != -1)
- fcntl (EXT(statp).nssocks[ns], F_SETFL,
- fl | O_NONBLOCK);
- Dprint(statp->options & RES_DEBUG,
- (stdout, ";; new DG socket\n"))
- }
-
- /*
- * Compute time for the total operation.
- */
- seconds = (statp->retrans << ns);
- if (ns > 0)
- seconds /= statp->nscount;
- if (seconds <= 0)
- seconds = 1;
- evNowTime(&now);
- evConsTime(&timeout, seconds, 0);
- evAddTime(&finish, &now, &timeout);
- int need_recompute = 0;
- int nwritten = 0;
- pfd[0].fd = EXT(statp).nssocks[ns];
- pfd[0].events = POLLOUT;
- wait:
- if (need_recompute) {
- evNowTime(&now);
- if (evCmpTime(finish, now) <= 0) {
- Perror(statp, stderr, "select", errno);
- res_nclose(statp);
- return (0);
- }
- evSubTime(&timeout, &finish, &now);
- }
- /* Convert struct timespec in milliseconds. */
- ptimeout = timeout.tv_sec * 1000 + timeout.tv_nsec / 1000000;
-
- n = 0;
- if (nwritten == 0)
- n = poll (pfd, 1, 0);
- if (__builtin_expect (n == 0, 0)) {
- n = poll (pfd, 1, ptimeout);
- need_recompute = 1;
- }
- if (n == 0) {
- Dprint(statp->options & RES_DEBUG, (stdout,
- ";; timeout sending\n"));
- *gotsomewhere = 1;
- return (0);
- }
- if (n < 0) {
- if (errno == EINTR) {
- recompute_resend:
- evNowTime(&now);
- if (evCmpTime(finish, now) > 0) {
- evSubTime(&timeout, &finish, &now);
- goto wait;
- }
- }
- Perror(statp, stderr, "poll", errno);
- res_nclose(statp);
- return (0);
- }
- __set_errno (0);
- if (pfd[0].revents & POLLOUT) {
- if (send(pfd[0].fd, (char*)buf, buflen, 0) != buflen) {
- if (errno == EINTR || errno == EAGAIN)
- goto recompute_resend;
- Perror(statp, stderr, "send", errno);
- res_nclose(statp);
- return (0);
- }
- pfd[0].events = POLLIN;
- ++nwritten;
- goto wait;
- } else if (pfd[0].revents & POLLIN) {
- fromlen = sizeof(struct sockaddr_in6);
- if (anssiz < MAXPACKET
- && anscp
- && (ioctl (pfd[0].fd, FIONREAD, &resplen) < 0
- || anssiz < resplen)) {
- ans = malloc (MAXPACKET);
- if (ans == NULL)
- ans = *ansp;
- else {
- anssiz = MAXPACKET;
- *anssizp = MAXPACKET;
- *ansp = ans;
- *anscp = ans;
- anhp = (HEADER *) ans;
- }
- }
- resplen = recvfrom(pfd[0].fd, (char*)ans, anssiz,0,
- (struct sockaddr *)&from, &fromlen);
- if (resplen <= 0) {
- if (errno == EINTR || errno == EAGAIN) {
- need_recompute = 1;
- goto wait;
- }
- Perror(statp, stderr, "recvfrom", errno);
- res_nclose(statp);
- return (0);
- }
- *gotsomewhere = 1;
- if (resplen < HFIXEDSZ) {
- /*
- * Undersized message.
- */
- Dprint(statp->options & RES_DEBUG,
- (stdout, ";; undersized: %d\n",
- resplen));
- *terrno = EMSGSIZE;
- res_nclose(statp);
- return (0);
- }
- if (hp->id != anhp->id) {
- /*
- * response from old query, ignore it.
- * XXX - potential security hazard could
- * be detected here.
- */
- DprintQ((statp->options & RES_DEBUG) ||
- (statp->pfcode & RES_PRF_REPLY),
- (stdout, ";; old answer:\n"),
- ans, (resplen > anssiz) ? anssiz : resplen);
- goto wait;
- }
- if (!(statp->options & RES_INSECURE1) &&
- !res_ourserver_p(statp, &from)) {
- /*
- * response from wrong server? ignore it.
- * XXX - potential security hazard could
- * be detected here.
- */
- DprintQ((statp->options & RES_DEBUG) ||
- (statp->pfcode & RES_PRF_REPLY),
- (stdout, ";; not our server:\n"),
- ans, (resplen > anssiz) ? anssiz : resplen);
- goto wait;
- }
- if (!(statp->options & RES_INSECURE2) &&
- !res_queriesmatch(buf, buf + buflen,
- ans, ans + anssiz)) {
- /*
- * response contains wrong query? ignore it.
- * XXX - potential security hazard could
- * be detected here.
- */
- DprintQ((statp->options & RES_DEBUG) ||
- (statp->pfcode & RES_PRF_REPLY),
- (stdout, ";; wrong query name:\n"),
- ans, (resplen > anssiz) ? anssiz : resplen);
- goto wait;
- }
- if (anhp->rcode == SERVFAIL ||
- anhp->rcode == NOTIMP ||
- anhp->rcode == REFUSED) {
- DprintQ(statp->options & RES_DEBUG,
- (stdout, "server rejected query:\n"),
- ans, (resplen > anssiz) ? anssiz : resplen);
- res_nclose(statp);
- /* don't retry if called from dig */
- if (!statp->pfcode)
- return (0);
- }
- if (!(statp->options & RES_IGNTC) && anhp->tc) {
- /*
- * To get the rest of answer,
- * use TCP with same server.
- */
- Dprint(statp->options & RES_DEBUG,
- (stdout, ";; truncated answer\n"));
- *v_circuit = 1;
- res_nclose(statp);
- return (1);
- }
- /*
- * All is well, or the error is fatal. Signal that the
- * next nameserver ought not be tried.
- */
- return (resplen);
- } else if (pfd[0].revents & (POLLERR | POLLHUP | POLLNVAL)) {
- /* Something went wrong. We can stop trying. */
- res_nclose(statp);
- return (0);
- }
-}
-
-#ifdef DEBUG
-static void
-Aerror(const res_state statp, FILE *file, const char *string, int error,
- const struct sockaddr *address)
+/*
+ * This routine is for closing the socket if a virtual circuit is used and
+ * the program wants to close it. This provides support for endhostent()
+ * which expects to close the socket.
+ *
+ * This routine is not expected to be user visible.
+ */
+void
+res_close()
{
- int save = errno;
-
- if ((statp->options & RES_DEBUG) != 0) {
- char tmp[sizeof "xxxx.xxxx.xxxx.255.255.255.255"];
-
- fprintf(file, "res_send: %s ([%s].%u): %s\n",
- string,
- inet_ntop(address->sa_family, address->sa_data,
- tmp, sizeof tmp),
- (address->sa_family == AF_INET
- ? ntohs(((struct sockaddr_in *) address)->sin_port)
- : address->sa_family == AF_INET6
- ? ntohs(((struct sockaddr_in6 *) address)->sin6_port)
- : 0),
- strerror(error));
+ if (s >= 0) {
+ (void)close(s);
+ s = -1;
+ connected = 0;
+ vc = 0;
+ af = 0;
}
- __set_errno (save);
-}
-
-static void
-Perror(const res_state statp, FILE *file, const char *string, int error) {
- int save = errno;
-
- if ((statp->options & RES_DEBUG) != 0)
- fprintf(file, "res_send: %s: %s\n",
- string, strerror(error));
- __set_errno (save);
-}
-#endif
-
-static int
-sock_eq(struct sockaddr_in6 *a1, struct sockaddr_in6 *a2) {
- if (a1->sin6_family == a2->sin6_family) {
- if (a1->sin6_family == AF_INET)
- return ((((struct sockaddr_in *)a1)->sin_port ==
- ((struct sockaddr_in *)a2)->sin_port) &&
- (((struct sockaddr_in *)a1)->sin_addr.s_addr ==
- ((struct sockaddr_in *)a2)->sin_addr.s_addr));
- else
- return ((a1->sin6_port == a2->sin6_port) &&
- !memcmp(&a1->sin6_addr, &a2->sin6_addr,
- sizeof (struct in6_addr)));
- }
- if (a1->sin6_family == AF_INET) {
- struct sockaddr_in6 *sap = a1;
- a1 = a2;
- a2 = sap;
- } /* assumes that AF_INET and AF_INET6 are the only possibilities */
- return ((a1->sin6_port == ((struct sockaddr_in *)a2)->sin_port) &&
- IN6_IS_ADDR_V4MAPPED(&a1->sin6_addr) &&
- (a1->sin6_addr.s6_addr32[3] ==
- ((struct sockaddr_in *)a2)->sin_addr.s_addr));
}
/*
- * Converts IPv4 family, address and port to
- * IPv6 family, IPv4-mapped IPv6 address and port.
+ * Weak aliases for applications that use certain private entry points,
+ * and fail to include <resolv.h>.
*/
-static void
-convaddr4to6(struct sockaddr_in6 *sa)
-{
- struct sockaddr_in *sa4p = (struct sockaddr_in *) sa;
- in_port_t port = sa4p->sin_port;
- in_addr_t addr = sa4p->sin_addr.s_addr;
-
- sa->sin6_family = AF_INET6;
- sa->sin6_port = port;
- sa->sin6_addr.s6_addr32[0] = 0;
- sa->sin6_addr.s6_addr32[1] = 0;
- sa->sin6_addr.s6_addr32[2] = htonl(0xFFFF);
- sa->sin6_addr.s6_addr32[3] = addr;
-}
+#undef res_close
+__weak_reference(__res_close, _res_close);
+#undef res_send
+__weak_reference(__res_send, res_send);
diff --git a/newlib/libc/sys/linux/net/res_update.c b/newlib/libc/sys/linux/net/res_update.c
new file mode 100644
index 000000000..b427bf819
--- /dev/null
+++ b/newlib/libc/sys/linux/net/res_update.c
@@ -0,0 +1,515 @@
+/*
+ * Copyright (c) 1996 by Internet Software Consortium.
+ *
+ * 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM 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.
+ */
+
+/*
+ * Based on the Dynamic DNS reference implementation by Viraj Bais
+ * <viraj_bais@ccm.fm.intel.com>
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/endian.h>
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <arpa/nameser.h>
+#include <limits.h>
+#include <netdb.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * Separate a linked list of records into groups so that all records
+ * in a group will belong to a single zone on the nameserver.
+ * Create a dynamic update packet for each zone and send it to the
+ * nameservers for that zone, and await answer.
+ * Abort if error occurs in updating any zone.
+ * Return the number of zones updated on success, < 0 on error.
+ *
+ * On error, caller must deal with the unsynchronized zones
+ * eg. an A record might have been successfully added to the forward
+ * zone but the corresponding PTR record would be missing if error
+ * was encountered while updating the reverse zone.
+ */
+
+#define NSMAX 16
+
+struct ns1 {
+ char nsname[MAXDNAME];
+ struct in_addr nsaddr1;
+};
+
+struct zonegrp {
+ char z_origin[MAXDNAME];
+ int16_t z_class;
+ char z_soardata[MAXDNAME + 5 * INT32SZ];
+ struct ns1 z_ns[NSMAX];
+ int z_nscount;
+ ns_updrec * z_rr;
+ struct zonegrp *z_next;
+};
+
+
+int
+res_update(ns_updrec *rrecp_in) {
+ ns_updrec *rrecp, *tmprrecp;
+ u_char buf[PACKETSZ], answer[PACKETSZ], packet[2*PACKETSZ];
+ char name[MAXDNAME], zname[MAXDNAME], primary[MAXDNAME],
+ mailaddr[MAXDNAME];
+ u_char soardata[2*MAXCDNAME+5*INT32SZ];
+ char *dname, *svdname, *cp1, *target;
+ u_char *cp, *eom;
+ HEADER *hp = (HEADER *) answer;
+ struct zonegrp *zptr = NULL, *tmpzptr, *prevzptr, *zgrp_start = NULL;
+ int i, j, k = 0, n, ancount, nscount, arcount, rcode, rdatasize,
+ newgroup, done, myzone, seen_before, numzones = 0;
+ u_int16_t dlen, class, qclass, type, qtype;
+ u_int32_t ttl;
+
+ if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ h_errno = NETDB_INTERNAL;
+ return (-1);
+ }
+
+ for (rrecp = rrecp_in; rrecp; rrecp = rrecp->r_next) {
+ dname = rrecp->r_dname;
+ n = strlen(dname);
+ if (dname[n-1] == '.')
+ dname[n-1] = '\0';
+ qtype = T_SOA;
+ qclass = rrecp->r_class;
+ done = 0;
+ seen_before = 0;
+
+ while (!done && dname) {
+ if (qtype == T_SOA) {
+ for (tmpzptr = zgrp_start;
+ tmpzptr && !seen_before;
+ tmpzptr = tmpzptr->z_next) {
+ if (strcasecmp(dname,
+ tmpzptr->z_origin) == 0 &&
+ tmpzptr->z_class == qclass)
+ seen_before++;
+ for (tmprrecp = tmpzptr->z_rr;
+ tmprrecp && !seen_before;
+ tmprrecp = tmprrecp->r_grpnext)
+ if (strcasecmp(dname, tmprrecp->r_dname) == 0
+ && tmprrecp->r_class == qclass) {
+ seen_before++;
+ break;
+ }
+ if (seen_before) {
+ /*
+ * Append to the end of
+ * current group.
+ */
+ for (tmprrecp = tmpzptr->z_rr;
+ tmprrecp->r_grpnext;
+ tmprrecp = tmprrecp->r_grpnext)
+ (void)NULL;
+ tmprrecp->r_grpnext = rrecp;
+ rrecp->r_grpnext = NULL;
+ done = 1;
+ break;
+ }
+ }
+ } else if (qtype == T_A) {
+ for (tmpzptr = zgrp_start;
+ tmpzptr && !done;
+ tmpzptr = tmpzptr->z_next)
+ for (i = 0; i < tmpzptr->z_nscount; i++)
+ if (tmpzptr->z_class == qclass &&
+ strcasecmp(tmpzptr->z_ns[i].nsname,
+ dname) == 0 &&
+ tmpzptr->z_ns[i].nsaddr1.s_addr != 0) {
+ zptr->z_ns[k].nsaddr1.s_addr =
+ tmpzptr->z_ns[i].nsaddr1.s_addr;
+ done = 1;
+ break;
+ }
+ }
+ if (done)
+ break;
+ n = res_mkquery(QUERY, dname, qclass, qtype, NULL,
+ 0, NULL, buf, sizeof buf);
+ if (n <= 0) {
+ fprintf(stderr, "res_update: mkquery failed\n");
+ return (n);
+ }
+ n = res_send(buf, n, answer, sizeof answer);
+ if (n < 0) {
+ fprintf(stderr, "res_update: send error for %s\n",
+ rrecp->r_dname);
+ return (n);
+ }
+ if (n < HFIXEDSZ)
+ return (-1);
+ ancount = ntohs(hp->ancount);
+ nscount = ntohs(hp->nscount);
+ arcount = ntohs(hp->arcount);
+ rcode = hp->rcode;
+ cp = answer + HFIXEDSZ;
+ eom = answer + n;
+ /* skip the question section */
+ n = dn_skipname(cp, eom);
+ if (n < 0 || cp + n + 2 * INT16SZ > eom)
+ return (-1);
+ cp += n + 2 * INT16SZ;
+
+ if (qtype == T_SOA) {
+ if (ancount == 0 && nscount == 0 && arcount == 0) {
+ /*
+ * if (rcode == NOERROR) then the dname exists but
+ * has no soa record associated with it.
+ * if (rcode == NXDOMAIN) then the dname does not
+ * exist and the server is replying out of NCACHE.
+ * in either case, proceed with the next try
+ */
+ dname = strchr(dname, '.');
+ if (dname != NULL)
+ dname++;
+ continue;
+ } else if ((rcode == NOERROR || rcode == NXDOMAIN) &&
+ ancount == 0 &&
+ nscount == 1 && arcount == 0) {
+ /*
+ * name/data does not exist, soa record supplied in the
+ * authority section
+ */
+ /* authority section must contain the soa record */
+ if ((n = dn_expand(answer, eom, cp, zname,
+ sizeof zname)) < 0)
+ return (n);
+ cp += n;
+ if (cp + 2 * INT16SZ > eom)
+ return (-1);
+ GETSHORT(type, cp);
+ GETSHORT(class, cp);
+ if (type != T_SOA || class != qclass) {
+ fprintf(stderr, "unknown answer\n");
+ return (-1);
+ }
+ myzone = 0;
+ svdname = dname;
+ while (dname)
+ if (strcasecmp(dname, zname) == 0) {
+ myzone = 1;
+ break;
+ } else if ((dname = strchr(dname, '.')) != NULL)
+ dname++;
+ if (!myzone) {
+ dname = strchr(svdname, '.');
+ if (dname != NULL)
+ dname++;
+ continue;
+ }
+ nscount = 0;
+ /* fallthrough */
+ } else if (rcode == NOERROR && ancount == 1) {
+ /*
+ * found the zone name
+ * new servers will supply NS records for the zone
+ * in authority section and A records for those
+ * nameservers in the additional section
+ * older servers have to be explicitly queried for
+ * NS records for the zone
+ */
+ /* answer section must contain the soa record */
+ if ((n = dn_expand(answer, eom, cp, zname,
+ sizeof zname)) < 0)
+ return (n);
+ else
+ cp += n;
+ if (cp + 2 * INT16SZ > eom)
+ return (-1);
+ GETSHORT(type, cp);
+ GETSHORT(class, cp);
+ if (type == T_CNAME) {
+ dname = strchr(dname, '.');
+ if (dname != NULL)
+ dname++;
+ continue;
+ }
+ if (strcasecmp(dname, zname) != 0 ||
+ type != T_SOA ||
+ class != rrecp->r_class) {
+ fprintf(stderr, "unknown answer\n");
+ return (-1);
+ }
+ /* FALLTHROUGH */
+ } else {
+ fprintf(stderr,
+ "unknown response: ans=%d, auth=%d, add=%d, rcode=%d\n",
+ ancount, nscount, arcount, hp->rcode);
+ return (-1);
+ }
+ if (cp + INT32SZ + INT16SZ > eom)
+ return (-1);
+ /* continue processing the soa record */
+ GETLONG(ttl, cp);
+ GETSHORT(dlen, cp);
+ if (cp + dlen > eom)
+ return (-1);
+ newgroup = 1;
+ zptr = zgrp_start;
+ prevzptr = NULL;
+ while (zptr) {
+ if (strcasecmp(zname, zptr->z_origin) == 0 &&
+ type == T_SOA && class == qclass) {
+ newgroup = 0;
+ break;
+ }
+ prevzptr = zptr;
+ zptr = zptr->z_next;
+ }
+ if (!newgroup) {
+ for (tmprrecp = zptr->z_rr;
+ tmprrecp->r_grpnext;
+ tmprrecp = tmprrecp->r_grpnext)
+ ;
+ tmprrecp->r_grpnext = rrecp;
+ rrecp->r_grpnext = NULL;
+ done = 1;
+ cp += dlen;
+ break;
+ } else {
+ if ((n = dn_expand(answer, eom, cp, primary,
+ sizeof primary)) < 0)
+ return (n);
+ cp += n;
+ /*
+ * We don't have to bounds check here because the
+ * next use of 'cp' is in dn_expand().
+ */
+ cp1 = (char *)soardata;
+ strcpy(cp1, primary);
+ cp1 += strlen(cp1) + 1;
+ if ((n = dn_expand(answer, eom, cp, mailaddr,
+ sizeof mailaddr)) < 0)
+ return (n);
+ cp += n;
+ strcpy(cp1, mailaddr);
+ cp1 += strlen(cp1) + 1;
+ if (cp + 5*INT32SZ > eom)
+ return (-1);
+ memcpy(cp1, cp, 5*INT32SZ);
+ cp += 5*INT32SZ;
+ cp1 += 5*INT32SZ;
+ rdatasize = (u_char *)cp1 - soardata;
+ zptr = calloc(1, sizeof(struct zonegrp));
+ if (zptr == NULL)
+ return (-1);
+ if (zgrp_start == NULL)
+ zgrp_start = zptr;
+ else
+ prevzptr->z_next = zptr;
+ zptr->z_rr = rrecp;
+ rrecp->r_grpnext = NULL;
+ strcpy(zptr->z_origin, zname);
+ zptr->z_class = class;
+ memcpy(zptr->z_soardata, soardata, rdatasize);
+ /* fallthrough to process NS and A records */
+ }
+ } else if (qtype == T_NS) {
+ if (rcode == NOERROR && ancount > 0) {
+ strcpy(zname, dname);
+ for (zptr = zgrp_start; zptr; zptr = zptr->z_next) {
+ if (strcasecmp(zname, zptr->z_origin) == 0)
+ break;
+ }
+ if (zptr == NULL)
+ /* should not happen */
+ return (-1);
+ if (nscount > 0) {
+ /*
+ * answer and authority sections contain
+ * the same information, skip answer section
+ */
+ for (j = 0; j < ancount; j++) {
+ n = dn_skipname(cp, eom);
+ if (n < 0)
+ return (-1);
+ n += 2*INT16SZ + INT32SZ;
+ if (cp + n + INT16SZ > eom)
+ return (-1);
+ cp += n;
+ GETSHORT(dlen, cp);
+ cp += dlen;
+ }
+ } else
+ nscount = ancount;
+ /* fallthrough to process NS and A records */
+ } else {
+ fprintf(stderr, "cannot determine nameservers for %s:\
+ans=%d, auth=%d, add=%d, rcode=%d\n",
+ dname, ancount, nscount, arcount, hp->rcode);
+ return (-1);
+ }
+ } else if (qtype == T_A) {
+ if (rcode == NOERROR && ancount > 0) {
+ arcount = ancount;
+ ancount = nscount = 0;
+ /* fallthrough to process A records */
+ } else {
+ fprintf(stderr, "cannot determine address for %s:\
+ans=%d, auth=%d, add=%d, rcode=%d\n",
+ dname, ancount, nscount, arcount, hp->rcode);
+ return (-1);
+ }
+ }
+ /* process NS records for the zone */
+ j = 0;
+ for (i = 0; i < nscount; i++) {
+ if ((n = dn_expand(answer, eom, cp, name,
+ sizeof name)) < 0)
+ return (n);
+ cp += n;
+ if (cp + 3 * INT16SZ + INT32SZ > eom)
+ return (-1);
+ GETSHORT(type, cp);
+ GETSHORT(class, cp);
+ GETLONG(ttl, cp);
+ GETSHORT(dlen, cp);
+ if (cp + dlen > eom)
+ return (-1);
+ if (strcasecmp(name, zname) == 0 &&
+ type == T_NS && class == qclass) {
+ if ((n = dn_expand(answer, eom, cp,
+ name, sizeof name)) < 0)
+ return (n);
+ target = zptr->z_ns[j++].nsname;
+ strcpy(target, name);
+ }
+ cp += dlen;
+ }
+ if (zptr->z_nscount == 0)
+ zptr->z_nscount = j;
+ /* get addresses for the nameservers */
+ for (i = 0; i < arcount; i++) {
+ if ((n = dn_expand(answer, eom, cp, name,
+ sizeof name)) < 0)
+ return (n);
+ cp += n;
+ if (cp + 3 * INT16SZ + INT32SZ > eom)
+ return (-1);
+ GETSHORT(type, cp);
+ GETSHORT(class, cp);
+ GETLONG(ttl, cp);
+ GETSHORT(dlen, cp);
+ if (cp + dlen > eom)
+ return (-1);
+ if (type == T_A && dlen == INT32SZ && class == qclass) {
+ for (j = 0; j < zptr->z_nscount; j++)
+ if (strcasecmp(name, zptr->z_ns[j].nsname) == 0) {
+ memcpy(&zptr->z_ns[j].nsaddr1.s_addr, cp,
+ INT32SZ);
+ break;
+ }
+ }
+ cp += dlen;
+ }
+ if (zptr->z_nscount == 0) {
+ dname = zname;
+ qtype = T_NS;
+ continue;
+ }
+ done = 1;
+ for (k = 0; k < zptr->z_nscount; k++)
+ if (zptr->z_ns[k].nsaddr1.s_addr == 0) {
+ done = 0;
+ dname = zptr->z_ns[k].nsname;
+ qtype = T_A;
+ }
+
+ } /* while */
+ }
+
+ _res.options |= RES_DEBUG;
+ for (zptr = zgrp_start; zptr; zptr = zptr->z_next) {
+
+ /* append zone section */
+ rrecp = res_mkupdrec(ns_s_zn, zptr->z_origin,
+ zptr->z_class, ns_t_soa, 0);
+ if (rrecp == NULL) {
+ fprintf(stderr, "saverrec error\n");
+ fflush(stderr);
+ return (-1);
+ }
+ rrecp->r_grpnext = zptr->z_rr;
+ zptr->z_rr = rrecp;
+
+ n = res_mkupdate(zptr->z_rr, packet, sizeof packet);
+ if (n < 0) {
+ fprintf(stderr, "res_mkupdate error\n");
+ fflush(stderr);
+ return (-1);
+ } else
+ fprintf(stdout, "res_mkupdate: packet size = %d\n", n);
+
+ /*
+ * Override the list of NS records from res_init() with
+ * the authoritative nameservers for the zone being updated.
+ * Sort primary to be the first in the list of nameservers.
+ */
+ for (i = 0; i < zptr->z_nscount; i++) {
+ if (strcasecmp(zptr->z_ns[i].nsname,
+ zptr->z_soardata) == 0) {
+ struct in_addr tmpaddr;
+
+ if (i != 0) {
+ strcpy(zptr->z_ns[i].nsname,
+ zptr->z_ns[0].nsname);
+ strcpy(zptr->z_ns[0].nsname,
+ zptr->z_soardata);
+ tmpaddr = zptr->z_ns[i].nsaddr1;
+ zptr->z_ns[i].nsaddr1 =
+ zptr->z_ns[0].nsaddr1;
+ zptr->z_ns[0].nsaddr1 = tmpaddr;
+ }
+ break;
+ }
+ }
+ for (i = 0; i < MAXNS; i++) {
+ _res.nsaddr_list[i].sin_addr = zptr->z_ns[i].nsaddr1;
+ _res.nsaddr_list[i].sin_family = AF_INET;
+ _res.nsaddr_list[i].sin_port = htons(NAMESERVER_PORT);
+ }
+ _res.nscount = (zptr->z_nscount < MAXNS) ?
+ zptr->z_nscount : MAXNS;
+ n = res_send(packet, n, answer, sizeof(answer));
+ if (n < 0) {
+ fprintf(stderr, "res_send: send error, n=%d\n", n);
+ break;
+ } else
+ numzones++;
+ }
+
+ /* free malloc'ed memory */
+ while(zgrp_start) {
+ zptr = zgrp_start;
+ zgrp_start = zgrp_start->z_next;
+ res_freeupdrec(zptr->z_rr); /* Zone section we allocated. */
+ free((char *)zptr);
+ }
+
+ return (numzones);
+}
diff --git a/newlib/libc/sys/linux/net/resolver.3 b/newlib/libc/sys/linux/net/resolver.3
new file mode 100644
index 000000000..141759855
--- /dev/null
+++ b/newlib/libc/sys/linux/net/resolver.3
@@ -0,0 +1,422 @@
+.\" Copyright (c) 1985, 1991, 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.
+.\"
+.\" @(#)resolver.3 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD: src/lib/libc/net/resolver.3,v 1.21 2001/10/01 16:08:56 ru Exp $
+.\"
+.Dd June 4, 1993
+.Dt RESOLVER 3
+.Os
+.Sh NAME
+.Nm res_query ,
+.Nm res_search ,
+.Nm res_mkquery ,
+.Nm res_send ,
+.Nm res_init ,
+.Nm dn_comp ,
+.Nm dn_expand ,
+.Nm dn_skipname ,
+.Nm ns_get16 ,
+.Nm ns_get32 ,
+.Nm ns_put16 ,
+.Nm ns_put32
+.Nd resolver routines
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In netinet/in.h
+.In arpa/nameser.h
+.In resolv.h
+.Ft int
+.Fo res_query
+.Fa "const char *dname"
+.Fa "int class"
+.Fa "int type"
+.Fa "u_char *answer"
+.Fa "int anslen"
+.Fc
+.Ft int
+.Fo res_search
+.Fa "const char *dname"
+.Fa "int class"
+.Fa "int type"
+.Fa "u_char *answer"
+.Fa "int anslen"
+.Fc
+.Ft int
+.Fo res_mkquery
+.Fa "int op"
+.Fa "const char *dname"
+.Fa "int class"
+.Fa "int type"
+.Fa "const u_char *data"
+.Fa "int datalen"
+.Fa "const u_char *newrr_in"
+.Fa "u_char *buf"
+.Fa "int buflen"
+.Fc
+.Ft int
+.Fo res_send
+.Fa "const u_char *msg"
+.Fa "int msglen"
+.Fa "u_char *answer"
+.Fa "int anslen"
+.Fc
+.Ft int
+.Fn res_init
+.Ft int
+.Fo dn_comp
+.Fa "const char *exp_dn"
+.Fa "u_char *comp_dn"
+.Fa "int length"
+.Fa "u_char **dnptrs"
+.Fa "u_char **lastdnptr"
+.Fc
+.Ft int
+.Fo dn_expand
+.Fa "const u_char *msg"
+.Fa "const u_char *eomorig"
+.Fa "const u_char *comp_dn"
+.Fa "char *exp_dn"
+.Fa "int length"
+.Fc
+.Ft int
+.Fn dn_skipname "const u_char *comp_dn" "const u_char *eom"
+.Ft u_int
+.Fn ns_get16 "const u_char *src"
+.Ft u_long
+.Fn ns_get32 "const u_char *src"
+.Ft void
+.Fn ns_put16 "u_int src" "u_char *dst"
+.Ft void
+.Fn ns_put32 "u_long src" "u_char *dst"
+.Sh DESCRIPTION
+These routines are used for making, sending and interpreting
+query and reply messages with Internet domain name servers.
+.Pp
+Global configuration and state information that is used by the
+resolver routines is kept in the structure
+.Em _res .
+Most of the values have reasonable defaults and can be ignored.
+Options
+stored in
+.Em _res.options
+are defined in
+.Pa resolv.h
+and are as follows.
+Options are stored as a simple bit mask containing the bitwise ``or''
+of the options enabled.
+.Bl -tag -width RES_USE_INET6
+.It Dv RES_INIT
+True if the initial name server address and default domain name are
+initialized (i.e.,
+.Fn res_init
+has been called).
+.It Dv RES_DEBUG
+Print debugging messages.
+.It Dv RES_AAONLY
+Accept authoritative answers only.
+With this option,
+.Fn res_send
+should continue until it finds an authoritative answer or finds an error.
+Currently this is not implemented.
+.It Dv RES_USEVC
+Use
+.Tn TCP
+connections for queries instead of
+.Tn UDP
+datagrams.
+.It Dv RES_STAYOPEN
+Used with
+.Dv RES_USEVC
+to keep the
+.Tn TCP
+connection open between
+queries.
+This is useful only in programs that regularly do many queries.
+.Tn UDP
+should be the normal mode used.
+.It Dv RES_IGNTC
+Unused currently (ignore truncation errors, i.e., don't retry with
+.Tn TCP ) .
+.It Dv RES_RECURSE
+Set the recursion-desired bit in queries.
+This is the default.
+.Pf ( Fn res_send
+does not do iterative queries and expects the name server
+to handle recursion.)
+.It Dv RES_DEFNAMES
+If set,
+.Fn res_search
+will append the default domain name to single-component names
+(those that do not contain a dot).
+This option is enabled by default.
+.It Dv RES_DNSRCH
+If this option is set,
+.Fn res_search
+will search for host names in the current domain and in parent domains; see
+.Xr hostname 7 .
+This is used by the standard host lookup routine
+.Xr gethostbyname 3 .
+This option is enabled by default.
+.It Dv RES_NOALIASES
+This option turns off the user level aliasing feature controlled by the
+.Dq Ev HOSTALIASES
+environment variable. Network daemons should set this option.
+.It Dv RES_USE_INET6
+Enables support for IPv6-only applications.
+This causes IPv4 addresses to be returned as an IPv4 mapped address.
+For example,
+.Li 10.1.1.1
+will be returned as
+.Li ::ffff:10.1.1.1 .
+The option is meaningful with certain kernel configuration only.
+.It Dv RES_USE_EDNS0
+Enables support for OPT pseudo-RR for EDNS0 extension.
+With the option, resolver code will attach OPT pseudo-RR into DNS queries,
+to inform of our receive buffer size.
+The option will allow DNS servers to take advantage of non-default receive
+buffer size, and to send larger replies.
+DNS query packets with EDNS0 extension is not compatible with
+non-EDNS0 DNS servers.
+.El
+.Pp
+The
+.Fn res_init
+routine
+reads the configuration file (if any; see
+.Xr resolver 5 )
+to get the default domain name,
+search list and
+the Internet address of the local name server(s).
+If no server is configured, the host running
+the resolver is tried.
+The current domain name is defined by the hostname
+if not specified in the configuration file;
+it can be overridden by the environment variable
+.Ev LOCALDOMAIN .
+This environment variable may contain several blank-separated
+tokens if you wish to override the
+.Em "search list"
+on a per-process basis. This is similar to the
+.Em search
+command in the configuration file.
+Another environment variable
+.Dq Ev RES_OPTIONS
+can be set to
+override certain internal resolver options which are otherwise
+set by changing fields in the
+.Em _res
+structure or are inherited from the configuration file's
+.Em options
+command. The syntax of the
+.Dq Ev RES_OPTIONS
+environment variable is explained in
+.Xr resolver 5 .
+Initialization normally occurs on the first call
+to one of the following routines.
+.Pp
+The
+.Fn res_query
+function provides an interface to the server query mechanism.
+It constructs a query, sends it to the local server,
+awaits a response, and makes preliminary checks on the reply.
+The query requests information of the specified
+.Fa type
+and
+.Fa class
+for the specified fully-qualified domain name
+.Fa dname .
+The reply message is left in the
+.Fa answer
+buffer with length
+.Fa anslen
+supplied by the caller.
+.Pp
+The
+.Fn res_search
+routine makes a query and awaits a response like
+.Fn res_query ,
+but in addition, it implements the default and search rules
+controlled by the
+.Dv RES_DEFNAMES
+and
+.Dv RES_DNSRCH
+options.
+It returns the first successful reply.
+.Pp
+The remaining routines are lower-level routines used by
+.Fn res_query .
+The
+.Fn res_mkquery
+function
+constructs a standard query message and places it in
+.Fa buf .
+It returns the size of the query, or \-1 if the query is
+larger than
+.Fa buflen .
+The query type
+.Fa op
+is usually
+.Dv QUERY ,
+but can be any of the query types defined in
+.Aq Pa arpa/nameser.h .
+The domain name for the query is given by
+.Fa dname .
+.Fa Newrr
+is currently unused but is intended for making update messages.
+.Pp
+The
+.Fn res_send
+routine
+sends a pre-formatted query and returns an answer.
+It will call
+.Fn res_init
+if
+.Dv RES_INIT
+is not set, send the query to the local name server, and
+handle timeouts and retries.
+The length of the reply message is returned, or
+\-1 if there were errors.
+.Pp
+The
+.Fn dn_comp
+function
+compresses the domain name
+.Fa exp_dn
+and stores it in
+.Fa comp_dn .
+The size of the compressed name is returned or \-1 if there were errors.
+The size of the array pointed to by
+.Fa comp_dn
+is given by
+.Fa length .
+The compression uses
+an array of pointers
+.Fa dnptrs
+to previously-compressed names in the current message.
+The first pointer points to
+the beginning of the message and the list ends with
+.Dv NULL .
+The limit to the array is specified by
+.Fa lastdnptr .
+A side effect of
+.Fn dn_comp
+is to update the list of pointers for
+labels inserted into the message
+as the name is compressed.
+If
+.Em dnptr
+is
+.Dv NULL ,
+names are not compressed.
+If
+.Fa lastdnptr
+is
+.Dv NULL ,
+the list of labels is not updated.
+.Pp
+The
+.Fn dn_expand
+entry
+expands the compressed domain name
+.Fa comp_dn
+to a full domain name
+The compressed name is contained in a query or reply message;
+.Fa msg
+is a pointer to the beginning of the message.
+The uncompressed name is placed in the buffer indicated by
+.Fa exp_dn
+which is of size
+.Fa length .
+The size of compressed name is returned or \-1 if there was an error.
+.Pp
+The
+.Fn dn_skipname
+function skips over a compressed domain name, which starts at a location
+pointed to by
+.Fa comp_dn .
+The compressed name is contained in a query or reply message;
+.Fa eom
+is a pointer to the end of the message.
+The size of compressed name is returned or \-1 if there was
+an error.
+.Pp
+The
+.Fn ns_get16
+function gets a 16-bit quantity from a buffer pointed to by
+.Fa src .
+.Pp
+The
+.Fn ns_get32
+function gets a 32-bit quantity from a buffer pointed to by
+.Fa src .
+.Pp
+The
+.Fn ns_put16
+function puts a 16-bit quantity
+.Fa src
+to a buffer pointed to by
+.Fa dst .
+.Pp
+The
+.Fn ns_put32
+function puts a 32-bit quantity
+.Fa src
+to a buffer pointed to by
+.Fa dst .
+.Sh FILES
+.Bl -tag -width /etc/resolv.conf
+.It Pa /etc/resolv.conf
+The configuration file,
+see
+.Xr resolver 5 .
+.El
+.Sh SEE ALSO
+.Xr gethostbyname 3 ,
+.Xr resolver 5 ,
+.Xr hostname 7 ,
+.Xr named 8
+.Pp
+.%T RFC1032 ,
+.%T RFC1033 ,
+.%T RFC1034 ,
+.%T RFC1035 ,
+.%T RFC974
+.Rs
+.%T "Name Server Operations Guide for BIND"
+.Re
+.Sh HISTORY
+The
+.Nm
+function appeared in
+.Bx 4.3 .
diff --git a/newlib/libc/sys/linux/net/rexec.c b/newlib/libc/sys/linux/net/rexec.c
deleted file mode 100644
index f6ae42d6f..000000000
--- a/newlib/libc/sys/linux/net/rexec.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright (c) 1980, 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.
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rexec.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include <netinet/in.h>
-
-#include <alloca.h>
-#include <stdio.h>
-#include <netdb.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/uio.h>
-#include "libc-symbols.h"
-
-int rexecoptions;
-libc_freeres_ptr (static char *ahostbuf);
-
-int
-rexec_af(ahost, rport, name, pass, cmd, fd2p, af)
- char **ahost;
- int rport;
- const char *name, *pass, *cmd;
- int *fd2p;
- sa_family_t af;
-{
- struct sockaddr_storage sa2, from;
- struct addrinfo hints, *res0;
- const char *orig_name = name;
- const char *orig_pass = pass;
- u_short port = 0;
- int s, timo = 1, s3;
- char c;
- int gai;
- char servbuff[NI_MAXSERV];
-
- snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport));
- servbuff[sizeof(servbuff) - 1] = '\0';
-
- memset(&hints, '\0', sizeof(hints));
- hints.ai_family = af;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_flags = AI_CANONNAME;
- gai = getaddrinfo(*ahost, servbuff, &hints, &res0);
- if (gai){
- /* XXX: set errno? */
- return -1;
- }
-
- if (res0->ai_canonname){
- free (ahostbuf);
- ahostbuf = strdup (res0->ai_canonname);
- if (ahostbuf == NULL) {
- perror ("rexec: strdup");
- return (-1);
- }
- *ahost = ahostbuf;
- } else
- *ahost = NULL;
- ruserpass(res0->ai_canonname, &name, &pass);
-retry:
- s = socket(res0->ai_family, res0->ai_socktype, 0);
- if (s < 0) {
- perror("rexec: socket");
- return (-1);
- }
- if (connect(s, res0->ai_addr, res0->ai_addrlen) < 0) {
- if (errno == ECONNREFUSED && timo <= 16) {
- (void) __close(s);
- sleep(timo);
- timo *= 2;
- goto retry;
- }
- perror(res0->ai_canonname);
- return (-1);
- }
- if (fd2p == 0) {
- (void) write(s, "", 1);
- port = 0;
- } else {
- char num[32];
- int s2, sa2len;
-
- s2 = socket(res0->ai_family, res0->ai_socktype, 0);
- if (s2 < 0) {
- (void) __close(s);
- return (-1);
- }
- listen(s2, 1);
- sa2len = sizeof (sa2);
- if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) {
- perror("getsockname");
- (void) __close(s2);
- goto bad;
-#ifdef SA_LEN
- } else if (sa2len != SA_LEN((struct sockaddr *)&sa2)) {
- __set_errno(EINVAL);
- (void) __close(s2);
- goto bad;
-#endif
- }
- port = 0;
- if (!getnameinfo((struct sockaddr *)&sa2, sa2len,
- NULL, 0, servbuff, sizeof(servbuff),
- NI_NUMERICSERV))
- port = atoi(servbuff);
- (void) sprintf(num, "%u", port);
- (void) __write(s, num, strlen(num)+1);
- { int len = sizeof (from);
- s3 = TEMP_FAILURE_RETRY (accept(s2, (struct sockaddr *)&from,
- &len));
- __close(s2);
- if (s3 < 0) {
- perror("accept");
- port = 0;
- goto bad;
- }
- }
- *fd2p = s3;
- }
-
- struct iovec iov[3] =
- {
- [0] = { .iov_base = (void *) name, .iov_len = strlen (name) + 1 },
- /* should public key encypt the password here */
- [1] = { .iov_base = (void *) pass, .iov_len = strlen (pass) + 1 },
- [2] = { .iov_base = (void *) cmd, .iov_len = strlen (cmd) + 1 }
- };
- (void) TEMP_FAILURE_RETRY (writev (s, iov, 3));
-
- /* We don't need the memory allocated for the name and the password
- in ruserpass anymore. */
- if (name != orig_name)
- free ((char *) name);
- if (pass != orig_pass)
- free ((char *) pass);
-
- if (__read(s, &c, 1) != 1) {
- perror(*ahost);
- goto bad;
- }
- if (c != 0) {
- while (__read(s, &c, 1) == 1) {
- (void) __write(2, &c, 1);
- if (c == '\n')
- break;
- }
- goto bad;
- }
- freeaddrinfo(res0);
- return (s);
-bad:
- if (port)
- (void) __close(*fd2p);
- (void) __close(s);
- freeaddrinfo(res0);
- return (-1);
-}
-libc_hidden_def (rexec_af)
-
-int
-rexec(ahost, rport, name, pass, cmd, fd2p)
- char **ahost;
- int rport;
- const char *name, *pass, *cmd;
- int *fd2p;
-{
- return rexec_af(ahost, rport, name, pass, cmd, fd2p, AF_INET);
-}
diff --git a/newlib/libc/sys/linux/net/rpc-lookup.c b/newlib/libc/sys/linux/net/rpc-lookup.c
deleted file mode 100644
index 2de497c01..000000000
--- a/newlib/libc/sys/linux/net/rpc-lookup.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME rpc
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/rthdr.c b/newlib/libc/sys/linux/net/rthdr.c
new file mode 100644
index 000000000..e5f7814b1
--- /dev/null
+++ b/newlib/libc/sys/linux/net/rthdr.c
@@ -0,0 +1,319 @@
+/* $KAME: rthdr.c,v 1.8 2001/08/20 02:32:40 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netinet/ip6.h>
+
+#include <string.h>
+#include <stdio.h>
+
+/* to define items, should talk with KAME guys first, for *BSD compatibility */
+
+#define IPV6_RTHDR_LOOSE 0 /* this hop need not be a neighbor. XXX old spec */
+#define IPV6_RTHDR_STRICT 1 /* this hop must be a neighbor. XXX old spec */
+#define IPV6_RTHDR_TYPE_0 0 /* IPv6 routing header type 0 */
+
+size_t
+inet6_rthdr_space(type, seg)
+ int type, seg;
+{
+ switch(type) {
+ case IPV6_RTHDR_TYPE_0:
+ if (seg < 1 || seg > 23)
+ return(0);
+ return(CMSG_SPACE(sizeof(struct in6_addr) * (seg - 1)
+ + sizeof(struct ip6_rthdr0)));
+ default:
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_space: unknown type(%d)\n", type);
+#endif
+ return(0);
+ }
+}
+
+struct cmsghdr *
+inet6_rthdr_init(bp, type)
+ void *bp;
+ int type;
+{
+ struct cmsghdr *ch = (struct cmsghdr *)bp;
+ struct ip6_rthdr *rthdr;
+
+ rthdr = (struct ip6_rthdr *)CMSG_DATA(ch);
+
+ ch->cmsg_level = IPPROTO_IPV6;
+ ch->cmsg_type = IPV6_RTHDR;
+
+ switch(type) {
+ case IPV6_RTHDR_TYPE_0:
+ ch->cmsg_len = CMSG_LEN(sizeof(struct ip6_rthdr0) - sizeof(struct in6_addr));
+ bzero(rthdr, sizeof(struct ip6_rthdr0));
+ rthdr->ip6r_type = IPV6_RTHDR_TYPE_0;
+ return(ch);
+ default:
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_init: unknown type(%d)\n", type);
+#endif
+ return(NULL);
+ }
+}
+
+int
+inet6_rthdr_add(cmsg, addr, flags)
+ struct cmsghdr *cmsg;
+ const struct in6_addr *addr;
+ u_int flags;
+{
+ struct ip6_rthdr *rthdr;
+
+ rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg);
+
+ switch(rthdr->ip6r_type) {
+ case IPV6_RTHDR_TYPE_0:
+ {
+ struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr;
+ if (flags != IPV6_RTHDR_LOOSE && flags != IPV6_RTHDR_STRICT) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_add: unsupported flag(%d)\n", flags);
+#endif
+ return(-1);
+ }
+ if (rt0->ip6r0_segleft == 23) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_add: segment overflow\n");
+#endif
+ return(-1);
+ }
+ if (flags == IPV6_RTHDR_STRICT) {
+ int c, b;
+ c = rt0->ip6r0_segleft / 8;
+ b = rt0->ip6r0_segleft % 8;
+ rt0->ip6r0_slmap[c] |= (1 << (7 - b));
+ }
+ rt0->ip6r0_segleft++;
+ bcopy(addr, (caddr_t)rt0 + ((rt0->ip6r0_len + 1) << 3),
+ sizeof(struct in6_addr));
+ rt0->ip6r0_len += sizeof(struct in6_addr) >> 3;
+ cmsg->cmsg_len = CMSG_LEN((rt0->ip6r0_len + 1) << 3);
+ break;
+ }
+ default:
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_add: unknown type(%d)\n",
+ rthdr->ip6r_type);
+#endif
+ return(-1);
+ }
+
+ return(0);
+}
+
+int
+inet6_rthdr_lasthop(cmsg, flags)
+ struct cmsghdr *cmsg;
+ unsigned int flags;
+{
+ struct ip6_rthdr *rthdr;
+
+ rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg);
+
+ switch(rthdr->ip6r_type) {
+ case IPV6_RTHDR_TYPE_0:
+ {
+ struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr;
+ if (flags != IPV6_RTHDR_LOOSE && flags != IPV6_RTHDR_STRICT) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_lasthop: unsupported flag(%d)\n", flags);
+#endif
+ return(-1);
+ }
+ if (rt0->ip6r0_segleft > 23) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_add: segment overflow\n");
+#endif
+ return(-1);
+ }
+ if (flags == IPV6_RTHDR_STRICT) {
+ int c, b;
+ c = rt0->ip6r0_segleft / 8;
+ b = rt0->ip6r0_segleft % 8;
+ rt0->ip6r0_slmap[c] |= (1 << (7 - b));
+ }
+ break;
+ }
+ default:
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_lasthop: unknown type(%d)\n",
+ rthdr->ip6r_type);
+#endif
+ return(-1);
+ }
+
+ return(0);
+}
+
+#if 0
+int
+inet6_rthdr_reverse(in, out)
+ const struct cmsghdr *in;
+ struct cmsghdr *out;
+{
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_reverse: not implemented yet\n");
+#endif
+ return -1;
+}
+#endif
+
+int
+inet6_rthdr_segments(cmsg)
+ const struct cmsghdr *cmsg;
+{
+ struct ip6_rthdr *rthdr;
+
+ rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg);
+
+ switch(rthdr->ip6r_type) {
+ case IPV6_RTHDR_TYPE_0:
+ {
+ struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr;
+
+ if (rt0->ip6r0_len % 2 || 46 < rt0->ip6r0_len) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_segments: invalid size(%d)\n",
+ rt0->ip6r0_len);
+#endif
+ return -1;
+ }
+
+ return (rt0->ip6r0_len * 8) / sizeof(struct in6_addr);
+ }
+
+ default:
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_segments: unknown type(%d)\n",
+ rthdr->ip6r_type);
+#endif
+ return -1;
+ }
+}
+
+struct in6_addr *
+inet6_rthdr_getaddr(cmsg, idx)
+ struct cmsghdr *cmsg;
+ int idx;
+{
+ struct ip6_rthdr *rthdr;
+
+ rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg);
+
+ switch(rthdr->ip6r_type) {
+ case IPV6_RTHDR_TYPE_0:
+ {
+ struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr;
+ int naddr;
+
+ if (rt0->ip6r0_len % 2 || 46 < rt0->ip6r0_len) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_getaddr: invalid size(%d)\n",
+ rt0->ip6r0_len);
+#endif
+ return NULL;
+ }
+ naddr = (rt0->ip6r0_len * 8) / sizeof(struct in6_addr);
+ if (idx <= 0 || naddr < idx) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_getaddr: invalid idx(%d)\n", idx);
+#endif
+ return NULL;
+ }
+ return &rt0->ip6r0_addr[idx - 1];
+ }
+
+ default:
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_getaddr: unknown type(%d)\n",
+ rthdr->ip6r_type);
+#endif
+ return NULL;
+ }
+}
+
+int
+inet6_rthdr_getflags(cmsg, idx)
+ const struct cmsghdr *cmsg;
+ int idx;
+{
+ struct ip6_rthdr *rthdr;
+
+ rthdr = (struct ip6_rthdr *)CMSG_DATA(cmsg);
+
+ switch(rthdr->ip6r_type) {
+ case IPV6_RTHDR_TYPE_0:
+ {
+ struct ip6_rthdr0 *rt0 = (struct ip6_rthdr0 *)rthdr;
+ int naddr;
+
+ if (rt0->ip6r0_len % 2 || 46 < rt0->ip6r0_len) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_getflags: invalid size(%d)\n",
+ rt0->ip6r0_len);
+#endif
+ return -1;
+ }
+ naddr = (rt0->ip6r0_len * 8) / sizeof(struct in6_addr);
+ if (idx < 0 || naddr < idx) {
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_getflags: invalid idx(%d)\n", idx);
+#endif
+ return -1;
+ }
+ if (rt0->ip6r0_slmap[idx / 8] & (0x80 >> (idx % 8)))
+ return IPV6_RTHDR_STRICT;
+ else
+ return IPV6_RTHDR_LOOSE;
+ }
+
+ default:
+#ifdef DEBUG
+ fprintf(stderr, "inet6_rthdr_getflags: unknown type(%d)\n",
+ rthdr->ip6r_type);
+#endif
+ return -1;
+ }
+}
diff --git a/newlib/libc/sys/linux/net/ruserpass.c b/newlib/libc/sys/linux/net/ruserpass.c
deleted file mode 100644
index 5c429b072..000000000
--- a/newlib/libc/sys/linux/net/ruserpass.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
- * Copyright (c) 1985, 1993, 1994
- * 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.
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ruserpass.c 8.3 (Berkeley) 4/2/94";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <ctype.h>
-#include <err.h>
-#include <errno.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <stdio_ext.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <libintl.h>
-#include "local.h"
-
-/* #include "ftp_var.h" */
-
-static int token (void);
-static FILE *cfile;
-
-#define DEFAULT 1
-#define LOGIN 2
-#define PASSWD 3
-#define ACCOUNT 4
-#define MACDEF 5
-#define ID 10
-#define MACHINE 11
-
-static char tokval[100];
-
-static const char tokstr[] =
-{
-#define TOK_DEFAULT_IDX 0
- "default\0"
-#define TOK_LOGIN_IDX (TOK_DEFAULT_IDX + sizeof "default")
- "login\0"
-#define TOK_PASSWORD_IDX (TOK_LOGIN_IDX + sizeof "login")
- "password\0"
-#define TOK_PASSWD_IDX (TOK_PASSWORD_IDX + sizeof "password")
- "passwd\0"
-#define TOK_ACCOUNT_IDX (TOK_PASSWD_IDX + sizeof "passwd")
- "account\0"
-#define TOK_MACHINE_IDX (TOK_ACCOUNT_IDX + sizeof "account")
- "machine\0"
-#define TOK_MACDEF_IDX (TOK_MACHINE_IDX + sizeof "machine")
- "macdef"
-};
-
-static const struct toktab {
- int tokstr_off;
- int tval;
-} toktab[]= {
- { TOK_DEFAULT_IDX, DEFAULT },
- { TOK_LOGIN_IDX, LOGIN },
- { TOK_PASSWORD_IDX, PASSWD },
- { TOK_PASSWD_IDX, PASSWD },
- { TOK_ACCOUNT_IDX, ACCOUNT },
- { TOK_MACHINE_IDX, MACHINE },
- { TOK_MACDEF_IDX, MACDEF }
-};
-
-
-#define warnx(x) fprintf(stderr, x)
-#define warnx2(x, y) fprintf(stderr, x, y)
-
-int
-ruserpass(host, aname, apass)
- const char *host, **aname, **apass;
-{
- char *hdir, *buf, *tmp;
- char myname[1024], *mydomain;
- int t, usedefault = 0;
- struct stat64 stb;
-
- hdir = getenv("HOME");
- if (hdir == NULL) {
- /* If we can't get HOME, fail instead of trying ".",
- which is no improvement. This really should call
- getpwuid(getuid()). */
- /*hdir = ".";*/
- return -1;
- }
-
- buf = alloca (strlen (hdir) + 8);
-
- stpcpy (stpcpy (buf, hdir), "/.netrc");
- cfile = fopen(buf, "rc");
- if (cfile == NULL) {
- if (errno != ENOENT) {
- char *t = asprintf("%s", buf);
- perror(t);
- }
- return (0);
- }
- /* No threads use this stream. */
- __fsetlocking (cfile, FSETLOCKING_BYCALLER);
- if (__gethostname(myname, sizeof(myname)) < 0)
- myname[0] = '\0';
- tmp = strchr(myname, '.');
- if (tmp == NULL)
- tmp = myname + strlen(myname);
- mydomain = tmp;
-next:
- while ((t = token())) switch(t) {
-
- case DEFAULT:
- usedefault = 1;
- /* FALL THROUGH */
-
- case MACHINE:
- if (!usedefault) {
- if (token() != ID)
- continue;
- /*
- * Allow match either for user's input host name
- * or official hostname. Also allow match of
- * incompletely-specified host in local domain.
- */
- if (strcasecmp(host, tokval) == 0)
- goto match;
-/* if (strcasecmp(hostname, tokval) == 0)
- goto match;
- if ((tmp = strchr(hostname, '.')) != NULL &&
- strcasecmp(tmp, mydomain) == 0 &&
- strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
- tokval[tmp - hostname] == '\0')
- goto match; */
- if ((tmp = strchr(host, '.')) != NULL &&
- strcasecmp(tmp, mydomain) == 0 &&
- strncasecmp(host, tokval, tmp - host) == 0 &&
- tokval[tmp - host] == '\0')
- goto match;
- continue;
- }
- match:
- while ((t = token()) && t != MACHINE && t != DEFAULT) switch(t) {
-
- case LOGIN:
- if (token()) {
- if (*aname == 0) {
- char *newp;
- newp = malloc((unsigned) strlen(tokval) + 1);
- if (newp == NULL)
- {
- warnx(_("out of memory"));
- goto bad;
- }
- *aname = strcpy(newp, tokval);
- } else {
- if (strcmp(*aname, tokval))
- goto next;
- }
- }
- break;
- case PASSWD:
- if (strcmp(*aname, "anonymous") &&
- fstat64(fileno(cfile), &stb) >= 0 &&
- (stb.st_mode & 077) != 0) {
- warnx(_("Error: .netrc file is readable by others."));
- warnx(_("Remove password or make file unreadable by others."));
- goto bad;
- }
- if (token() && *apass == 0) {
- char *newp;
- newp = malloc((unsigned) strlen(tokval) + 1);
- if (newp == NULL)
- {
- warnx(_("out of memory"));
- goto bad;
- }
- *apass = strcpy(newp, tokval);
- }
- break;
- case ACCOUNT:
-#if 0
- if (fstat64(fileno(cfile), &stb) >= 0
- && (stb.st_mode & 077) != 0) {
- warnx("Error: .netrc file is readable by others.");
- warnx("Remove account or make file unreadable by others.");
- goto bad;
- }
- if (token() && *aacct == 0) {
- *aacct = malloc((unsigned) strlen(tokval) + 1);
- (void) strcpy(*aacct, tokval);
- }
-#endif
- break;
- case MACDEF:
-#if 0
- if (proxy) {
- (void) fclose(cfile);
- return (0);
- }
- while ((c=getc_unlocked(cfile)) != EOF && c == ' '
- || c == '\t');
- if (c == EOF || c == '\n') {
- printf("Missing macdef name argument.\n");
- goto bad;
- }
- if (macnum == 16) {
- printf("Limit of 16 macros have already been defined\n");
- goto bad;
- }
- tmp = macros[macnum].mac_name;
- *tmp++ = c;
- for (i=0; i < 8 && (c=getc_unlocked(cfile)) != EOF &&
- !isspace(c); ++i) {
- *tmp++ = c;
- }
- if (c == EOF) {
- printf("Macro definition missing null line terminator.\n");
- goto bad;
- }
- *tmp = '\0';
- if (c != '\n') {
- while ((c=getc_unlocked(cfile)) != EOF
- && c != '\n');
- }
- if (c == EOF) {
- printf("Macro definition missing null line terminator.\n");
- goto bad;
- }
- if (macnum == 0) {
- macros[macnum].mac_start = macbuf;
- }
- else {
- macros[macnum].mac_start = macros[macnum-1].mac_end + 1;
- }
- tmp = macros[macnum].mac_start;
- while (tmp != macbuf + 4096) {
- if ((c=getc_unlocked(cfile)) == EOF) {
- printf("Macro definition missing null line terminator.\n");
- goto bad;
- }
- *tmp = c;
- if (*tmp == '\n') {
- if (*(tmp-1) == '\0') {
- macros[macnum++].mac_end = tmp - 1;
- break;
- }
- *tmp = '\0';
- }
- tmp++;
- }
- if (tmp == macbuf + 4096) {
- printf("4K macro buffer exceeded\n");
- goto bad;
- }
-#endif
- break;
- default:
- warnx2(_("Unknown .netrc keyword %s"), tokval);
- break;
- }
- goto done;
- }
-done:
- (void) fclose(cfile);
- return (0);
-bad:
- (void) fclose(cfile);
- return (-1);
-}
-libc_hidden_def (ruserpass)
-
-static int
-token()
-{
- char *cp;
- int c;
- int i;
-
- if (feof(cfile) || ferror(cfile))
- return (0);
- while ((c = getc_unlocked(cfile)) != EOF &&
- (c == '\n' || c == '\t' || c == ' ' || c == ','))
- continue;
- if (c == EOF)
- return (0);
- cp = tokval;
- if (c == '"') {
- while ((c = getc_unlocked(cfile)) != EOF && c != '"') {
- if (c == '\\')
- c = getc_unlocked(cfile);
- *cp++ = c;
- }
- } else {
- *cp++ = c;
- while ((c = getc_unlocked(cfile)) != EOF
- && c != '\n' && c != '\t' && c != ' ' && c != ',') {
- if (c == '\\')
- c = getc_unlocked(cfile);
- *cp++ = c;
- }
- }
- *cp = 0;
- if (tokval[0] == 0)
- return (0);
- for (i = 0; i < (int) (sizeof (toktab) / sizeof (toktab[0])); ++i)
- if (!strcmp(&tokstr[toktab[i].tokstr_off], tokval))
- return toktab[i].tval;
- return (ID);
-}
diff --git a/newlib/libc/sys/linux/net/send.c b/newlib/libc/sys/linux/net/send.c
index 658c92b71..8ff65d015 100644
--- a/newlib/libc/sys/linux/net/send.c
+++ b/newlib/libc/sys/linux/net/send.c
@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)send.c 8.2 (Berkeley) 2/21/94";
#include <sys/cdefs.h>
#include <sys/types.h>
+#include "namespace.h"
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/newlib/libc/sys/linux/net/service-lookup.c b/newlib/libc/sys/linux/net/service-lookup.c
deleted file mode 100644
index 67d401e08..000000000
--- a/newlib/libc/sys/linux/net/service-lookup.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME services
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/spwd-lookup.c b/newlib/libc/sys/linux/net/spwd-lookup.c
deleted file mode 100644
index 40c2f613c..000000000
--- a/newlib/libc/sys/linux/net/spwd-lookup.c
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 1996 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#define DATABASE_NAME shadow
-#define ALTERNATE_NAME passwd
-#define DEFAULT_CONFIG "compat [NOTFOUND=return] files"
-
-#include "XXX-lookup.c"
diff --git a/newlib/libc/sys/linux/net/vars.c b/newlib/libc/sys/linux/net/vars.c
new file mode 100644
index 000000000..c91a04bd1
--- /dev/null
+++ b/newlib/libc/sys/linux/net/vars.c
@@ -0,0 +1,45 @@
+/* $KAME: vars.c,v 1.2 2001/08/20 02:32:41 itojun Exp $ */
+
+/*
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <sys/types.h>
+#include <netinet/in.h>
+
+/*
+ * Definitions of some costant IPv6 addresses.
+ */
+const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
+const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
+const struct in6_addr in6addr_nodelocal_allnodes = IN6ADDR_NODELOCAL_ALLNODES_INIT;
+const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
+
diff --git a/newlib/libc/sys/linux/shlib-compat.h b/newlib/libc/sys/linux/shlib-compat.h
deleted file mode 100644
index eb7514c73..000000000
--- a/newlib/libc/sys/linux/shlib-compat.h
+++ /dev/null
@@ -1 +0,0 @@
-#define SHLIB_COMPAT(libc, introduced, obsoleted) 0
diff --git a/newlib/libc/sys/linux/stdlib/COPYRIGHT b/newlib/libc/sys/linux/stdlib/COPYRIGHT
new file mode 100644
index 000000000..574f6bcec
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/COPYRIGHT
@@ -0,0 +1,56 @@
+Copyright 1992, 1993, 1994 Henry Spencer. All rights reserved.
+This software is not subject to any license of the American Telephone
+and Telegraph Company or of the Regents of the University of California.
+
+Permission is granted to anyone to use this software for any purpose on
+any computer system, and to alter it and redistribute it, subject
+to the following restrictions:
+
+1. The author is not responsible for the consequences of use of this
+ software, no matter how awful, even if they arise from flaws in it.
+
+2. The origin of this software must not be misrepresented, either by
+ explicit claim or by omission. Since few users ever read sources,
+ credits must appear in the documentation.
+
+3. Altered versions must be plainly marked as such, and must not be
+ misrepresented as being the original software. Since few users
+ ever read sources, credits must appear in the documentation.
+
+4. This notice may not be removed or altered.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+/*-
+ * Copyright (c) 1994
+ * 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.
+ *
+ * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94
+ */
diff --git a/newlib/libc/sys/linux/stdlib/Makefile.am b/newlib/libc/sys/linux/stdlib/Makefile.am
new file mode 100644
index 000000000..7e8e65389
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/Makefile.am
@@ -0,0 +1,41 @@
+## Process this file with automake to generate Makefile.in
+
+AUTOMAKE_OPTIONS = cygnus
+
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+
+GENERAL_SOURCES = \
+ fnmatch.c glob.c regcomp.c regerror.c regex2.h \
+ regexec.c regfree.c collate.h collate.c collcmp.c \
+ reallocf.c
+
+ELIX_3_SOURCES = \
+ wordexp.c \
+ wordfree.c
+
+if ELIX_LEVEL_1
+ELIX_SOURCES =
+else
+if ELIX_LEVEL_2
+ELIX_SOURCES =
+else
+ELIX_SOURCES = $(ELIX_3_SOURCES)
+endif
+endif
+
+libstdlib_la_LDFLAGS = -Xcompiler -nostdlib
+
+if USE_LIBTOOL
+noinst_LTLIBRARIES = libstdlib.la
+libstdlib_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
+noinst_DATA = objectlist.awk.in
+else
+noinst_LIBRARIES = lib.a
+lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
+lib_a_CFLAGS = $(AM_CFLAGS)
+noinst_DATA =
+endif # USE_LIBTOOL
+
+AM_CFLAGS = -D_GNU_SOURCE
+
+include $(srcdir)/../../../../Makefile.shared
diff --git a/newlib/libc/sys/linux/stdlib/Makefile.in b/newlib/libc/sys/linux/stdlib/Makefile.in
new file mode 100644
index 000000000..954001aea
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/Makefile.in
@@ -0,0 +1,537 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = $(srcdir)/../../../../Makefile.shared \
+ $(srcdir)/Makefile.in $(srcdir)/Makefile.am
+subdir = stdlib
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/../../../../libtool.m4 \
+ $(top_srcdir)/../../../../ltoptions.m4 \
+ $(top_srcdir)/../../../../ltsugar.m4 \
+ $(top_srcdir)/../../../../ltversion.m4 \
+ $(top_srcdir)/../../../acinclude.m4 $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/../../../../mkinstalldirs
+CONFIG_CLEAN_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+ARFLAGS = cru
+lib_a_AR = $(AR) $(ARFLAGS)
+lib_a_LIBADD =
+am__objects_1 = lib_a-fnmatch.$(OBJEXT) lib_a-glob.$(OBJEXT) \
+ lib_a-regcomp.$(OBJEXT) lib_a-regerror.$(OBJEXT) \
+ lib_a-regexec.$(OBJEXT) lib_a-regfree.$(OBJEXT) \
+ lib_a-collate.$(OBJEXT) lib_a-collcmp.$(OBJEXT) \
+ lib_a-reallocf.$(OBJEXT)
+am__objects_2 = lib_a-wordexp.$(OBJEXT) lib_a-wordfree.$(OBJEXT)
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@am__objects_3 = \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@ $(am__objects_2)
+@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
+@USE_LIBTOOL_FALSE@ $(am__objects_3)
+lib_a_OBJECTS = $(am_lib_a_OBJECTS)
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libstdlib_la_LIBADD =
+am__objects_4 = fnmatch.lo glob.lo regcomp.lo regerror.lo regexec.lo \
+ regfree.lo collate.lo collcmp.lo reallocf.lo
+am__objects_5 = wordexp.lo wordfree.lo
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@am__objects_6 = \
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@ $(am__objects_5)
+@USE_LIBTOOL_TRUE@am_libstdlib_la_OBJECTS = $(am__objects_4) \
+@USE_LIBTOOL_TRUE@ $(am__objects_6)
+libstdlib_la_OBJECTS = $(am_libstdlib_la_OBJECTS)
+@USE_LIBTOOL_TRUE@am_libstdlib_la_rpath =
+DEFAULT_INCLUDES = -I. -I$(srcdir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(lib_a_SOURCES) $(libstdlib_la_SOURCES)
+DATA = $(noinst_DATA)
+ETAGS = etags
+CTAGS = ctags
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCAS = @CCAS@
+CCASFLAGS = @CCASFLAGS@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ELIX_LEVEL_0_FALSE = @ELIX_LEVEL_0_FALSE@
+ELIX_LEVEL_0_TRUE = @ELIX_LEVEL_0_TRUE@
+ELIX_LEVEL_1_FALSE = @ELIX_LEVEL_1_FALSE@
+ELIX_LEVEL_1_TRUE = @ELIX_LEVEL_1_TRUE@
+ELIX_LEVEL_2_FALSE = @ELIX_LEVEL_2_FALSE@
+ELIX_LEVEL_2_TRUE = @ELIX_LEVEL_2_TRUE@
+ELIX_LEVEL_3_FALSE = @ELIX_LEVEL_3_FALSE@
+ELIX_LEVEL_3_TRUE = @ELIX_LEVEL_3_TRUE@
+ELIX_LEVEL_4_FALSE = @ELIX_LEVEL_4_FALSE@
+ELIX_LEVEL_4_TRUE = @ELIX_LEVEL_4_TRUE@
+EXEEXT = @EXEEXT@
+EXTRA_SUBDIRS = @EXTRA_SUBDIRS@
+EXTRA_SUBLIBS = @EXTRA_SUBLIBS@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LINUX_MACH_LIB = @LINUX_MACH_LIB@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+MAY_SUPPLY_SYSCALLS_FALSE = @MAY_SUPPLY_SYSCALLS_FALSE@
+MAY_SUPPLY_SYSCALLS_TRUE = @MAY_SUPPLY_SYSCALLS_TRUE@
+NEWLIB_CFLAGS = @NEWLIB_CFLAGS@
+NM = @NM@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+READELF = @READELF@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_LIBTOOL_FALSE = @USE_LIBTOOL_FALSE@
+USE_LIBTOOL_TRUE = @USE_LIBTOOL_TRUE@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+aext = @aext@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+libm_machine_dir = @libm_machine_dir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lpfx = @lpfx@
+lt_ECHO = @lt_ECHO@
+machine_dir = @machine_dir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+newlib_basedir = @newlib_basedir@
+oext = @oext@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+subdirs = @subdirs@
+sys_dir = @sys_dir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+AUTOMAKE_OPTIONS = cygnus
+INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS)
+GENERAL_SOURCES = \
+ fnmatch.c glob.c regcomp.c regerror.c regex2.h \
+ regexec.c regfree.c collate.h collate.c collcmp.c \
+ reallocf.c
+
+ELIX_3_SOURCES = \
+ wordexp.c \
+ wordfree.c
+
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@ELIX_SOURCES = $(ELIX_3_SOURCES)
+@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_SOURCES =
+@ELIX_LEVEL_1_TRUE@ELIX_SOURCES =
+libstdlib_la_LDFLAGS = -Xcompiler -nostdlib
+@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libstdlib.la
+@USE_LIBTOOL_TRUE@libstdlib_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
+@USE_LIBTOOL_FALSE@noinst_DATA =
+@USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in
+@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
+@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
+@USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
+AM_CFLAGS = -D_GNU_SOURCE
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../../../Makefile.shared $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus stdlib/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --cygnus stdlib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES)
+ -rm -f lib.a
+ $(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD)
+ $(RANLIB) lib.a
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libstdlib.la: $(libstdlib_la_OBJECTS) $(libstdlib_la_DEPENDENCIES)
+ $(LINK) $(am_libstdlib_la_rpath) $(libstdlib_la_LDFLAGS) $(libstdlib_la_OBJECTS) $(libstdlib_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+.c.o:
+ $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
+
+lib_a-fnmatch.o: fnmatch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fnmatch.o `test -f 'fnmatch.c' || echo '$(srcdir)/'`fnmatch.c
+
+lib_a-fnmatch.obj: fnmatch.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fnmatch.obj `if test -f 'fnmatch.c'; then $(CYGPATH_W) 'fnmatch.c'; else $(CYGPATH_W) '$(srcdir)/fnmatch.c'; fi`
+
+lib_a-glob.o: glob.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-glob.o `test -f 'glob.c' || echo '$(srcdir)/'`glob.c
+
+lib_a-glob.obj: glob.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-glob.obj `if test -f 'glob.c'; then $(CYGPATH_W) 'glob.c'; else $(CYGPATH_W) '$(srcdir)/glob.c'; fi`
+
+lib_a-regcomp.o: regcomp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regcomp.o `test -f 'regcomp.c' || echo '$(srcdir)/'`regcomp.c
+
+lib_a-regcomp.obj: regcomp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regcomp.obj `if test -f 'regcomp.c'; then $(CYGPATH_W) 'regcomp.c'; else $(CYGPATH_W) '$(srcdir)/regcomp.c'; fi`
+
+lib_a-regerror.o: regerror.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regerror.o `test -f 'regerror.c' || echo '$(srcdir)/'`regerror.c
+
+lib_a-regerror.obj: regerror.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regerror.obj `if test -f 'regerror.c'; then $(CYGPATH_W) 'regerror.c'; else $(CYGPATH_W) '$(srcdir)/regerror.c'; fi`
+
+lib_a-regexec.o: regexec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regexec.o `test -f 'regexec.c' || echo '$(srcdir)/'`regexec.c
+
+lib_a-regexec.obj: regexec.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regexec.obj `if test -f 'regexec.c'; then $(CYGPATH_W) 'regexec.c'; else $(CYGPATH_W) '$(srcdir)/regexec.c'; fi`
+
+lib_a-regfree.o: regfree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regfree.o `test -f 'regfree.c' || echo '$(srcdir)/'`regfree.c
+
+lib_a-regfree.obj: regfree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-regfree.obj `if test -f 'regfree.c'; then $(CYGPATH_W) 'regfree.c'; else $(CYGPATH_W) '$(srcdir)/regfree.c'; fi`
+
+lib_a-collate.o: collate.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-collate.o `test -f 'collate.c' || echo '$(srcdir)/'`collate.c
+
+lib_a-collate.obj: collate.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-collate.obj `if test -f 'collate.c'; then $(CYGPATH_W) 'collate.c'; else $(CYGPATH_W) '$(srcdir)/collate.c'; fi`
+
+lib_a-collcmp.o: collcmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-collcmp.o `test -f 'collcmp.c' || echo '$(srcdir)/'`collcmp.c
+
+lib_a-collcmp.obj: collcmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-collcmp.obj `if test -f 'collcmp.c'; then $(CYGPATH_W) 'collcmp.c'; else $(CYGPATH_W) '$(srcdir)/collcmp.c'; fi`
+
+lib_a-reallocf.o: reallocf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-reallocf.o `test -f 'reallocf.c' || echo '$(srcdir)/'`reallocf.c
+
+lib_a-reallocf.obj: reallocf.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-reallocf.obj `if test -f 'reallocf.c'; then $(CYGPATH_W) 'reallocf.c'; else $(CYGPATH_W) '$(srcdir)/reallocf.c'; fi`
+
+lib_a-wordexp.o: wordexp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wordexp.o `test -f 'wordexp.c' || echo '$(srcdir)/'`wordexp.c
+
+lib_a-wordexp.obj: wordexp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wordexp.obj `if test -f 'wordexp.c'; then $(CYGPATH_W) 'wordexp.c'; else $(CYGPATH_W) '$(srcdir)/wordexp.c'; fi`
+
+lib_a-wordfree.o: wordfree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wordfree.o `test -f 'wordfree.c' || echo '$(srcdir)/'`wordfree.c
+
+lib_a-wordfree.obj: wordfree.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wordfree.obj `if test -f 'wordfree.c'; then $(CYGPATH_W) 'wordfree.c'; else $(CYGPATH_W) '$(srcdir)/wordfree.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-am:
+check: check-am
+all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \
+ clean-noinstLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags dvi dvi-am html html-am info \
+ info-am install install-am install-data install-data-am \
+ install-exec install-exec-am install-info install-info-am \
+ install-man install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
+
+objectlist.awk.in: $(noinst_LTLIBRARIES)
+ -rm -f objectlist.awk.in
+ for i in `ls *.lo` ; \
+ do \
+ echo $$i `pwd`/$$i >> objectlist.awk.in ; \
+ done
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/newlib/libc/sys/linux/stdlib/cclass.h b/newlib/libc/sys/linux/stdlib/cclass.h
new file mode 100644
index 000000000..956a655fa
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/cclass.h
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)cclass.h 8.3 (Berkeley) 3/20/94
+ * $FreeBSD: src/lib/libc/regex/cclass.h,v 1.4 2002/03/22 23:41:56 obrien Exp $
+ */
+
+
+typedef enum {CALNUM, CALPHA, CBLANK, CCNTRL, CDIGIT, CGRAPH,
+ CLOWER, CPRINT, CPUNCT, CSPACE, CUPPER, CXDIGIT} citype;
+
+/* character-class table */
+static struct cclass {
+ char *name;
+ citype fidx;
+} cclasses[] = {
+ {"alnum", CALNUM},
+ {"alpha", CALPHA},
+ {"blank", CBLANK},
+ {"cntrl", CCNTRL},
+ {"digit", CDIGIT},
+ {"graph", CGRAPH},
+ {"lower", CLOWER},
+ {"print", CPRINT},
+ {"punct", CPUNCT},
+ {"space", CSPACE},
+ {"upper", CUPPER},
+ {"xdigit", CXDIGIT},
+ {NULL, }
+};
diff --git a/newlib/libc/sys/linux/stdlib/cname.h b/newlib/libc/sys/linux/stdlib/cname.h
new file mode 100644
index 000000000..4f0d583d2
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/cname.h
@@ -0,0 +1,142 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)cname.h 8.3 (Berkeley) 3/20/94
+ * $FreeBSD: src/lib/libc/regex/cname.h,v 1.3 2002/03/22 23:41:56 obrien Exp $
+ */
+
+/* character-name table */
+static struct cname {
+ char *name;
+ char code;
+} cnames[] = {
+ {"NUL", '\0'},
+ {"SOH", '\001'},
+ {"STX", '\002'},
+ {"ETX", '\003'},
+ {"EOT", '\004'},
+ {"ENQ", '\005'},
+ {"ACK", '\006'},
+ {"BEL", '\007'},
+ {"alert", '\007'},
+ {"BS", '\010'},
+ {"backspace", '\b'},
+ {"HT", '\011'},
+ {"tab", '\t'},
+ {"LF", '\012'},
+ {"newline", '\n'},
+ {"VT", '\013'},
+ {"vertical-tab", '\v'},
+ {"FF", '\014'},
+ {"form-feed", '\f'},
+ {"CR", '\015'},
+ {"carriage-return", '\r'},
+ {"SO", '\016'},
+ {"SI", '\017'},
+ {"DLE", '\020'},
+ {"DC1", '\021'},
+ {"DC2", '\022'},
+ {"DC3", '\023'},
+ {"DC4", '\024'},
+ {"NAK", '\025'},
+ {"SYN", '\026'},
+ {"ETB", '\027'},
+ {"CAN", '\030'},
+ {"EM", '\031'},
+ {"SUB", '\032'},
+ {"ESC", '\033'},
+ {"IS4", '\034'},
+ {"FS", '\034'},
+ {"IS3", '\035'},
+ {"GS", '\035'},
+ {"IS2", '\036'},
+ {"RS", '\036'},
+ {"IS1", '\037'},
+ {"US", '\037'},
+ {"space", ' '},
+ {"exclamation-mark", '!'},
+ {"quotation-mark", '"'},
+ {"number-sign", '#'},
+ {"dollar-sign", '$'},
+ {"percent-sign", '%'},
+ {"ampersand", '&'},
+ {"apostrophe", '\''},
+ {"left-parenthesis", '('},
+ {"right-parenthesis", ')'},
+ {"asterisk", '*'},
+ {"plus-sign", '+'},
+ {"comma", ','},
+ {"hyphen", '-'},
+ {"hyphen-minus", '-'},
+ {"period", '.'},
+ {"full-stop", '.'},
+ {"slash", '/'},
+ {"solidus", '/'},
+ {"zero", '0'},
+ {"one", '1'},
+ {"two", '2'},
+ {"three", '3'},
+ {"four", '4'},
+ {"five", '5'},
+ {"six", '6'},
+ {"seven", '7'},
+ {"eight", '8'},
+ {"nine", '9'},
+ {"colon", ':'},
+ {"semicolon", ';'},
+ {"less-than-sign", '<'},
+ {"equals-sign", '='},
+ {"greater-than-sign", '>'},
+ {"question-mark", '?'},
+ {"commercial-at", '@'},
+ {"left-square-bracket", '['},
+ {"backslash", '\\'},
+ {"reverse-solidus", '\\'},
+ {"right-square-bracket",']'},
+ {"circumflex", '^'},
+ {"circumflex-accent", '^'},
+ {"underscore", '_'},
+ {"low-line", '_'},
+ {"grave-accent", '`'},
+ {"left-brace", '{'},
+ {"left-curly-bracket", '{'},
+ {"vertical-line", '|'},
+ {"right-brace", '}'},
+ {"right-curly-bracket", '}'},
+ {"tilde", '~'},
+ {"DEL", '\177'},
+ {NULL, 0}
+};
diff --git a/newlib/libc/sys/linux/stdlib/collate.c b/newlib/libc/sys/linux/stdlib/collate.c
new file mode 100644
index 000000000..37ef80bf5
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/collate.c
@@ -0,0 +1,216 @@
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
+ * at Electronni Visti IA, Kiev, Ukraine.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+
+#include "namespace.h"
+#include <rune.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sysexits.h>
+#include "un-namespace.h"
+
+#include "collate.h"
+#include "setlocale.h"
+
+#include "libc_private.h"
+
+extern char *_PathLocale;
+int __collate_load_error = 1;
+int __collate_substitute_nontrivial;
+char __collate_version[STR_LEN];
+u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
+struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
+struct __collate_st_chain_pri __collate_chain_pri_table[TABLE_SIZE];
+
+#define FREAD(a, b, c, d) \
+ do { \
+ if (fread(a, b, c, d) != c) { \
+ fclose(d); \
+ return -1; \
+ } \
+ } while(0)
+
+void __collate_err(int ex, const char *f);
+
+int
+__collate_load_tables(encoding)
+ char *encoding;
+{
+ char buf[PATH_MAX];
+ FILE *fp;
+ int i, save_load_error;
+
+ save_load_error = __collate_load_error;
+ __collate_load_error = 1;
+ if (!encoding) {
+ __collate_load_error = save_load_error;
+ return -1;
+ }
+ if (!strcmp(encoding, "C") || !strcmp(encoding, "POSIX"))
+ return 0;
+ if (!_PathLocale) {
+ __collate_load_error = save_load_error;
+ return -1;
+ }
+ /* Range checking not needed, encoding has fixed size */
+ (void) strcpy(buf, _PathLocale);
+ (void) strcat(buf, "/");
+ (void) strcat(buf, encoding);
+ (void) strcat(buf, "/LC_COLLATE");
+ if ((fp = fopen(buf, "r")) == NULL) {
+ __collate_load_error = save_load_error;
+ return -1;
+ }
+ FREAD(__collate_version, sizeof(__collate_version), 1, fp);
+ if (strcmp(__collate_version, COLLATE_VERSION) != 0) {
+ fclose(fp);
+ return -1;
+ }
+ FREAD(__collate_substitute_table, sizeof(__collate_substitute_table),
+ 1, fp);
+ FREAD(__collate_char_pri_table, sizeof(__collate_char_pri_table), 1,
+ fp);
+ FREAD(__collate_chain_pri_table, sizeof(__collate_chain_pri_table), 1,
+ fp);
+ fclose(fp);
+ __collate_load_error = 0;
+
+ __collate_substitute_nontrivial = 0;
+ for (i = 0; i < UCHAR_MAX + 1; i++) {
+ if (__collate_substitute_table[i][0] != i ||
+ __collate_substitute_table[i][1] != 0) {
+ __collate_substitute_nontrivial = 1;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+u_char *
+__collate_substitute(s)
+ const u_char *s;
+{
+ int dest_len, len, nlen;
+ int delta = strlen(s);
+ u_char *dest_str = NULL;
+
+ if(s == NULL || *s == '\0')
+ return __collate_strdup("");
+ delta += delta / 8;
+ dest_str = malloc(dest_len = delta);
+ if(dest_str == NULL)
+ __collate_err(EX_OSERR, __FUNCTION__);
+ len = 0;
+ while(*s) {
+ nlen = len + strlen(__collate_substitute_table[*s]);
+ if (dest_len <= nlen) {
+ dest_str = reallocf(dest_str, dest_len = nlen + delta);
+ if(dest_str == NULL)
+ __collate_err(EX_OSERR, __FUNCTION__);
+ }
+ strcpy(dest_str + len, __collate_substitute_table[*s++]);
+ len = nlen;
+ }
+ return dest_str;
+}
+
+void
+__collate_lookup(t, len, prim, sec)
+ const u_char *t;
+ int *len, *prim, *sec;
+{
+ struct __collate_st_chain_pri *p2;
+
+ *len = 1;
+ *prim = *sec = 0;
+ for(p2 = __collate_chain_pri_table; p2->str[0]; p2++) {
+ if(strncmp(t, p2->str, strlen(p2->str)) == 0) {
+ *len = strlen(p2->str);
+ *prim = p2->prim;
+ *sec = p2->sec;
+ return;
+ }
+ }
+ *prim = __collate_char_pri_table[*t].prim;
+ *sec = __collate_char_pri_table[*t].sec;
+}
+
+u_char *
+__collate_strdup(s)
+ u_char *s;
+{
+ u_char *t = strdup(s);
+
+ if (t == NULL)
+ __collate_err(EX_OSERR, __FUNCTION__);
+ return t;
+}
+
+void
+__collate_err(int ex, const char *f)
+{
+ const char *s = strdup("collate_error");
+ int serrno = errno;
+
+ write(STDERR_FILENO, s, strlen(s));
+ write(STDERR_FILENO, ": ", 2);
+ free(s);
+ s = f;
+ write(STDERR_FILENO, s, strlen(s));
+ write(STDERR_FILENO, ": ", 2);
+ s = strerror(serrno);
+ write(STDERR_FILENO, s, strlen(s));
+ write(STDERR_FILENO, "\n", 1);
+ exit(ex);
+}
+
+#ifdef COLLATE_DEBUG
+void
+__collate_print_tables()
+{
+ int i;
+ struct __collate_st_chain_pri *p2;
+
+ printf("Substitute table:\n");
+ for (i = 0; i < UCHAR_MAX + 1; i++)
+ if (i != *__collate_substitute_table[i])
+ printf("\t'%c' --> \"%s\"\n", i,
+ __collate_substitute_table[i]);
+ printf("Chain priority table:\n");
+ for (p2 = __collate_chain_pri_table; p2->str[0]; p2++)
+ printf("\t\"%s\" : %d %d\n\n", p2->str, p2->prim, p2->sec);
+ printf("Char priority table:\n");
+ for (i = 0; i < UCHAR_MAX + 1; i++)
+ printf("\t'%c' : %d %d\n", i, __collate_char_pri_table[i].prim,
+ __collate_char_pri_table[i].sec);
+}
+#endif
diff --git a/newlib/libc/sys/linux/stdlib/collate.h b/newlib/libc/sys/linux/stdlib/collate.h
new file mode 100644
index 000000000..2e045188a
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/collate.h
@@ -0,0 +1,67 @@
+/*-
+ * Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
+ * at Electronni Visti IA, Kiev, Ukraine.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * $FreeBSD: src/lib/libc/locale/collate.h,v 1.11 2002/03/21 22:46:54 obrien Exp $
+ */
+
+#ifndef _COLLATE_H_
+#define _COLLATE_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <limits.h>
+
+#define STR_LEN 10
+#define TABLE_SIZE 100
+#define COLLATE_VERSION "1.0\n"
+
+struct __collate_st_char_pri {
+ int prim, sec;
+};
+struct __collate_st_chain_pri {
+ u_char str[STR_LEN];
+ int prim, sec;
+};
+
+extern int __collate_load_error;
+extern int __collate_substitute_nontrivial;
+extern char __collate_version[STR_LEN];
+extern u_char __collate_substitute_table[UCHAR_MAX + 1][STR_LEN];
+extern struct __collate_st_char_pri __collate_char_pri_table[UCHAR_MAX + 1];
+extern struct __collate_st_chain_pri __collate_chain_pri_table[TABLE_SIZE];
+
+__BEGIN_DECLS
+u_char *__collate_strdup(u_char *);
+u_char *__collate_substitute(const u_char *);
+int __collate_load_tables(char *);
+void __collate_lookup(const u_char *, int *, int *, int *);
+int __collate_range_cmp(int, int);
+#ifdef COLLATE_DEBUG
+void __collate_print_tables(void);
+#endif
+__END_DECLS
+
+#endif /* !_COLLATE_H_ */
diff --git a/newlib/libc/sys/linux/stdlib/collcmp.c b/newlib/libc/sys/linux/stdlib/collcmp.c
new file mode 100644
index 000000000..777089761
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/collcmp.c
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 1996 by Andrey A. Chernov, Moscow, Russia.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
+ */
+
+#include <sys/cdefs.h>
+
+#define ASCII_COMPATIBLE_COLLATE /* see share/colldef */
+
+#include <string.h>
+#include "collate.h"
+#ifndef ASCII_COMPATIBLE_COLLATE
+#include <ctype.h>
+#endif
+
+/*
+ * Compare two characters converting collate information
+ * into ASCII-compatible range, it allows to handle
+ * "[a-z]"-type ranges with national characters.
+ */
+
+int __collate_range_cmp (c1, c2)
+ int c1, c2;
+{
+ static char s1[2], s2[2];
+ int ret;
+#ifndef ASCII_COMPATIBLE_COLLATE
+ int as1, as2, al1, al2;
+#endif
+
+ c1 &= UCHAR_MAX;
+ c2 &= UCHAR_MAX;
+ if (c1 == c2)
+ return (0);
+
+#ifndef ASCII_COMPATIBLE_COLLATE
+ as1 = isascii(c1);
+ as2 = isascii(c2);
+ al1 = isalpha(c1);
+ al2 = isalpha(c2);
+
+ if (as1 || as2 || al1 || al2) {
+ if ((as1 && as2) || (!al1 && !al2))
+ return (c1 - c2);
+ if (al1 && !al2) {
+ if (isupper(c1))
+ return ('A' - c2);
+ else
+ return ('a' - c2);
+ } else if (al2 && !al1) {
+ if (isupper(c2))
+ return (c1 - 'A');
+ else
+ return (c1 - 'a');
+ }
+ }
+#endif
+ s1[0] = c1;
+ s2[0] = c2;
+ if ((ret = strcoll(s1, s2)) != 0)
+ return (ret);
+ return (c1 - c2);
+}
diff --git a/newlib/libc/sys/linux/stdlib/engine.c b/newlib/libc/sys/linux/stdlib/engine.c
new file mode 100644
index 000000000..ab21bb4c2
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/engine.c
@@ -0,0 +1,1139 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)engine.c 8.5 (Berkeley) 3/20/94
+ */
+
+#include <sys/cdefs.h>
+
+/*
+ * The matching engine and friends. This file is #included by regexec.c
+ * after suitable #defines of a variety of macros used herein, so that
+ * different state representations can be used without duplicating masses
+ * of code.
+ */
+
+#ifdef SNAMES
+#define matcher smatcher
+#define fast sfast
+#define slow sslow
+#define dissect sdissect
+#define backref sbackref
+#define step sstep
+#define print sprint
+#define at sat
+#define match smat
+#endif
+#ifdef LNAMES
+#define matcher lmatcher
+#define fast lfast
+#define slow lslow
+#define dissect ldissect
+#define backref lbackref
+#define step lstep
+#define print lprint
+#define at lat
+#define match lmat
+#endif
+
+/* another structure passed up and down to avoid zillions of parameters */
+struct match {
+ struct re_guts *g;
+ int eflags;
+ regmatch_t *pmatch; /* [nsub+1] (0 element unused) */
+ char *offp; /* offsets work from here */
+ char *beginp; /* start of string -- virtual NUL precedes */
+ char *endp; /* end of string -- virtual NUL here */
+ char *coldp; /* can be no match starting before here */
+ char **lastpos; /* [nplus+1] */
+ STATEVARS;
+ states st; /* current states */
+ states fresh; /* states for a fresh start */
+ states tmp; /* temporary */
+ states empty; /* empty set of states */
+};
+
+/* ========= begin header generated by ./mkh ========= */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* === engine.c === */
+static int matcher(struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
+static char *dissect(struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static char *backref(struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
+static char *fast(struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static char *slow(struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static states step(struct re_guts *g, sopno start, sopno stop, states bef, int ch, states aft);
+#define BOL (OUT+1)
+#define EOL (BOL+1)
+#define BOLEOL (BOL+2)
+#define NOTHING (BOL+3)
+#define BOW (BOL+4)
+#define EOW (BOL+5)
+#define CODEMAX (BOL+5) /* highest code used */
+#define NONCHAR(c) ((c) > CHAR_MAX)
+#define NNONCHAR (CODEMAX-CHAR_MAX)
+#ifdef REDEBUG
+static void print(struct match *m, char *caption, states st, int ch, FILE *d);
+#endif
+#ifdef REDEBUG
+static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
+#endif
+#ifdef REDEBUG
+static char *pchar(int ch);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+/* ========= end header generated by ./mkh ========= */
+
+#ifdef REDEBUG
+#define SP(t, s, c) print(m, t, s, c, stdout)
+#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
+#define NOTE(str) { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
+#else
+#define SP(t, s, c) /* nothing */
+#define AT(t, p1, p2, s1, s2) /* nothing */
+#define NOTE(s) /* nothing */
+#endif
+
+/*
+ - matcher - the actual matching engine
+ == static int matcher(struct re_guts *g, char *string, \
+ == size_t nmatch, regmatch_t pmatch[], int eflags);
+ */
+static int /* 0 success, REG_NOMATCH failure */
+matcher(g, string, nmatch, pmatch, eflags)
+struct re_guts *g;
+char *string;
+size_t nmatch;
+regmatch_t pmatch[];
+int eflags;
+{
+ char *endp;
+ int i;
+ struct match mv;
+ struct match *m = &mv;
+ char *dp;
+ const sopno gf = g->firststate+1; /* +1 for OEND */
+ const sopno gl = g->laststate;
+ char *start;
+ char *stop;
+ /* Boyer-Moore algorithms variables */
+ char *pp;
+ int cj, mj;
+ char *mustfirst;
+ char *mustlast;
+ int *matchjump;
+ int *charjump;
+
+ /* simplify the situation where possible */
+ if (g->cflags&REG_NOSUB)
+ nmatch = 0;
+ if (eflags&REG_STARTEND) {
+ start = string + pmatch[0].rm_so;
+ stop = string + pmatch[0].rm_eo;
+ } else {
+ start = string;
+ stop = start + strlen(start);
+ }
+ if (stop < start)
+ return(REG_INVARG);
+
+ /* prescreening; this does wonders for this rather slow code */
+ if (g->must != NULL) {
+ if (g->charjump != NULL && g->matchjump != NULL) {
+ mustfirst = g->must;
+ mustlast = g->must + g->mlen - 1;
+ charjump = g->charjump;
+ matchjump = g->matchjump;
+ pp = mustlast;
+ for (dp = start+g->mlen-1; dp < stop;) {
+ /* Fast skip non-matches */
+ while (dp < stop && charjump[*dp])
+ dp += charjump[*dp];
+
+ if (dp >= stop)
+ break;
+
+ /* Greedy matcher */
+ /* We depend on not being used for
+ * for strings of length 1
+ */
+ while (*--dp == *--pp && pp != mustfirst);
+
+ if (*dp == *pp)
+ break;
+
+ /* Jump to next possible match */
+ mj = matchjump[pp - mustfirst];
+ cj = charjump[*dp];
+ dp += (cj < mj ? mj : cj);
+ pp = mustlast;
+ }
+ if (pp != mustfirst)
+ return(REG_NOMATCH);
+ } else {
+ for (dp = start; dp < stop; dp++)
+ if (*dp == g->must[0] &&
+ stop - dp >= g->mlen &&
+ memcmp(dp, g->must, (size_t)g->mlen) == 0)
+ break;
+ if (dp == stop) /* we didn't find g->must */
+ return(REG_NOMATCH);
+ }
+ }
+
+ /* match struct setup */
+ m->g = g;
+ m->eflags = eflags;
+ m->pmatch = NULL;
+ m->lastpos = NULL;
+ m->offp = string;
+ m->beginp = start;
+ m->endp = stop;
+ STATESETUP(m, 4);
+ SETUP(m->st);
+ SETUP(m->fresh);
+ SETUP(m->tmp);
+ SETUP(m->empty);
+ CLEAR(m->empty);
+
+ /* Adjust start according to moffset, to speed things up */
+ if (g->moffset > -1)
+ start = ((dp - g->moffset) < start) ? start : dp - g->moffset;
+
+ /* this loop does only one repetition except for backrefs */
+ for (;;) {
+ endp = fast(m, start, stop, gf, gl);
+ if (endp == NULL) { /* a miss */
+ STATETEARDOWN(m);
+ return(REG_NOMATCH);
+ }
+ if (nmatch == 0 && !g->backrefs)
+ break; /* no further info needed */
+
+ /* where? */
+ assert(m->coldp != NULL);
+ for (;;) {
+ NOTE("finding start");
+ endp = slow(m, m->coldp, stop, gf, gl);
+ if (endp != NULL)
+ break;
+ assert(m->coldp < m->endp);
+ m->coldp++;
+ }
+ if (nmatch == 1 && !g->backrefs)
+ break; /* no further info needed */
+
+ /* oh my, he wants the subexpressions... */
+ if (m->pmatch == NULL)
+ m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
+ sizeof(regmatch_t));
+ if (m->pmatch == NULL) {
+ STATETEARDOWN(m);
+ return(REG_ESPACE);
+ }
+ for (i = 1; i <= m->g->nsub; i++)
+ m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
+ if (!g->backrefs && !(m->eflags&REG_BACKR)) {
+ NOTE("dissecting");
+ dp = dissect(m, m->coldp, endp, gf, gl);
+ } else {
+ if (g->nplus > 0 && m->lastpos == NULL)
+ m->lastpos = (char **)malloc((g->nplus+1) *
+ sizeof(char *));
+ if (g->nplus > 0 && m->lastpos == NULL) {
+ free(m->pmatch);
+ STATETEARDOWN(m);
+ return(REG_ESPACE);
+ }
+ NOTE("backref dissect");
+ dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
+ }
+ if (dp != NULL)
+ break;
+
+ /* uh-oh... we couldn't find a subexpression-level match */
+ assert(g->backrefs); /* must be back references doing it */
+ assert(g->nplus == 0 || m->lastpos != NULL);
+ for (;;) {
+ if (dp != NULL || endp <= m->coldp)
+ break; /* defeat */
+ NOTE("backoff");
+ endp = slow(m, m->coldp, endp-1, gf, gl);
+ if (endp == NULL)
+ break; /* defeat */
+ /* try it on a shorter possibility */
+#ifndef NDEBUG
+ for (i = 1; i <= m->g->nsub; i++) {
+ assert(m->pmatch[i].rm_so == -1);
+ assert(m->pmatch[i].rm_eo == -1);
+ }
+#endif
+ NOTE("backoff dissect");
+ dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
+ }
+ assert(dp == NULL || dp == endp);
+ if (dp != NULL) /* found a shorter one */
+ break;
+
+ /* despite initial appearances, there is no match here */
+ NOTE("false alarm");
+ start = m->coldp + 1; /* recycle starting later */
+ assert(start <= stop);
+ }
+
+ /* fill in the details if requested */
+ if (nmatch > 0) {
+ pmatch[0].rm_so = m->coldp - m->offp;
+ pmatch[0].rm_eo = endp - m->offp;
+ }
+ if (nmatch > 1) {
+ assert(m->pmatch != NULL);
+ for (i = 1; i < nmatch; i++)
+ if (i <= m->g->nsub)
+ pmatch[i] = m->pmatch[i];
+ else {
+ pmatch[i].rm_so = -1;
+ pmatch[i].rm_eo = -1;
+ }
+ }
+
+ if (m->pmatch != NULL)
+ free((char *)m->pmatch);
+ if (m->lastpos != NULL)
+ free((char *)m->lastpos);
+ STATETEARDOWN(m);
+ return(0);
+}
+
+/*
+ - dissect - figure out what matched what, no back references
+ == static char *dissect(struct match *m, char *start, \
+ == char *stop, sopno startst, sopno stopst);
+ */
+static char * /* == stop (success) always */
+dissect(m, start, stop, startst, stopst)
+struct match *m;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
+{
+ int i;
+ sopno ss; /* start sop of current subRE */
+ sopno es; /* end sop of current subRE */
+ char *sp; /* start of string matched by it */
+ char *stp; /* string matched by it cannot pass here */
+ char *rest; /* start of rest of string */
+ char *tail; /* string unmatched by rest of RE */
+ sopno ssub; /* start sop of subsubRE */
+ sopno esub; /* end sop of subsubRE */
+ char *ssp; /* start of string matched by subsubRE */
+ char *sep; /* end of string matched by subsubRE */
+ char *oldssp; /* previous ssp */
+ char *dp;
+
+ AT("diss", start, stop, startst, stopst);
+ sp = start;
+ for (ss = startst; ss < stopst; ss = es) {
+ /* identify end of subRE */
+ es = ss;
+ switch (OP(m->g->strip[es])) {
+ case OPLUS_:
+ case OQUEST_:
+ es += OPND(m->g->strip[es]);
+ break;
+ case OCH_:
+ while (OP(m->g->strip[es]) != O_CH)
+ es += OPND(m->g->strip[es]);
+ break;
+ }
+ es++;
+
+ /* figure out what it matched */
+ switch (OP(m->g->strip[ss])) {
+ case OEND:
+ assert(nope);
+ break;
+ case OCHAR:
+ sp++;
+ break;
+ case OBOL:
+ case OEOL:
+ case OBOW:
+ case OEOW:
+ break;
+ case OANY:
+ case OANYOF:
+ sp++;
+ break;
+ case OBACK_:
+ case O_BACK:
+ assert(nope);
+ break;
+ /* cases where length of match is hard to find */
+ case OQUEST_:
+ stp = stop;
+ for (;;) {
+ /* how long could this one be? */
+ rest = slow(m, sp, stp, ss, es);
+ assert(rest != NULL); /* it did match */
+ /* could the rest match the rest? */
+ tail = slow(m, rest, stop, es, stopst);
+ if (tail == stop)
+ break; /* yes! */
+ /* no -- try a shorter match for this one */
+ stp = rest - 1;
+ assert(stp >= sp); /* it did work */
+ }
+ ssub = ss + 1;
+ esub = es - 1;
+ /* did innards match? */
+ if (slow(m, sp, rest, ssub, esub) != NULL) {
+ dp = dissect(m, sp, rest, ssub, esub);
+ assert(dp == rest);
+ } else /* no */
+ assert(sp == rest);
+ sp = rest;
+ break;
+ case OPLUS_:
+ stp = stop;
+ for (;;) {
+ /* how long could this one be? */
+ rest = slow(m, sp, stp, ss, es);
+ assert(rest != NULL); /* it did match */
+ /* could the rest match the rest? */
+ tail = slow(m, rest, stop, es, stopst);
+ if (tail == stop)
+ break; /* yes! */
+ /* no -- try a shorter match for this one */
+ stp = rest - 1;
+ assert(stp >= sp); /* it did work */
+ }
+ ssub = ss + 1;
+ esub = es - 1;
+ ssp = sp;
+ oldssp = ssp;
+ for (;;) { /* find last match of innards */
+ sep = slow(m, ssp, rest, ssub, esub);
+ if (sep == NULL || sep == ssp)
+ break; /* failed or matched null */
+ oldssp = ssp; /* on to next try */
+ ssp = sep;
+ }
+ if (sep == NULL) {
+ /* last successful match */
+ sep = ssp;
+ ssp = oldssp;
+ }
+ assert(sep == rest); /* must exhaust substring */
+ assert(slow(m, ssp, sep, ssub, esub) == rest);
+ dp = dissect(m, ssp, sep, ssub, esub);
+ assert(dp == sep);
+ sp = rest;
+ break;
+ case OCH_:
+ stp = stop;
+ for (;;) {
+ /* how long could this one be? */
+ rest = slow(m, sp, stp, ss, es);
+ assert(rest != NULL); /* it did match */
+ /* could the rest match the rest? */
+ tail = slow(m, rest, stop, es, stopst);
+ if (tail == stop)
+ break; /* yes! */
+ /* no -- try a shorter match for this one */
+ stp = rest - 1;
+ assert(stp >= sp); /* it did work */
+ }
+ ssub = ss + 1;
+ esub = ss + OPND(m->g->strip[ss]) - 1;
+ assert(OP(m->g->strip[esub]) == OOR1);
+ for (;;) { /* find first matching branch */
+ if (slow(m, sp, rest, ssub, esub) == rest)
+ break; /* it matched all of it */
+ /* that one missed, try next one */
+ assert(OP(m->g->strip[esub]) == OOR1);
+ esub++;
+ assert(OP(m->g->strip[esub]) == OOR2);
+ ssub = esub + 1;
+ esub += OPND(m->g->strip[esub]);
+ if (OP(m->g->strip[esub]) == OOR2)
+ esub--;
+ else
+ assert(OP(m->g->strip[esub]) == O_CH);
+ }
+ dp = dissect(m, sp, rest, ssub, esub);
+ assert(dp == rest);
+ sp = rest;
+ break;
+ case O_PLUS:
+ case O_QUEST:
+ case OOR1:
+ case OOR2:
+ case O_CH:
+ assert(nope);
+ break;
+ case OLPAREN:
+ i = OPND(m->g->strip[ss]);
+ assert(0 < i && i <= m->g->nsub);
+ m->pmatch[i].rm_so = sp - m->offp;
+ break;
+ case ORPAREN:
+ i = OPND(m->g->strip[ss]);
+ assert(0 < i && i <= m->g->nsub);
+ m->pmatch[i].rm_eo = sp - m->offp;
+ break;
+ default: /* uh oh */
+ assert(nope);
+ break;
+ }
+ }
+
+ assert(sp == stop);
+ return(sp);
+}
+
+/*
+ - backref - figure out what matched what, figuring in back references
+ == static char *backref(struct match *m, char *start, \
+ == char *stop, sopno startst, sopno stopst, sopno lev);
+ */
+static char * /* == stop (success) or NULL (failure) */
+backref(m, start, stop, startst, stopst, lev)
+struct match *m;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
+sopno lev; /* PLUS nesting level */
+{
+ int i;
+ sopno ss; /* start sop of current subRE */
+ char *sp; /* start of string matched by it */
+ sopno ssub; /* start sop of subsubRE */
+ sopno esub; /* end sop of subsubRE */
+ char *ssp; /* start of string matched by subsubRE */
+ char *dp;
+ size_t len;
+ int hard;
+ sop s;
+ regoff_t offsave;
+ cset *cs;
+
+ AT("back", start, stop, startst, stopst);
+ sp = start;
+
+ /* get as far as we can with easy stuff */
+ hard = 0;
+ for (ss = startst; !hard && ss < stopst; ss++)
+ switch (OP(s = m->g->strip[ss])) {
+ case OCHAR:
+ if (sp == stop || *sp++ != (char)OPND(s))
+ return(NULL);
+ break;
+ case OANY:
+ if (sp == stop)
+ return(NULL);
+ sp++;
+ break;
+ case OANYOF:
+ cs = &m->g->sets[OPND(s)];
+ if (sp == stop || !CHIN(cs, *sp++))
+ return(NULL);
+ break;
+ case OBOL:
+ if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
+ (sp < m->endp && *(sp-1) == '\n' &&
+ (m->g->cflags&REG_NEWLINE)) )
+ { /* yes */ }
+ else
+ return(NULL);
+ break;
+ case OEOL:
+ if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
+ (sp < m->endp && *sp == '\n' &&
+ (m->g->cflags&REG_NEWLINE)) )
+ { /* yes */ }
+ else
+ return(NULL);
+ break;
+ case OBOW:
+ if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
+ (sp < m->endp && *(sp-1) == '\n' &&
+ (m->g->cflags&REG_NEWLINE)) ||
+ (sp > m->beginp &&
+ !ISWORD(*(sp-1))) ) &&
+ (sp < m->endp && ISWORD(*sp)) )
+ { /* yes */ }
+ else
+ return(NULL);
+ break;
+ case OEOW:
+ if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
+ (sp < m->endp && *sp == '\n' &&
+ (m->g->cflags&REG_NEWLINE)) ||
+ (sp < m->endp && !ISWORD(*sp)) ) &&
+ (sp > m->beginp && ISWORD(*(sp-1))) )
+ { /* yes */ }
+ else
+ return(NULL);
+ break;
+ case O_QUEST:
+ break;
+ case OOR1: /* matches null but needs to skip */
+ ss++;
+ s = m->g->strip[ss];
+ do {
+ assert(OP(s) == OOR2);
+ ss += OPND(s);
+ } while (OP(s = m->g->strip[ss]) != O_CH);
+ /* note that the ss++ gets us past the O_CH */
+ break;
+ default: /* have to make a choice */
+ hard = 1;
+ break;
+ }
+ if (!hard) { /* that was it! */
+ if (sp != stop)
+ return(NULL);
+ return(sp);
+ }
+ ss--; /* adjust for the for's final increment */
+
+ /* the hard stuff */
+ AT("hard", sp, stop, ss, stopst);
+ s = m->g->strip[ss];
+ switch (OP(s)) {
+ case OBACK_: /* the vilest depths */
+ i = OPND(s);
+ assert(0 < i && i <= m->g->nsub);
+ if (m->pmatch[i].rm_eo == -1)
+ return(NULL);
+ assert(m->pmatch[i].rm_so != -1);
+ len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
+ assert(stop - m->beginp >= len);
+ if (sp > stop - len)
+ return(NULL); /* not enough left to match */
+ ssp = m->offp + m->pmatch[i].rm_so;
+ if (memcmp(sp, ssp, len) != 0)
+ return(NULL);
+ while (m->g->strip[ss] != SOP(O_BACK, i))
+ ss++;
+ return(backref(m, sp+len, stop, ss+1, stopst, lev));
+ break;
+ case OQUEST_: /* to null or not */
+ dp = backref(m, sp, stop, ss+1, stopst, lev);
+ if (dp != NULL)
+ return(dp); /* not */
+ return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
+ break;
+ case OPLUS_:
+ assert(m->lastpos != NULL);
+ assert(lev+1 <= m->g->nplus);
+ m->lastpos[lev+1] = sp;
+ return(backref(m, sp, stop, ss+1, stopst, lev+1));
+ break;
+ case O_PLUS:
+ if (sp == m->lastpos[lev]) /* last pass matched null */
+ return(backref(m, sp, stop, ss+1, stopst, lev-1));
+ /* try another pass */
+ m->lastpos[lev] = sp;
+ dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
+ if (dp == NULL)
+ return(backref(m, sp, stop, ss+1, stopst, lev-1));
+ else
+ return(dp);
+ break;
+ case OCH_: /* find the right one, if any */
+ ssub = ss + 1;
+ esub = ss + OPND(s) - 1;
+ assert(OP(m->g->strip[esub]) == OOR1);
+ for (;;) { /* find first matching branch */
+ dp = backref(m, sp, stop, ssub, esub, lev);
+ if (dp != NULL)
+ return(dp);
+ /* that one missed, try next one */
+ if (OP(m->g->strip[esub]) == O_CH)
+ return(NULL); /* there is none */
+ esub++;
+ assert(OP(m->g->strip[esub]) == OOR2);
+ ssub = esub + 1;
+ esub += OPND(m->g->strip[esub]);
+ if (OP(m->g->strip[esub]) == OOR2)
+ esub--;
+ else
+ assert(OP(m->g->strip[esub]) == O_CH);
+ }
+ break;
+ case OLPAREN: /* must undo assignment if rest fails */
+ i = OPND(s);
+ assert(0 < i && i <= m->g->nsub);
+ offsave = m->pmatch[i].rm_so;
+ m->pmatch[i].rm_so = sp - m->offp;
+ dp = backref(m, sp, stop, ss+1, stopst, lev);
+ if (dp != NULL)
+ return(dp);
+ m->pmatch[i].rm_so = offsave;
+ return(NULL);
+ break;
+ case ORPAREN: /* must undo assignment if rest fails */
+ i = OPND(s);
+ assert(0 < i && i <= m->g->nsub);
+ offsave = m->pmatch[i].rm_eo;
+ m->pmatch[i].rm_eo = sp - m->offp;
+ dp = backref(m, sp, stop, ss+1, stopst, lev);
+ if (dp != NULL)
+ return(dp);
+ m->pmatch[i].rm_eo = offsave;
+ return(NULL);
+ break;
+ default: /* uh oh */
+ assert(nope);
+ break;
+ }
+
+ /* "can't happen" */
+ assert(nope);
+ /* NOTREACHED */
+ return "shut up gcc";
+}
+
+/*
+ - fast - step through the string at top speed
+ == static char *fast(struct match *m, char *start, \
+ == char *stop, sopno startst, sopno stopst);
+ */
+static char * /* where tentative match ended, or NULL */
+fast(m, start, stop, startst, stopst)
+struct match *m;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
+{
+ states st = m->st;
+ states fresh = m->fresh;
+ states tmp = m->tmp;
+ char *p = start;
+ int c = (start == m->beginp) ? OUT : *(start-1);
+ int lastc; /* previous c */
+ int flagch;
+ int i;
+ char *coldp; /* last p after which no match was underway */
+
+ CLEAR(st);
+ SET1(st, startst);
+ st = step(m->g, startst, stopst, st, NOTHING, st);
+ ASSIGN(fresh, st);
+ SP("start", st, *p);
+ coldp = NULL;
+ for (;;) {
+ /* next character */
+ lastc = c;
+ c = (p == m->endp) ? OUT : *p;
+ if (EQ(st, fresh))
+ coldp = p;
+
+ /* is there an EOL and/or BOL between lastc and c? */
+ flagch = '\0';
+ i = 0;
+ if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
+ (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
+ flagch = BOL;
+ i = m->g->nbol;
+ }
+ if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
+ (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
+ flagch = (flagch == BOL) ? BOLEOL : EOL;
+ i += m->g->neol;
+ }
+ if (i != 0) {
+ for (; i > 0; i--)
+ st = step(m->g, startst, stopst, st, flagch, st);
+ SP("boleol", st, c);
+ }
+
+ /* how about a word boundary? */
+ if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
+ (c != OUT && ISWORD(c)) ) {
+ flagch = BOW;
+ }
+ if ( (lastc != OUT && ISWORD(lastc)) &&
+ (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
+ flagch = EOW;
+ }
+ if (flagch == BOW || flagch == EOW) {
+ st = step(m->g, startst, stopst, st, flagch, st);
+ SP("boweow", st, c);
+ }
+
+ /* are we done? */
+ if (ISSET(st, stopst) || p == stop)
+ break; /* NOTE BREAK OUT */
+
+ /* no, we must deal with this character */
+ ASSIGN(tmp, st);
+ ASSIGN(st, fresh);
+ assert(c != OUT);
+ st = step(m->g, startst, stopst, tmp, c, st);
+ SP("aft", st, c);
+ assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
+ p++;
+ }
+
+ assert(coldp != NULL);
+ m->coldp = coldp;
+ if (ISSET(st, stopst))
+ return(p+1);
+ else
+ return(NULL);
+}
+
+/*
+ - slow - step through the string more deliberately
+ == static char *slow(struct match *m, char *start, \
+ == char *stop, sopno startst, sopno stopst);
+ */
+static char * /* where it ended */
+slow(m, start, stop, startst, stopst)
+struct match *m;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
+{
+ states st = m->st;
+ states empty = m->empty;
+ states tmp = m->tmp;
+ char *p = start;
+ int c = (start == m->beginp) ? OUT : *(start-1);
+ int lastc; /* previous c */
+ int flagch;
+ int i;
+ char *matchp; /* last p at which a match ended */
+
+ AT("slow", start, stop, startst, stopst);
+ CLEAR(st);
+ SET1(st, startst);
+ SP("sstart", st, *p);
+ st = step(m->g, startst, stopst, st, NOTHING, st);
+ matchp = NULL;
+ for (;;) {
+ /* next character */
+ lastc = c;
+ c = (p == m->endp) ? OUT : *p;
+
+ /* is there an EOL and/or BOL between lastc and c? */
+ flagch = '\0';
+ i = 0;
+ if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
+ (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
+ flagch = BOL;
+ i = m->g->nbol;
+ }
+ if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
+ (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
+ flagch = (flagch == BOL) ? BOLEOL : EOL;
+ i += m->g->neol;
+ }
+ if (i != 0) {
+ for (; i > 0; i--)
+ st = step(m->g, startst, stopst, st, flagch, st);
+ SP("sboleol", st, c);
+ }
+
+ /* how about a word boundary? */
+ if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
+ (c != OUT && ISWORD(c)) ) {
+ flagch = BOW;
+ }
+ if ( (lastc != OUT && ISWORD(lastc)) &&
+ (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
+ flagch = EOW;
+ }
+ if (flagch == BOW || flagch == EOW) {
+ st = step(m->g, startst, stopst, st, flagch, st);
+ SP("sboweow", st, c);
+ }
+
+ /* are we done? */
+ if (ISSET(st, stopst))
+ matchp = p;
+ if (EQ(st, empty) || p == stop)
+ break; /* NOTE BREAK OUT */
+
+ /* no, we must deal with this character */
+ ASSIGN(tmp, st);
+ ASSIGN(st, empty);
+ assert(c != OUT);
+ st = step(m->g, startst, stopst, tmp, c, st);
+ SP("saft", st, c);
+ assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
+ p++;
+ }
+
+ return(matchp);
+}
+
+
+/*
+ - step - map set of states reachable before char to set reachable after
+ == static states step(struct re_guts *g, sopno start, sopno stop, \
+ == states bef, int ch, states aft);
+ == #define BOL (OUT+1)
+ == #define EOL (BOL+1)
+ == #define BOLEOL (BOL+2)
+ == #define NOTHING (BOL+3)
+ == #define BOW (BOL+4)
+ == #define EOW (BOL+5)
+ == #define CODEMAX (BOL+5) // highest code used
+ == #define NONCHAR(c) ((c) > CHAR_MAX)
+ == #define NNONCHAR (CODEMAX-CHAR_MAX)
+ */
+static states
+step(g, start, stop, bef, ch, aft)
+struct re_guts *g;
+sopno start; /* start state within strip */
+sopno stop; /* state after stop state within strip */
+states bef; /* states reachable before */
+int ch; /* character or NONCHAR code */
+states aft; /* states already known reachable after */
+{
+ cset *cs;
+ sop s;
+ sopno pc;
+ onestate here; /* note, macros know this name */
+ sopno look;
+ int i;
+
+ for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
+ s = g->strip[pc];
+ switch (OP(s)) {
+ case OEND:
+ assert(pc == stop-1);
+ break;
+ case OCHAR:
+ /* only characters can match */
+ assert(!NONCHAR(ch) || ch != (char)OPND(s));
+ if (ch == (char)OPND(s))
+ FWD(aft, bef, 1);
+ break;
+ case OBOL:
+ if (ch == BOL || ch == BOLEOL)
+ FWD(aft, bef, 1);
+ break;
+ case OEOL:
+ if (ch == EOL || ch == BOLEOL)
+ FWD(aft, bef, 1);
+ break;
+ case OBOW:
+ if (ch == BOW)
+ FWD(aft, bef, 1);
+ break;
+ case OEOW:
+ if (ch == EOW)
+ FWD(aft, bef, 1);
+ break;
+ case OANY:
+ if (!NONCHAR(ch))
+ FWD(aft, bef, 1);
+ break;
+ case OANYOF:
+ cs = &g->sets[OPND(s)];
+ if (!NONCHAR(ch) && CHIN(cs, ch))
+ FWD(aft, bef, 1);
+ break;
+ case OBACK_: /* ignored here */
+ case O_BACK:
+ FWD(aft, aft, 1);
+ break;
+ case OPLUS_: /* forward, this is just an empty */
+ FWD(aft, aft, 1);
+ break;
+ case O_PLUS: /* both forward and back */
+ FWD(aft, aft, 1);
+ i = ISSETBACK(aft, OPND(s));
+ BACK(aft, aft, OPND(s));
+ if (!i && ISSETBACK(aft, OPND(s))) {
+ /* oho, must reconsider loop body */
+ pc -= OPND(s) + 1;
+ INIT(here, pc);
+ }
+ break;
+ case OQUEST_: /* two branches, both forward */
+ FWD(aft, aft, 1);
+ FWD(aft, aft, OPND(s));
+ break;
+ case O_QUEST: /* just an empty */
+ FWD(aft, aft, 1);
+ break;
+ case OLPAREN: /* not significant here */
+ case ORPAREN:
+ FWD(aft, aft, 1);
+ break;
+ case OCH_: /* mark the first two branches */
+ FWD(aft, aft, 1);
+ assert(OP(g->strip[pc+OPND(s)]) == OOR2);
+ FWD(aft, aft, OPND(s));
+ break;
+ case OOR1: /* done a branch, find the O_CH */
+ if (ISSTATEIN(aft, here)) {
+ for (look = 1;
+ OP(s = g->strip[pc+look]) != O_CH;
+ look += OPND(s))
+ assert(OP(s) == OOR2);
+ FWD(aft, aft, look);
+ }
+ break;
+ case OOR2: /* propagate OCH_'s marking */
+ FWD(aft, aft, 1);
+ if (OP(g->strip[pc+OPND(s)]) != O_CH) {
+ assert(OP(g->strip[pc+OPND(s)]) == OOR2);
+ FWD(aft, aft, OPND(s));
+ }
+ break;
+ case O_CH: /* just empty */
+ FWD(aft, aft, 1);
+ break;
+ default: /* ooooops... */
+ assert(nope);
+ break;
+ }
+ }
+
+ return(aft);
+}
+
+#ifdef REDEBUG
+/*
+ - print - print a set of states
+ == #ifdef REDEBUG
+ == static void print(struct match *m, char *caption, states st, \
+ == int ch, FILE *d);
+ == #endif
+ */
+static void
+print(m, caption, st, ch, d)
+struct match *m;
+char *caption;
+states st;
+int ch;
+FILE *d;
+{
+ struct re_guts *g = m->g;
+ int i;
+ int first = 1;
+
+ if (!(m->eflags&REG_TRACE))
+ return;
+
+ fprintf(d, "%s", caption);
+ if (ch != '\0')
+ fprintf(d, " %s", pchar(ch));
+ for (i = 0; i < g->nstates; i++)
+ if (ISSET(st, i)) {
+ fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
+ first = 0;
+ }
+ fprintf(d, "\n");
+}
+
+/*
+ - at - print current situation
+ == #ifdef REDEBUG
+ == static void at(struct match *m, char *title, char *start, char *stop, \
+ == sopno startst, sopno stopst);
+ == #endif
+ */
+static void
+at(m, title, start, stop, startst, stopst)
+struct match *m;
+char *title;
+char *start;
+char *stop;
+sopno startst;
+sopno stopst;
+{
+ if (!(m->eflags&REG_TRACE))
+ return;
+
+ printf("%s %s-", title, pchar(*start));
+ printf("%s ", pchar(*stop));
+ printf("%ld-%ld\n", (long)startst, (long)stopst);
+}
+
+#ifndef PCHARDONE
+#define PCHARDONE /* never again */
+/*
+ - pchar - make a character printable
+ == #ifdef REDEBUG
+ == static char *pchar(int ch);
+ == #endif
+ *
+ * Is this identical to regchar() over in debug.c? Well, yes. But a
+ * duplicate here avoids having a debugging-capable regexec.o tied to
+ * a matching debug.o, and this is convenient. It all disappears in
+ * the non-debug compilation anyway, so it doesn't matter much.
+ */
+static char * /* -> representation */
+pchar(ch)
+int ch;
+{
+ static char pbuf[10];
+
+ if (isprint((uch)ch) || ch == ' ')
+ sprintf(pbuf, "%c", ch);
+ else
+ sprintf(pbuf, "\\%o", ch);
+ return(pbuf);
+}
+#endif
+#endif
+
+#undef matcher
+#undef fast
+#undef slow
+#undef dissect
+#undef backref
+#undef step
+#undef print
+#undef at
+#undef match
diff --git a/newlib/libc/sys/linux/stdlib/fnmatch.3 b/newlib/libc/sys/linux/stdlib/fnmatch.3
new file mode 100644
index 000000000..9c3fda5f9
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/fnmatch.3
@@ -0,0 +1,151 @@
+.\" Copyright (c) 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Guido van Rossum.
+.\" 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.
+.\"
+.\" @(#)fnmatch.3 8.3 (Berkeley) 4/28/95
+.\" $FreeBSD: src/lib/libc/gen/fnmatch.3,v 1.12 2001/10/01 16:08:50 ru Exp $
+.\"
+.Dd April 28, 1995
+.Dt FNMATCH 3
+.Os
+.Sh NAME
+.Nm fnmatch
+.Nd match filename or pathname
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In fnmatch.h
+.Ft int
+.Fn fnmatch "const char *pattern" "const char *string" "int flags"
+.Sh DESCRIPTION
+The
+.Fn fnmatch
+function
+matches patterns according to the rules used by the shell.
+It checks the string specified by the
+.Fa string
+argument to see if it matches the pattern specified by the
+.Fa pattern
+argument.
+.Pp
+The
+.Fa flags
+argument modifies the interpretation of
+.Fa pattern
+and
+.Fa string .
+The value of
+.Fa flags
+is the bitwise inclusive
+.Tn OR
+of any of the following
+constants, which are defined in the include file
+.Pa fnmatch.h .
+.Bl -tag -width FNM_PATHNAME
+.It Dv FNM_NOESCAPE
+Normally, every occurrence of a backslash
+.Pq Ql \e
+followed by a character in
+.Fa pattern
+is replaced by that character.
+This is done to negate any special meaning for the character.
+If the
+.Dv FNM_NOESCAPE
+flag is set, a backslash character is treated as an ordinary character.
+.It Dv FNM_PATHNAME
+Slash characters in
+.Fa string
+must be explicitly matched by slashes in
+.Fa pattern .
+If this flag is not set, then slashes are treated as regular characters.
+.It Dv FNM_PERIOD
+Leading periods in
+.Fa string
+must be explicitly matched by periods in
+.Fa pattern .
+If this flag is not set, then leading periods are treated as regular
+characters.
+The definition of
+.Dq leading
+is related to the specification of
+.Dv FNM_PATHNAME .
+A period is always
+.Dq leading
+if it is the first character in
+.Ar string .
+Additionally, if
+.Dv FNM_PATHNAME
+is set,
+a period is
+leading
+if it immediately follows a slash.
+.It Dv FNM_LEADING_DIR
+Ignore
+.Nm /*
+rest after successful
+.Fa pattern
+matching.
+.It Dv FNM_CASEFOLD
+Ignore case distinctions in both the
+.Fa pattern
+and the
+.Fa string .
+.El
+.Sh RETURN VALUES
+The
+.Fn fnmatch
+function returns zero if
+.Fa string
+matches the pattern specified by
+.Fa pattern ,
+otherwise, it returns the value
+.Dv FNM_NOMATCH .
+.Sh SEE ALSO
+.Xr sh 1 ,
+.Xr glob 3 ,
+.Xr regex 3
+.Sh STANDARDS
+The
+.Fn fnmatch
+function conforms to
+.St -p1003.2 .
+.Sh HISTORY
+The
+.Fn fnmatch
+function first appeared in
+.Bx 4.4 .
+.Sh BUGS
+The pattern
+.Ql *
+matches the empty string, even if
+.Dv FNM_PATHNAME
+is specified.
diff --git a/newlib/libc/sys/linux/stdlib/fnmatch.c b/newlib/libc/sys/linux/stdlib/fnmatch.c
new file mode 100644
index 000000000..4f86e8fbc
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/fnmatch.c
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+
+/*
+ * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
+ * Compares a filename or pathname to a pattern.
+ */
+
+#include <ctype.h>
+#include <fnmatch.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "collate.h"
+
+#define EOS '\0'
+
+#define RANGE_MATCH 1
+#define RANGE_NOMATCH 0
+#define RANGE_ERROR (-1)
+
+static int rangematch(const char *, char, int, char **);
+
+int
+fnmatch(pattern, string, flags)
+ const char *pattern, *string;
+ int flags;
+{
+ const char *stringstart;
+ char *newp;
+ char c, test;
+
+ for (stringstart = string;;)
+ switch (c = *pattern++) {
+ case EOS:
+ if ((flags & FNM_LEADING_DIR) && *string == '/')
+ return (0);
+ return (*string == EOS ? 0 : FNM_NOMATCH);
+ case '?':
+ if (*string == EOS)
+ return (FNM_NOMATCH);
+ if (*string == '/' && (flags & FNM_PATHNAME))
+ return (FNM_NOMATCH);
+ if (*string == '.' && (flags & FNM_PERIOD) &&
+ (string == stringstart ||
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
+ return (FNM_NOMATCH);
+ ++string;
+ break;
+ case '*':
+ c = *pattern;
+ /* Collapse multiple stars. */
+ while (c == '*')
+ c = *++pattern;
+
+ if (*string == '.' && (flags & FNM_PERIOD) &&
+ (string == stringstart ||
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
+ return (FNM_NOMATCH);
+
+ /* Optimize for pattern with * at end or before /. */
+ if (c == EOS)
+ if (flags & FNM_PATHNAME)
+ return ((flags & FNM_LEADING_DIR) ||
+ strchr(string, '/') == NULL ?
+ 0 : FNM_NOMATCH);
+ else
+ return (0);
+ else if (c == '/' && flags & FNM_PATHNAME) {
+ if ((string = strchr(string, '/')) == NULL)
+ return (FNM_NOMATCH);
+ break;
+ }
+
+ /* General case, use recursion. */
+ while ((test = *string) != EOS) {
+ if (!fnmatch(pattern, string, flags & ~FNM_PERIOD))
+ return (0);
+ if (test == '/' && flags & FNM_PATHNAME)
+ break;
+ ++string;
+ }
+ return (FNM_NOMATCH);
+ case '[':
+ if (*string == EOS)
+ return (FNM_NOMATCH);
+ if (*string == '/' && (flags & FNM_PATHNAME))
+ return (FNM_NOMATCH);
+ if (*string == '.' && (flags & FNM_PERIOD) &&
+ (string == stringstart ||
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
+ return (FNM_NOMATCH);
+
+ switch (rangematch(pattern, *string, flags, &newp)) {
+ case RANGE_ERROR:
+ goto norm;
+ case RANGE_MATCH:
+ pattern = newp;
+ break;
+ case RANGE_NOMATCH:
+ return (FNM_NOMATCH);
+ }
+ ++string;
+ break;
+ case '\\':
+ if (!(flags & FNM_NOESCAPE)) {
+ if ((c = *pattern++) == EOS) {
+ c = '\\';
+ --pattern;
+ }
+ }
+ /* FALLTHROUGH */
+ default:
+ norm:
+ if (c == *string)
+ ;
+ else if ((flags & FNM_CASEFOLD) &&
+ (tolower((unsigned char)c) ==
+ tolower((unsigned char)*string)))
+ ;
+ else
+ return (FNM_NOMATCH);
+ string++;
+ break;
+ }
+ /* NOTREACHED */
+}
+
+static int
+rangematch(pattern, test, flags, newp)
+ const char *pattern;
+ char test;
+ int flags;
+ char **newp;
+{
+ int negate, ok;
+ char c, c2;
+
+ /*
+ * A bracket expression starting with an unquoted circumflex
+ * character produces unspecified results (IEEE 1003.2-1992,
+ * 3.13.2). This implementation treats it like '!', for
+ * consistency with the regular expression syntax.
+ * J.T. Conklin (conklin@ngai.kaleida.com)
+ */
+ if ( (negate = (*pattern == '!' || *pattern == '^')) )
+ ++pattern;
+
+ if (flags & FNM_CASEFOLD)
+ test = tolower((unsigned char)test);
+
+ /*
+ * A right bracket shall lose its special meaning and represent
+ * itself in a bracket expression if it occurs first in the list.
+ * -- POSIX.2 2.8.3.2
+ */
+ ok = 0;
+ c = *pattern++;
+ do {
+ if (c == '\\' && !(flags & FNM_NOESCAPE))
+ c = *pattern++;
+ if (c == EOS)
+ return (RANGE_ERROR);
+
+ if (c == '/' && (flags & FNM_PATHNAME))
+ return (RANGE_NOMATCH);
+
+ if (flags & FNM_CASEFOLD)
+ c = tolower((unsigned char)c);
+
+ if (*pattern == '-'
+ && (c2 = *(pattern+1)) != EOS && c2 != ']') {
+ pattern += 2;
+ if (c2 == '\\' && !(flags & FNM_NOESCAPE))
+ c2 = *pattern++;
+ if (c2 == EOS)
+ return (RANGE_ERROR);
+
+ if (flags & FNM_CASEFOLD)
+ c2 = tolower((unsigned char)c2);
+
+ if (__collate_load_error ?
+ c <= test && test <= c2 :
+ __collate_range_cmp(c, test) <= 0
+ && __collate_range_cmp(test, c2) <= 0
+ )
+ ok = 1;
+ } else if (c == test)
+ ok = 1;
+ } while ((c = *pattern++) != ']');
+
+ *newp = (char *)pattern;
+ return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
+}
diff --git a/newlib/libc/sys/linux/stdlib/glob.3 b/newlib/libc/sys/linux/stdlib/glob.3
new file mode 100644
index 000000000..aa509a363
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/glob.3
@@ -0,0 +1,466 @@
+.\" Copyright (c) 1989, 1991, 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Guido van Rossum.
+.\" 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.
+.\"
+.\" @(#)glob.3 8.3 (Berkeley) 4/16/94
+.\" $FreeBSD: src/lib/libc/gen/glob.3,v 1.20 2001/10/01 16:08:51 ru Exp $
+.\"
+.Dd April 16, 1994
+.Dt GLOB 3
+.Os
+.Sh NAME
+.Nm glob ,
+.Nm globfree
+.Nd generate pathnames matching a pattern
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In glob.h
+.Ft int
+.Fn glob "const char *pattern" "int flags" "int (*errfunc)(const char *, int)" "glob_t *pglob"
+.Ft void
+.Fn globfree "glob_t *pglob"
+.Sh DESCRIPTION
+The
+.Fn glob
+function
+is a pathname generator that implements the rules for file name pattern
+matching used by the shell.
+.Pp
+The include file
+.Pa glob.h
+defines the structure type
+.Fa glob_t ,
+which contains at least the following fields:
+.Bd -literal
+typedef struct {
+ int gl_pathc; /* count of total paths so far */
+ int gl_matchc; /* count of paths matching pattern */
+ int gl_offs; /* reserved at beginning of gl_pathv */
+ int gl_flags; /* returned flags */
+ char **gl_pathv; /* list of paths matching pattern */
+} glob_t;
+.Ed
+.Pp
+The argument
+.Fa pattern
+is a pointer to a pathname pattern to be expanded.
+The
+.Fn glob
+argument
+matches all accessible pathnames against the pattern and creates
+a list of the pathnames that match.
+In order to have access to a pathname,
+.Fn glob
+requires search permission on every component of a path except the last
+and read permission on each directory of any filename component of
+.Fa pattern
+that contains any of the special characters
+.Ql * ,
+.Ql ?\&
+or
+.Ql \&[ .
+.Pp
+The
+.Fn glob
+argument
+stores the number of matched pathnames into the
+.Fa gl_pathc
+field, and a pointer to a list of pointers to pathnames into the
+.Fa gl_pathv
+field.
+The first pointer after the last pathname is
+.Dv NULL .
+If the pattern does not match any pathnames, the returned number of
+matched paths is set to zero.
+.Pp
+It is the caller's responsibility to create the structure pointed to by
+.Fa pglob .
+The
+.Fn glob
+function allocates other space as needed, including the memory pointed
+to by
+.Fa gl_pathv .
+.Pp
+The argument
+.Fa flags
+is used to modify the behavior of
+.Fn glob .
+The value of
+.Fa flags
+is the bitwise inclusive
+.Tn OR
+of any of the following
+values defined in
+.Pa glob.h :
+.Bl -tag -width GLOB_ALTDIRFUNC
+.It Dv GLOB_APPEND
+Append pathnames generated to the ones from a previous call (or calls)
+to
+.Fn glob .
+The value of
+.Fa gl_pathc
+will be the total matches found by this call and the previous call(s).
+The pathnames are appended to, not merged with the pathnames returned by
+the previous call(s).
+Between calls, the caller must not change the setting of the
+.Dv GLOB_DOOFFS
+flag, nor change the value of
+.Fa gl_offs
+when
+.Dv GLOB_DOOFFS
+is set, nor (obviously) call
+.Fn globfree
+for
+.Fa pglob .
+.It Dv GLOB_DOOFFS
+Make use of the
+.Fa gl_offs
+field.
+If this flag is set,
+.Fa gl_offs
+is used to specify how many
+.Dv NULL
+pointers to prepend to the beginning
+of the
+.Fa gl_pathv
+field.
+In other words,
+.Fa gl_pathv
+will point to
+.Fa gl_offs
+.Dv NULL
+pointers,
+followed by
+.Fa gl_pathc
+pathname pointers, followed by a
+.Dv NULL
+pointer.
+.It Dv GLOB_ERR
+Causes
+.Fn glob
+to return when it encounters a directory that it cannot open or read.
+Ordinarily,
+.Fn glob
+continues to find matches.
+.It Dv GLOB_MARK
+Each pathname that is a directory that matches
+.Fa pattern
+has a slash
+appended.
+.It Dv GLOB_NOCHECK
+If
+.Fa pattern
+does not match any pathname, then
+.Fn glob
+returns a list
+consisting of only
+.Fa pattern ,
+with the number of total pathnames is set to 1, and the number of matched
+pathnames set to 0.
+If
+.Dv GLOB_QUOTE
+is set, its effect is present in the pattern returned.
+.It Dv GLOB_NOSORT
+By default, the pathnames are sorted in ascending
+.Tn ASCII
+order;
+this flag prevents that sorting (speeding up
+.Fn glob ) .
+.El
+.Pp
+The following values may also be included in
+.Fa flags ,
+however, they are non-standard extensions to
+.St -p1003.2 .
+.Bl -tag -width GLOB_ALTDIRFUNC
+.It Dv GLOB_ALTDIRFUNC
+The following additional fields in the pglob structure have been
+initialized with alternate functions for glob to use to open, read,
+and close directories and to get stat information on names found
+in those directories.
+.Bd -literal
+void *(*gl_opendir)(const char * name);
+struct dirent *(*gl_readdir)(void *);
+void (*gl_closedir)(void *);
+int (*gl_lstat)(const char *name, struct stat *st);
+int (*gl_stat)(const char *name, struct stat *st);
+.Ed
+.Pp
+This extension is provided to allow programs such as
+.Xr restore 8
+to provide globbing from directories stored on tape.
+.It Dv GLOB_BRACE
+Pre-process the pattern string to expand
+.Ql {pat,pat,...}
+strings like
+.Xr csh 1 .
+The pattern
+.Ql {}
+is left unexpanded for historical reasons (and
+.Xr csh 1
+does the same thing to
+ease typing
+of
+.Xr find 1
+patterns).
+.It Dv GLOB_MAGCHAR
+Set by the
+.Fn glob
+function if the pattern included globbing characters.
+See the description of the usage of the
+.Fa gl_matchc
+structure member for more details.
+.It Dv GLOB_NOMAGIC
+Is the same as
+.Dv GLOB_NOCHECK
+but it only appends the
+.Fa pattern
+if it does not contain any of the special characters ``*'', ``?'' or ``[''.
+.Dv GLOB_NOMAGIC
+is provided to simplify implementing the historic
+.Xr csh 1
+globbing behavior and should probably not be used anywhere else.
+.It Dv GLOB_QUOTE
+Use the backslash
+.Pq Ql \e
+character for quoting: every occurrence of
+a backslash followed by a character in the pattern is replaced by that
+character, avoiding any special interpretation of the character.
+.It Dv GLOB_TILDE
+Expand patterns that start with
+.Ql ~
+to user name home directories.
+.It Dv GLOB_LIMIT
+Limit the total number of returned pathnames to the value provided in
+.Fa gl_matchc
+(default
+.Dv ARG_MAX ) .
+This option should be set for programs
+that can be coerced into a denial of service attack
+via patterns that expand to a very large number of matches,
+such as a long string of
+.Ql */../*/.. .
+.El
+.Pp
+If, during the search, a directory is encountered that cannot be opened
+or read and
+.Fa errfunc
+is
+.Pf non- Dv NULL ,
+.Fn glob
+calls
+.Fa \*(lp*errfunc\*(rp Ns ( Fa path , errno ) .
+This may be unintuitive: a pattern like
+.Ql */Makefile
+will try to
+.Xr stat 2
+.Ql foo/Makefile
+even if
+.Ql foo
+is not a directory, resulting in a
+call to
+.Fa errfunc .
+The error routine can suppress this action by testing for
+.Er ENOENT
+and
+.Er ENOTDIR ;
+however, the
+.Dv GLOB_ERR
+flag will still cause an immediate
+return when this happens.
+.Pp
+If
+.Fa errfunc
+returns non-zero,
+.Fn glob
+stops the scan and returns
+.Dv GLOB_ABEND
+after setting
+.Fa gl_pathc
+and
+.Fa gl_pathv
+to reflect any paths already matched.
+This also happens if an error is encountered and
+.Dv GLOB_ERR
+is set in
+.Fa flags ,
+regardless of the return value of
+.Fa errfunc ,
+if called.
+If
+.Dv GLOB_ERR
+is not set and either
+.Fa errfunc
+is
+.Dv NULL
+or
+.Fa errfunc
+returns zero, the error is ignored.
+.Pp
+The
+.Fn globfree
+function frees any space associated with
+.Fa pglob
+from a previous call(s) to
+.Fn glob .
+.Sh RETURN VALUES
+On successful completion,
+.Fn glob
+returns zero.
+In addition the fields of
+.Fa pglob
+contain the values described below:
+.Bl -tag -width GLOB_NOCHECK
+.It Fa gl_pathc
+contains the total number of matched pathnames so far.
+This includes other matches from previous invocations of
+.Fn glob
+if
+.Dv GLOB_APPEND
+was specified.
+.It Fa gl_matchc
+contains the number of matched pathnames in the current invocation of
+.Fn glob .
+.It Fa gl_flags
+contains a copy of the
+.Fa flags
+parameter with the bit
+.Dv GLOB_MAGCHAR
+set if
+.Fa pattern
+contained any of the special characters ``*'', ``?'' or ``['', cleared
+if not.
+.It Fa gl_pathv
+contains a pointer to a
+.Dv NULL Ns -terminated
+list of matched pathnames.
+However, if
+.Fa gl_pathc
+is zero, the contents of
+.Fa gl_pathv
+are undefined.
+.El
+.Pp
+If
+.Fn glob
+terminates due to an error, it sets errno and returns one of the
+following non-zero constants, which are defined in the include
+file
+.Aq Pa glob.h :
+.Bl -tag -width GLOB_NOCHECK
+.It Dv GLOB_NOSPACE
+An attempt to allocate memory failed, or if
+.Fa errno
+was 0
+.Dv GLOB_LIMIT
+was specified in the flags and
+.Fa pglob\->gl_matchc
+or more patterns were matched.
+.It Dv GLOB_ABEND
+The scan was stopped because an error was encountered and either
+.Dv GLOB_ERR
+was set or
+.Fa \*(lp*errfunc\*(rp\*(lp\*(rp
+returned non-zero.
+.El
+.Pp
+The arguments
+.Fa pglob\->gl_pathc
+and
+.Fa pglob\->gl_pathv
+are still set as specified above.
+.Sh EXAMPLES
+A rough equivalent of
+.Ql "ls -l *.c *.h"
+can be obtained with the
+following code:
+.Bd -literal -offset indent
+glob_t g;
+
+g.gl_offs = 2;
+glob("*.c", GLOB_DOOFFS, NULL, &g);
+glob("*.h", GLOB_DOOFFS | GLOB_APPEND, NULL, &g);
+g.gl_pathv[0] = "ls";
+g.gl_pathv[1] = "-l";
+execvp("ls", g.gl_pathv);
+.Ed
+.Sh SEE ALSO
+.Xr sh 1 ,
+.Xr fnmatch 3 ,
+.Xr regexp 3
+.Sh STANDARDS
+The
+.Fn glob
+function is expected to be
+.St -p1003.2
+compatible with the exception
+that the flags
+.Dv GLOB_ALTDIRFUNC ,
+.Dv GLOB_BRACE ,
+.Dv GLOB_LIMIT ,
+.Dv GLOB_MAGCHAR ,
+.Dv GLOB_NOMAGIC ,
+.Dv GLOB_QUOTE ,
+and
+.Dv GLOB_TILDE ,
+and the fields
+.Fa gl_matchc
+and
+.Fa gl_flags
+should not be used by applications striving for strict
+.Tn POSIX
+conformance.
+.Sh HISTORY
+The
+.Fn glob
+and
+.Fn globfree
+functions first appeared in
+.Bx 4.4 .
+.Sh BUGS
+Patterns longer than
+.Dv MAXPATHLEN
+may cause unchecked errors.
+.Pp
+The
+.Fn glob
+argument
+may fail and set errno for any of the errors specified for the
+library routines
+.Xr stat 2 ,
+.Xr closedir 3 ,
+.Xr opendir 3 ,
+.Xr readdir 3 ,
+.Xr malloc 3 ,
+and
+.Xr free 3 .
diff --git a/newlib/libc/sys/linux/stdlib/glob.c b/newlib/libc/sys/linux/stdlib/glob.c
new file mode 100644
index 000000000..5335c1b54
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/glob.c
@@ -0,0 +1,909 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+
+/*
+ * glob(3) -- a superset of the one defined in POSIX 1003.2.
+ *
+ * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
+ *
+ * Optional extra services, controlled by flags not defined by POSIX:
+ *
+ * GLOB_QUOTE:
+ * Escaping convention: \ inhibits any special meaning the following
+ * character might have (except \ at end of string is retained).
+ * GLOB_MAGCHAR:
+ * Set in gl_flags if pattern contained a globbing character.
+ * GLOB_NOMAGIC:
+ * Same as GLOB_NOCHECK, but it will only append pattern if it did
+ * not contain any magic characters. [Used in csh style globbing]
+ * GLOB_ALTDIRFUNC:
+ * Use alternately specified directory access functions.
+ * GLOB_TILDE:
+ * expand ~user/foo to the /home/dir/of/user/foo
+ * GLOB_BRACE:
+ * expand {1,2}{a,b} to 1a 1b 2a 2b
+ * gl_matchc:
+ * Number of matches in the current invocation of glob.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <glob.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "collate.h"
+
+#define DOLLAR '$'
+#define DOT '.'
+#define EOS '\0'
+#define LBRACKET '['
+#define NOT '!'
+#define QUESTION '?'
+#define QUOTE '\\'
+#define RANGE '-'
+#define RBRACKET ']'
+#define SEP '/'
+#define STAR '*'
+#define TILDE '~'
+#define UNDERSCORE '_'
+#define LBRACE '{'
+#define RBRACE '}'
+#define SLASH '/'
+#define COMMA ','
+
+#ifndef DEBUG
+
+#define M_QUOTE 0x8000
+#define M_PROTECT 0x4000
+#define M_MASK 0xffff
+#define M_ASCII 0x00ff
+
+typedef u_short Char;
+
+#else
+
+#define M_QUOTE 0x80
+#define M_PROTECT 0x40
+#define M_MASK 0xff
+#define M_ASCII 0x7f
+
+typedef char Char;
+
+#endif
+
+
+#define CHAR(c) ((Char)((c)&M_ASCII))
+#define META(c) ((Char)((c)|M_QUOTE))
+#define M_ALL META('*')
+#define M_END META(']')
+#define M_NOT META('!')
+#define M_ONE META('?')
+#define M_RNG META('-')
+#define M_SET META('[')
+#define ismeta(c) (((c)&M_QUOTE) != 0)
+
+
+static int compare(const void *, const void *);
+static int g_Ctoc(const Char *, char *, u_int);
+static int g_lstat(Char *, struct stat *, glob_t *);
+static DIR *g_opendir(Char *, glob_t *);
+static Char *g_strchr(Char *, int);
+#ifdef notdef
+static Char *g_strcat(Char *, const Char *);
+#endif
+static int g_stat(Char *, struct stat *, glob_t *);
+static int glob0(const Char *, glob_t *, int *);
+static int glob1(Char *, glob_t *, int *);
+static int glob2(Char *, Char *, Char *, Char *, glob_t *, int *);
+static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, int *);
+static int globextend(const Char *, glob_t *, int *);
+static const Char *
+ globtilde(const Char *, Char *, size_t, glob_t *);
+static int globexp1(const Char *, glob_t *, int *);
+static int globexp2(const Char *, const Char *, glob_t *, int *, int *);
+static int match(Char *, Char *, Char *);
+#ifdef DEBUG
+static void qprintf(const char *, Char *);
+#endif
+
+int
+glob(pattern, flags, errfunc, pglob)
+ const char *pattern;
+ int flags, (*errfunc)(const char *, int);
+ glob_t *pglob;
+{
+ const u_char *patnext;
+ int c, limit;
+ Char *bufnext, *bufend, patbuf[MAXPATHLEN];
+
+ patnext = (u_char *) pattern;
+ if (!(flags & GLOB_APPEND)) {
+ pglob->gl_pathc = 0;
+ pglob->gl_pathv = NULL;
+ if (!(flags & GLOB_DOOFFS))
+ pglob->gl_offs = 0;
+ }
+ if (flags & GLOB_LIMIT) {
+ limit = pglob->gl_matchc;
+ if (limit == 0)
+ limit = ARG_MAX;
+ } else
+ limit = 0;
+ pglob->gl_flags = flags & ~GLOB_MAGCHAR;
+ pglob->gl_errfunc = errfunc;
+ pglob->gl_matchc = 0;
+
+ bufnext = patbuf;
+ bufend = bufnext + MAXPATHLEN - 1;
+ if (flags & GLOB_QUOTE) {
+ /* Protect the quoted characters. */
+ while (bufnext < bufend && (c = *patnext++) != EOS)
+ if (c == QUOTE) {
+ if ((c = *patnext++) == EOS) {
+ c = QUOTE;
+ --patnext;
+ }
+ *bufnext++ = c | M_PROTECT;
+ }
+ else
+ *bufnext++ = c;
+ }
+ else
+ while (bufnext < bufend && (c = *patnext++) != EOS)
+ *bufnext++ = c;
+ *bufnext = EOS;
+
+ if (flags & GLOB_BRACE)
+ return globexp1(patbuf, pglob, &limit);
+ else
+ return glob0(patbuf, pglob, &limit);
+}
+
+/*
+ * Expand recursively a glob {} pattern. When there is no more expansion
+ * invoke the standard globbing routine to glob the rest of the magic
+ * characters
+ */
+static int
+globexp1(pattern, pglob, limit)
+ const Char *pattern;
+ glob_t *pglob;
+ int *limit;
+{
+ const Char* ptr = pattern;
+ int rv;
+
+ /* Protect a single {}, for find(1), like csh */
+ if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
+ return glob0(pattern, pglob, limit);
+
+ while ((ptr = (const Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
+ if (!globexp2(ptr, pattern, pglob, &rv, limit))
+ return rv;
+
+ return glob0(pattern, pglob, limit);
+}
+
+
+/*
+ * Recursive brace globbing helper. Tries to expand a single brace.
+ * If it succeeds then it invokes globexp1 with the new pattern.
+ * If it fails then it tries to glob the rest of the pattern and returns.
+ */
+static int
+globexp2(ptr, pattern, pglob, rv, limit)
+ const Char *ptr, *pattern;
+ glob_t *pglob;
+ int *rv, *limit;
+{
+ int i;
+ Char *lm, *ls;
+ const Char *pe, *pm, *pl;
+ Char patbuf[MAXPATHLEN];
+
+ /* copy part up to the brace */
+ for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
+ continue;
+ *lm = EOS;
+ ls = lm;
+
+ /* Find the balanced brace */
+ for (i = 0, pe = ++ptr; *pe; pe++)
+ if (*pe == LBRACKET) {
+ /* Ignore everything between [] */
+ for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
+ continue;
+ if (*pe == EOS) {
+ /*
+ * We could not find a matching RBRACKET.
+ * Ignore and just look for RBRACE
+ */
+ pe = pm;
+ }
+ }
+ else if (*pe == LBRACE)
+ i++;
+ else if (*pe == RBRACE) {
+ if (i == 0)
+ break;
+ i--;
+ }
+
+ /* Non matching braces; just glob the pattern */
+ if (i != 0 || *pe == EOS) {
+ *rv = glob0(patbuf, pglob, limit);
+ return 0;
+ }
+
+ for (i = 0, pl = pm = ptr; pm <= pe; pm++)
+ switch (*pm) {
+ case LBRACKET:
+ /* Ignore everything between [] */
+ for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++)
+ continue;
+ if (*pm == EOS) {
+ /*
+ * We could not find a matching RBRACKET.
+ * Ignore and just look for RBRACE
+ */
+ pm = pl;
+ }
+ break;
+
+ case LBRACE:
+ i++;
+ break;
+
+ case RBRACE:
+ if (i) {
+ i--;
+ break;
+ }
+ /* FALLTHROUGH */
+ case COMMA:
+ if (i && *pm == COMMA)
+ break;
+ else {
+ /* Append the current string */
+ for (lm = ls; (pl < pm); *lm++ = *pl++)
+ continue;
+ /*
+ * Append the rest of the pattern after the
+ * closing brace
+ */
+ for (pl = pe + 1; (*lm++ = *pl++) != EOS;)
+ continue;
+
+ /* Expand the current pattern */
+#ifdef DEBUG
+ qprintf("globexp2:", patbuf);
+#endif
+ *rv = globexp1(patbuf, pglob, limit);
+
+ /* move after the comma, to the next string */
+ pl = pm + 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+ *rv = 0;
+ return 0;
+}
+
+
+
+/*
+ * expand tilde from the passwd file.
+ */
+static const Char *
+globtilde(pattern, patbuf, patbuf_len, pglob)
+ const Char *pattern;
+ Char *patbuf;
+ size_t patbuf_len;
+ glob_t *pglob;
+{
+ struct passwd *pwd;
+ char *h;
+ const Char *p;
+ Char *b, *eb;
+
+ if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
+ return pattern;
+
+ /*
+ * Copy up to the end of the string or /
+ */
+ eb = &patbuf[patbuf_len - 1];
+ for (p = pattern + 1, h = (char *) patbuf;
+ h < (char *)eb && *p && *p != SLASH; *h++ = *p++)
+ continue;
+
+ *h = EOS;
+
+ if (((char *) patbuf)[0] == EOS) {
+ /*
+ * handle a plain ~ or ~/ by expanding $HOME first (iff
+ * we're not running setuid or setgid) and then trying
+ * the password file
+ */
+ if (
+#ifndef __NETBSD_SYSCALLS
+ issetugid() != 0 ||
+#endif
+ (h = getenv("HOME")) == NULL) {
+/* If we are not EL/IX level 4, we cannot use getpwxxx interfaces */
+#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4
+ if (((h = getlogin()) != NULL &&
+ (pwd = getpwnam(h)) != NULL) ||
+ (pwd = getpwuid(getuid())) != NULL)
+ h = pwd->pw_dir;
+ else
+#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 4 */
+ return pattern;
+ }
+ }
+ else {
+ /*
+ * Expand a ~user
+ */
+
+#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4
+ if ((pwd = getpwnam((char*) patbuf)) != NULL)
+ h = pwd->pw_dir;
+ else
+#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 4 */
+ return pattern;
+ }
+
+ /* Copy the home directory */
+ for (b = patbuf; b < eb && *h; *b++ = *h++)
+ continue;
+
+ /* Append the rest of the pattern */
+ while (b < eb && (*b++ = *p++) != EOS)
+ continue;
+ *b = EOS;
+
+ return patbuf;
+}
+
+
+/*
+ * The main glob() routine: compiles the pattern (optionally processing
+ * quotes), calls glob1() to do the real pattern matching, and finally
+ * sorts the list (unless unsorted operation is requested). Returns 0
+ * if things went well, nonzero if errors occurred. It is not an error
+ * to find no matches.
+ */
+static int
+glob0(pattern, pglob, limit)
+ const Char *pattern;
+ glob_t *pglob;
+ int *limit;
+{
+ const Char *qpatnext;
+ int c, err, oldpathc;
+ Char *bufnext, patbuf[MAXPATHLEN];
+
+ qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob);
+ oldpathc = pglob->gl_pathc;
+ bufnext = patbuf;
+
+ /* We don't need to check for buffer overflow any more. */
+ while ((c = *qpatnext++) != EOS) {
+ switch (c) {
+ case LBRACKET:
+ c = *qpatnext;
+ if (c == NOT)
+ ++qpatnext;
+ if (*qpatnext == EOS ||
+ g_strchr((Char *) qpatnext+1, RBRACKET) == NULL) {
+ *bufnext++ = LBRACKET;
+ if (c == NOT)
+ --qpatnext;
+ break;
+ }
+ *bufnext++ = M_SET;
+ if (c == NOT)
+ *bufnext++ = M_NOT;
+ c = *qpatnext++;
+ do {
+ *bufnext++ = CHAR(c);
+ if (*qpatnext == RANGE &&
+ (c = qpatnext[1]) != RBRACKET) {
+ *bufnext++ = M_RNG;
+ *bufnext++ = CHAR(c);
+ qpatnext += 2;
+ }
+ } while ((c = *qpatnext++) != RBRACKET);
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ *bufnext++ = M_END;
+ break;
+ case QUESTION:
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ *bufnext++ = M_ONE;
+ break;
+ case STAR:
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ /* collapse adjacent stars to one,
+ * to avoid exponential behavior
+ */
+ if (bufnext == patbuf || bufnext[-1] != M_ALL)
+ *bufnext++ = M_ALL;
+ break;
+ default:
+ *bufnext++ = CHAR(c);
+ break;
+ }
+ }
+ *bufnext = EOS;
+#ifdef DEBUG
+ qprintf("glob0:", patbuf);
+#endif
+
+ if ((err = glob1(patbuf, pglob, limit)) != 0)
+ return(err);
+
+ /*
+ * If there was no match we are going to append the pattern
+ * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
+ * and the pattern did not contain any magic characters
+ * GLOB_NOMAGIC is there just for compatibility with csh.
+ */
+ if (pglob->gl_pathc == oldpathc &&
+ ((pglob->gl_flags & GLOB_NOCHECK) ||
+ ((pglob->gl_flags & GLOB_NOMAGIC) &&
+ !(pglob->gl_flags & GLOB_MAGCHAR))))
+ return(globextend(pattern, pglob, limit));
+ else if (!(pglob->gl_flags & GLOB_NOSORT))
+ qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
+ pglob->gl_pathc - oldpathc, sizeof(char *), compare);
+ return(0);
+}
+
+static int
+compare(p, q)
+ const void *p, *q;
+{
+ return(strcmp(*(char **)p, *(char **)q));
+}
+
+static int
+glob1(pattern, pglob, limit)
+ Char *pattern;
+ glob_t *pglob;
+ int *limit;
+{
+ Char pathbuf[MAXPATHLEN];
+
+ /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
+ if (*pattern == EOS)
+ return(0);
+ return(glob2(pathbuf, pathbuf, pathbuf + MAXPATHLEN - 1,
+ pattern, pglob, limit));
+}
+
+/*
+ * The functions glob2 and glob3 are mutually recursive; there is one level
+ * of recursion for each segment in the pattern that contains one or more
+ * meta characters.
+ */
+static int
+glob2(pathbuf, pathend, pathend_last, pattern, pglob, limit)
+ Char *pathbuf, *pathend, *pathend_last, *pattern;
+ glob_t *pglob;
+ int *limit;
+{
+ struct stat sb;
+ Char *p, *q;
+ int anymeta;
+
+ /*
+ * Loop over pattern segments until end of pattern or until
+ * segment with meta character found.
+ */
+ for (anymeta = 0;;) {
+ if (*pattern == EOS) { /* End of pattern? */
+ *pathend = EOS;
+ if (g_lstat(pathbuf, &sb, pglob))
+ return(0);
+
+ if (((pglob->gl_flags & GLOB_MARK) &&
+ pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
+ || (S_ISLNK(sb.st_mode) &&
+ (g_stat(pathbuf, &sb, pglob) == 0) &&
+ S_ISDIR(sb.st_mode)))) {
+ if (pathend + 1 > pathend_last)
+ return (1);
+ *pathend++ = SEP;
+ *pathend = EOS;
+ }
+ ++pglob->gl_matchc;
+ return(globextend(pathbuf, pglob, limit));
+ }
+
+ /* Find end of next segment, copy tentatively to pathend. */
+ q = pathend;
+ p = pattern;
+ while (*p != EOS && *p != SEP) {
+ if (ismeta(*p))
+ anymeta = 1;
+ if (q + 1 > pathend_last)
+ return (1);
+ *q++ = *p++;
+ }
+
+ if (!anymeta) { /* No expansion, do next segment. */
+ pathend = q;
+ pattern = p;
+ while (*pattern == SEP) {
+ if (pathend + 1 > pathend_last)
+ return (1);
+ *pathend++ = *pattern++;
+ }
+ } else /* Need expansion, recurse. */
+ return(glob3(pathbuf, pathend, pathend_last, pattern, p,
+ pglob, limit));
+ }
+ /* NOTREACHED */
+}
+
+static int
+glob3(pathbuf, pathend, pathend_last, pattern, restpattern, pglob, limit)
+ Char *pathbuf, *pathend, *pathend_last, *pattern, *restpattern;
+ glob_t *pglob;
+ int *limit;
+{
+ struct dirent *dp;
+ DIR *dirp;
+ int err;
+ char buf[MAXPATHLEN];
+
+ /*
+ * The readdirfunc declaration can't be prototyped, because it is
+ * assigned, below, to two functions which are prototyped in glob.h
+ * and dirent.h as taking pointers to differently typed opaque
+ * structures.
+ */
+ struct dirent *(*readdirfunc)();
+
+ if (pathend > pathend_last)
+ return (1);
+ *pathend = EOS;
+ errno = 0;
+
+ if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
+ /* TODO: don't call for ENOENT or ENOTDIR? */
+ if (pglob->gl_errfunc) {
+ if (g_Ctoc(pathbuf, buf, sizeof(buf)))
+ return (GLOB_ABEND);
+ if (pglob->gl_errfunc(buf, errno) ||
+ pglob->gl_flags & GLOB_ERR)
+ return (GLOB_ABEND);
+ }
+ return(0);
+ }
+
+ err = 0;
+
+ /* Search directory for matching names. */
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ readdirfunc = pglob->gl_readdir;
+ else
+ readdirfunc = readdir;
+ while ((dp = (*readdirfunc)(dirp))) {
+ u_char *sc;
+ Char *dc;
+
+ /* Initial DOT must be matched literally. */
+ if (dp->d_name[0] == DOT && *pattern != DOT)
+ continue;
+ dc = pathend;
+ sc = (u_char *) dp->d_name;
+ while (dc < pathend_last && (*dc++ = *sc++) != EOS)
+ ;
+ if (!match(pathend, pattern, restpattern)) {
+ *pathend = EOS;
+ continue;
+ }
+ err = glob2(pathbuf, --dc, pathend_last, restpattern,
+ pglob, limit);
+ if (err)
+ break;
+ }
+
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ (*pglob->gl_closedir)(dirp);
+ else
+ closedir(dirp);
+ return(err);
+}
+
+
+/*
+ * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
+ * add the new item, and update gl_pathc.
+ *
+ * This assumes the BSD realloc, which only copies the block when its size
+ * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
+ * behavior.
+ *
+ * Return 0 if new item added, error code if memory couldn't be allocated.
+ *
+ * Invariant of the glob_t structure:
+ * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
+ * gl_pathv points to (gl_offs + gl_pathc + 1) items.
+ */
+static int
+globextend(path, pglob, limit)
+ const Char *path;
+ glob_t *pglob;
+ int *limit;
+{
+ char **pathv;
+ int i;
+ u_int newsize, len;
+ char *copy;
+ const Char *p;
+
+ if (*limit && pglob->gl_pathc > *limit) {
+ errno = 0;
+ return (GLOB_NOSPACE);
+ }
+
+ newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
+ pathv = pglob->gl_pathv ?
+ realloc((char *)pglob->gl_pathv, newsize) :
+ malloc(newsize);
+ if (pathv == NULL) {
+ if (pglob->gl_pathv) {
+ free(pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ }
+ return(GLOB_NOSPACE);
+ }
+
+ if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
+ /* first time around -- clear initial gl_offs items */
+ pathv += pglob->gl_offs;
+ for (i = pglob->gl_offs; --i >= 0; )
+ *--pathv = NULL;
+ }
+ pglob->gl_pathv = pathv;
+
+ for (p = path; *p++;)
+ continue;
+ len = (size_t)(p - path);
+ if ((copy = malloc(len)) != NULL) {
+ if (g_Ctoc(path, copy, len)) {
+ free(copy);
+ return (GLOB_NOSPACE);
+ }
+ pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
+ }
+ pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
+ return(copy == NULL ? GLOB_NOSPACE : 0);
+}
+
+/*
+ * pattern matching function for filenames. Each occurrence of the *
+ * pattern causes a recursion level.
+ */
+static int
+match(name, pat, patend)
+ Char *name, *pat, *patend;
+{
+ int ok, negate_range;
+ Char c, k;
+
+ while (pat < patend) {
+ c = *pat++;
+ switch (c & M_MASK) {
+ case M_ALL:
+ if (pat == patend)
+ return(1);
+ do
+ if (match(name, pat, patend))
+ return(1);
+ while (*name++ != EOS);
+ return(0);
+ case M_ONE:
+ if (*name++ == EOS)
+ return(0);
+ break;
+ case M_SET:
+ ok = 0;
+ if ((k = *name++) == EOS)
+ return(0);
+ if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
+ ++pat;
+ while (((c = *pat++) & M_MASK) != M_END)
+ if ((*pat & M_MASK) == M_RNG) {
+ if (__collate_load_error ?
+ CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) :
+ __collate_range_cmp(CHAR(c), CHAR(k)) <= 0
+ && __collate_range_cmp(CHAR(k), CHAR(pat[1])) <= 0
+ )
+ ok = 1;
+ pat += 2;
+ } else if (c == k)
+ ok = 1;
+ if (ok == negate_range)
+ return(0);
+ break;
+ default:
+ if (*name++ != c)
+ return(0);
+ break;
+ }
+ }
+ return(*name == EOS);
+}
+
+/* Free allocated data belonging to a glob_t structure. */
+void
+globfree(pglob)
+ glob_t *pglob;
+{
+ int i;
+ char **pp;
+
+ if (pglob->gl_pathv != NULL) {
+ pp = pglob->gl_pathv + pglob->gl_offs;
+ for (i = pglob->gl_pathc; i--; ++pp)
+ if (*pp)
+ free(*pp);
+ free(pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ }
+}
+
+static DIR *
+g_opendir(str, pglob)
+ Char *str;
+ glob_t *pglob;
+{
+ char buf[MAXPATHLEN];
+
+ if (!*str)
+ strcpy(buf, ".");
+ else {
+ if (g_Ctoc(str, buf, sizeof(buf)))
+ return (NULL);
+ }
+
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_opendir)(buf));
+
+ return(opendir(buf));
+}
+
+static int
+g_lstat(fn, sb, pglob)
+ Char *fn;
+ struct stat *sb;
+ glob_t *pglob;
+{
+ char buf[MAXPATHLEN];
+
+ if (g_Ctoc(fn, buf, sizeof(buf))) {
+ errno = ENAMETOOLONG;
+ return (-1);
+ }
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_lstat)(buf, sb));
+ return(lstat(buf, sb));
+}
+
+static int
+g_stat(fn, sb, pglob)
+ Char *fn;
+ struct stat *sb;
+ glob_t *pglob;
+{
+ char buf[MAXPATHLEN];
+
+ if (g_Ctoc(fn, buf, sizeof(buf))) {
+ errno = ENAMETOOLONG;
+ return (-1);
+ }
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_stat)(buf, sb));
+ return(stat(buf, sb));
+}
+
+static Char *
+g_strchr(str, ch)
+ Char *str;
+ int ch;
+{
+ do {
+ if (*str == ch)
+ return (str);
+ } while (*str++);
+ return (NULL);
+}
+
+static int
+g_Ctoc(str, buf, len)
+ const Char *str;
+ char *buf;
+ u_int len;
+{
+
+ while (len--) {
+ if ((*buf++ = *str++) == '\0')
+ return (0);
+ }
+ return (1);
+}
+
+#ifdef DEBUG
+static void
+qprintf(str, s)
+ const char *str;
+ Char *s;
+{
+ Char *p;
+
+ (void)printf("%s:\n", str);
+ for (p = s; *p; p++)
+ (void)printf("%c", CHAR(*p));
+ (void)printf("\n");
+ for (p = s; *p; p++)
+ (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
+ (void)printf("\n");
+ for (p = s; *p; p++)
+ (void)printf("%c", ismeta(*p) ? '_' : ' ');
+ (void)printf("\n");
+}
+#endif
diff --git a/newlib/libc/sys/linux/stdlib/reallocf.c b/newlib/libc/sys/linux/stdlib/reallocf.c
new file mode 100644
index 000000000..4c482fade
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/reallocf.c
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 1998, M. Warner Losh <imp@freebsd.org>
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+
+#include <stdlib.h>
+
+void *
+reallocf(void *ptr, size_t size)
+{
+ void *nptr;
+
+ nptr = realloc(ptr, size);
+ if (!nptr && ptr)
+ free(ptr);
+ return (nptr);
+}
diff --git a/newlib/libc/sys/linux/stdlib/regcomp.c b/newlib/libc/sys/linux/stdlib/regcomp.c
new file mode 100644
index 000000000..766c43829
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/regcomp.c
@@ -0,0 +1,2088 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)regcomp.c 8.5 (Berkeley) 3/20/94
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <regex.h>
+
+#include "collate.h"
+
+#include "utils.h"
+#include "regex2.h"
+
+#include "cclass.h"
+#include "cname.h"
+
+/*
+ * parse structure, passed up and down to avoid global variables and
+ * other clumsinesses
+ */
+struct parse {
+ char *next; /* next character in RE */
+ char *end; /* end of string (-> NUL normally) */
+ int error; /* has an error been seen? */
+ sop *strip; /* malloced strip */
+ sopno ssize; /* malloced strip size (allocated) */
+ sopno slen; /* malloced strip length (used) */
+ int ncsalloc; /* number of csets allocated */
+ struct re_guts *g;
+# define NPAREN 10 /* we need to remember () 1-9 for back refs */
+ sopno pbegin[NPAREN]; /* -> ( ([0] unused) */
+ sopno pend[NPAREN]; /* -> ) ([0] unused) */
+};
+
+/* ========= begin header generated by ./mkh ========= */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* === regcomp.c === */
+static void p_ere(struct parse *p, int stop);
+static void p_ere_exp(struct parse *p);
+static void p_str(struct parse *p);
+static void p_bre(struct parse *p, int end1, int end2);
+static int p_simp_re(struct parse *p, int starordinary);
+static int p_count(struct parse *p);
+static void p_bracket(struct parse *p);
+static void p_b_term(struct parse *p, cset *cs);
+static void p_b_cclass(struct parse *p, cset *cs);
+static void p_b_eclass(struct parse *p, cset *cs);
+static char p_b_symbol(struct parse *p);
+static char p_b_coll_elem(struct parse *p, int endc);
+static char othercase(int ch);
+static void bothcases(struct parse *p, int ch);
+static void ordinary(struct parse *p, int ch);
+static void nonnewline(struct parse *p);
+static void repeat(struct parse *p, sopno start, int from, int to);
+static int seterr(struct parse *p, int e);
+static cset *allocset(struct parse *p);
+static void freeset(struct parse *p, cset *cs);
+static int freezeset(struct parse *p, cset *cs);
+static int firstch(struct parse *p, cset *cs);
+static int nch(struct parse *p, cset *cs);
+static void mcadd(struct parse *p, cset *cs, char *cp);
+#if used
+static void mcsub(cset *cs, char *cp);
+static int mcin(cset *cs, char *cp);
+static char *mcfind(cset *cs, char *cp);
+#endif
+static void mcinvert(struct parse *p, cset *cs);
+static void mccase(struct parse *p, cset *cs);
+static int isinsets(struct re_guts *g, int c);
+static int samesets(struct re_guts *g, int c1, int c2);
+static void categorize(struct parse *p, struct re_guts *g);
+static sopno dupl(struct parse *p, sopno start, sopno finish);
+static void doemit(struct parse *p, sop op, size_t opnd);
+static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
+static void dofwd(struct parse *p, sopno pos, sop value);
+static void enlarge(struct parse *p, sopno size);
+static void stripsnug(struct parse *p, struct re_guts *g);
+static void findmust(struct parse *p, struct re_guts *g);
+static int altoffset(sop *scan, int offset, int mccs);
+static void computejumps(struct parse *p, struct re_guts *g);
+static void computematchjumps(struct parse *p, struct re_guts *g);
+static sopno pluscount(struct parse *p, struct re_guts *g);
+
+#ifdef __cplusplus
+}
+#endif
+/* ========= end header generated by ./mkh ========= */
+
+static char nuls[10]; /* place to point scanner in event of error */
+
+/*
+ * macros for use with parse structure
+ * BEWARE: these know that the parse structure is named `p' !!!
+ */
+#define PEEK() (*p->next)
+#define PEEK2() (*(p->next+1))
+#define MORE() (p->next < p->end)
+#define MORE2() (p->next+1 < p->end)
+#define SEE(c) (MORE() && PEEK() == (c))
+#define SEETWO(a, b) (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
+#define EAT(c) ((SEE(c)) ? (NEXT(), 1) : 0)
+#define EATTWO(a, b) ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
+#define NEXT() (p->next++)
+#define NEXT2() (p->next += 2)
+#define NEXTn(n) (p->next += (n))
+#define GETNEXT() (*p->next++)
+#define SETERROR(e) seterr(p, (e))
+#define REQUIRE(co, e) ((co) || SETERROR(e))
+#define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
+#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
+#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
+#define EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
+#define INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
+#define AHEAD(pos) dofwd(p, pos, HERE()-(pos))
+#define ASTERN(sop, pos) EMIT(sop, HERE()-pos)
+#define HERE() (p->slen)
+#define THERE() (p->slen - 1)
+#define THERETHERE() (p->slen - 2)
+#define DROP(n) (p->slen -= (n))
+
+#ifndef NDEBUG
+static int never = 0; /* for use in asserts; shuts lint up */
+#else
+#define never 0 /* some <assert.h>s have bugs too */
+#endif
+
+/* Macro used by computejump()/computematchjump() */
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+/*
+ - regcomp - interface for parser and compilation
+ = extern int regcomp(regex_t *, const char *, int);
+ = #define REG_BASIC 0000
+ = #define REG_EXTENDED 0001
+ = #define REG_ICASE 0002
+ = #define REG_NOSUB 0004
+ = #define REG_NEWLINE 0010
+ = #define REG_NOSPEC 0020
+ = #define REG_PEND 0040
+ = #define REG_DUMP 0200
+ */
+int /* 0 success, otherwise REG_something */
+regcomp(preg, pattern, cflags)
+regex_t *preg;
+const char *pattern;
+int cflags;
+{
+ struct parse pa;
+ struct re_guts *g;
+ struct parse *p = &pa;
+ int i;
+ size_t len;
+#ifdef REDEBUG
+# define GOODFLAGS(f) (f)
+#else
+# define GOODFLAGS(f) ((f)&~REG_DUMP)
+#endif
+
+ cflags = GOODFLAGS(cflags);
+ if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
+ return(REG_INVARG);
+
+ if (cflags&REG_PEND) {
+ if (preg->re_endp < pattern)
+ return(REG_INVARG);
+ len = preg->re_endp - pattern;
+ } else
+ len = strlen((char *)pattern);
+
+ /* do the mallocs early so failure handling is easy */
+ g = (struct re_guts *)malloc(sizeof(struct re_guts) +
+ (NC-1)*sizeof(cat_t));
+ if (g == NULL)
+ return(REG_ESPACE);
+ p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
+ p->strip = (sop *)malloc(p->ssize * sizeof(sop));
+ p->slen = 0;
+ if (p->strip == NULL) {
+ free((char *)g);
+ return(REG_ESPACE);
+ }
+
+ /* set things up */
+ p->g = g;
+ p->next = (char *)pattern; /* convenience; we do not modify it */
+ p->end = p->next + len;
+ p->error = 0;
+ p->ncsalloc = 0;
+ for (i = 0; i < NPAREN; i++) {
+ p->pbegin[i] = 0;
+ p->pend[i] = 0;
+ }
+ g->csetsize = NC;
+ g->sets = NULL;
+ g->setbits = NULL;
+ g->ncsets = 0;
+ g->cflags = cflags;
+ g->iflags = 0;
+ g->nbol = 0;
+ g->neol = 0;
+ g->must = NULL;
+ g->moffset = -1;
+ g->charjump = NULL;
+ g->matchjump = NULL;
+ g->mlen = 0;
+ g->nsub = 0;
+ g->ncategories = 1; /* category 0 is "everything else" */
+ g->categories = &g->catspace[-(CHAR_MIN)];
+ (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
+ g->backrefs = 0;
+
+ /* do it */
+ EMIT(OEND, 0);
+ g->firststate = THERE();
+ if (cflags&REG_EXTENDED)
+ p_ere(p, OUT);
+ else if (cflags&REG_NOSPEC)
+ p_str(p);
+ else
+ p_bre(p, OUT, OUT);
+ EMIT(OEND, 0);
+ g->laststate = THERE();
+
+ /* tidy up loose ends and fill things in */
+ categorize(p, g);
+ stripsnug(p, g);
+ findmust(p, g);
+ /* only use Boyer-Moore algorithm if the pattern is bigger
+ * than three characters
+ */
+ if(g->mlen > 3) {
+ computejumps(p, g);
+ computematchjumps(p, g);
+ if(g->matchjump == NULL && g->charjump != NULL) {
+ free(g->charjump);
+ g->charjump = NULL;
+ }
+ }
+ g->nplus = pluscount(p, g);
+ g->magic = MAGIC2;
+ preg->re_nsub = g->nsub;
+ preg->re_g = g;
+ preg->re_magic = MAGIC1;
+#ifndef REDEBUG
+ /* not debugging, so can't rely on the assert() in regexec() */
+ if (g->iflags&BAD)
+ SETERROR(REG_ASSERT);
+#endif
+
+ /* win or lose, we're done */
+ if (p->error != 0) /* lose */
+ regfree(preg);
+ return(p->error);
+}
+
+/*
+ - p_ere - ERE parser top level, concatenation and alternation
+ == static void p_ere(struct parse *p, int stop);
+ */
+static void
+p_ere(p, stop)
+struct parse *p;
+int stop; /* character this ERE should end at */
+{
+ char c;
+ sopno prevback;
+ sopno prevfwd;
+ sopno conc;
+ int first = 1; /* is this the first alternative? */
+
+ for (;;) {
+ /* do a bunch of concatenated expressions */
+ conc = HERE();
+ while (MORE() && (c = PEEK()) != '|' && c != stop)
+ p_ere_exp(p);
+ (void)REQUIRE(HERE() != conc, REG_EMPTY); /* require nonempty */
+
+ if (!EAT('|'))
+ break; /* NOTE BREAK OUT */
+
+ if (first) {
+ INSERT(OCH_, conc); /* offset is wrong */
+ prevfwd = conc;
+ prevback = conc;
+ first = 0;
+ }
+ ASTERN(OOR1, prevback);
+ prevback = THERE();
+ AHEAD(prevfwd); /* fix previous offset */
+ prevfwd = HERE();
+ EMIT(OOR2, 0); /* offset is very wrong */
+ }
+
+ if (!first) { /* tail-end fixups */
+ AHEAD(prevfwd);
+ ASTERN(O_CH, prevback);
+ }
+
+ assert(!MORE() || SEE(stop));
+}
+
+/*
+ - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
+ == static void p_ere_exp(struct parse *p);
+ */
+static void
+p_ere_exp(p)
+struct parse *p;
+{
+ char c;
+ sopno pos;
+ int count;
+ int count2;
+ sopno subno;
+ int wascaret = 0;
+
+ assert(MORE()); /* caller should have ensured this */
+ c = GETNEXT();
+
+ pos = HERE();
+ switch (c) {
+ case '(':
+ (void)REQUIRE(MORE(), REG_EPAREN);
+ p->g->nsub++;
+ subno = p->g->nsub;
+ if (subno < NPAREN)
+ p->pbegin[subno] = HERE();
+ EMIT(OLPAREN, subno);
+ if (!SEE(')'))
+ p_ere(p, ')');
+ if (subno < NPAREN) {
+ p->pend[subno] = HERE();
+ assert(p->pend[subno] != 0);
+ }
+ EMIT(ORPAREN, subno);
+ (void)MUSTEAT(')', REG_EPAREN);
+ break;
+#ifndef POSIX_MISTAKE
+ case ')': /* happens only if no current unmatched ( */
+ /*
+ * You may ask, why the ifndef? Because I didn't notice
+ * this until slightly too late for 1003.2, and none of the
+ * other 1003.2 regular-expression reviewers noticed it at
+ * all. So an unmatched ) is legal POSIX, at least until
+ * we can get it fixed.
+ */
+ SETERROR(REG_EPAREN);
+ break;
+#endif
+ case '^':
+ EMIT(OBOL, 0);
+ p->g->iflags |= USEBOL;
+ p->g->nbol++;
+ wascaret = 1;
+ break;
+ case '$':
+ EMIT(OEOL, 0);
+ p->g->iflags |= USEEOL;
+ p->g->neol++;
+ break;
+ case '|':
+ SETERROR(REG_EMPTY);
+ break;
+ case '*':
+ case '+':
+ case '?':
+ SETERROR(REG_BADRPT);
+ break;
+ case '.':
+ if (p->g->cflags&REG_NEWLINE)
+ nonnewline(p);
+ else
+ EMIT(OANY, 0);
+ break;
+ case '[':
+ p_bracket(p);
+ break;
+ case '\\':
+ (void)REQUIRE(MORE(), REG_EESCAPE);
+ c = GETNEXT();
+ ordinary(p, c);
+ break;
+ case '{': /* okay as ordinary except if digit follows */
+ (void)REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
+ /* FALLTHROUGH */
+ default:
+ ordinary(p, c);
+ break;
+ }
+
+ if (!MORE())
+ return;
+ c = PEEK();
+ /* we call { a repetition if followed by a digit */
+ if (!( c == '*' || c == '+' || c == '?' ||
+ (c == '{' && MORE2() && isdigit((uch)PEEK2())) ))
+ return; /* no repetition, we're done */
+ NEXT();
+
+ (void)REQUIRE(!wascaret, REG_BADRPT);
+ switch (c) {
+ case '*': /* implemented as +? */
+ /* this case does not require the (y|) trick, noKLUDGE */
+ INSERT(OPLUS_, pos);
+ ASTERN(O_PLUS, pos);
+ INSERT(OQUEST_, pos);
+ ASTERN(O_QUEST, pos);
+ break;
+ case '+':
+ INSERT(OPLUS_, pos);
+ ASTERN(O_PLUS, pos);
+ break;
+ case '?':
+ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
+ INSERT(OCH_, pos); /* offset slightly wrong */
+ ASTERN(OOR1, pos); /* this one's right */
+ AHEAD(pos); /* fix the OCH_ */
+ EMIT(OOR2, 0); /* offset very wrong... */
+ AHEAD(THERE()); /* ...so fix it */
+ ASTERN(O_CH, THERETHERE());
+ break;
+ case '{':
+ count = p_count(p);
+ if (EAT(',')) {
+ if (isdigit((uch)PEEK())) {
+ count2 = p_count(p);
+ (void)REQUIRE(count <= count2, REG_BADBR);
+ } else /* single number with comma */
+ count2 = INFINITY;
+ } else /* just a single number */
+ count2 = count;
+ repeat(p, pos, count, count2);
+ if (!EAT('}')) { /* error heuristics */
+ while (MORE() && PEEK() != '}')
+ NEXT();
+ (void)REQUIRE(MORE(), REG_EBRACE);
+ SETERROR(REG_BADBR);
+ }
+ break;
+ }
+
+ if (!MORE())
+ return;
+ c = PEEK();
+ if (!( c == '*' || c == '+' || c == '?' ||
+ (c == '{' && MORE2() && isdigit((uch)PEEK2())) ) )
+ return;
+ SETERROR(REG_BADRPT);
+}
+
+/*
+ - p_str - string (no metacharacters) "parser"
+ == static void p_str(struct parse *p);
+ */
+static void
+p_str(p)
+struct parse *p;
+{
+ (void)REQUIRE(MORE(), REG_EMPTY);
+ while (MORE())
+ ordinary(p, GETNEXT());
+}
+
+/*
+ - p_bre - BRE parser top level, anchoring and concatenation
+ == static void p_bre(struct parse *p, int end1, \
+ == int end2);
+ * Giving end1 as OUT essentially eliminates the end1/end2 check.
+ *
+ * This implementation is a bit of a kludge, in that a trailing $ is first
+ * taken as an ordinary character and then revised to be an anchor. The
+ * only undesirable side effect is that '$' gets included as a character
+ * category in such cases. This is fairly harmless; not worth fixing.
+ * The amount of lookahead needed to avoid this kludge is excessive.
+ */
+static void
+p_bre(p, end1, end2)
+struct parse *p;
+int end1; /* first terminating character */
+int end2; /* second terminating character */
+{
+ sopno start = HERE();
+ int first = 1; /* first subexpression? */
+ int wasdollar = 0;
+
+ if (EAT('^')) {
+ EMIT(OBOL, 0);
+ p->g->iflags |= USEBOL;
+ p->g->nbol++;
+ }
+ while (MORE() && !SEETWO(end1, end2)) {
+ wasdollar = p_simp_re(p, first);
+ first = 0;
+ }
+ if (wasdollar) { /* oops, that was a trailing anchor */
+ DROP(1);
+ EMIT(OEOL, 0);
+ p->g->iflags |= USEEOL;
+ p->g->neol++;
+ }
+
+ (void)REQUIRE(HERE() != start, REG_EMPTY); /* require nonempty */
+}
+
+/*
+ - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
+ == static int p_simp_re(struct parse *p, int starordinary);
+ */
+static int /* was the simple RE an unbackslashed $? */
+p_simp_re(p, starordinary)
+struct parse *p;
+int starordinary; /* is a leading * an ordinary character? */
+{
+ int c;
+ int count;
+ int count2;
+ sopno pos;
+ int i;
+ sopno subno;
+# define BACKSL (1<<CHAR_BIT)
+
+ pos = HERE(); /* repetion op, if any, covers from here */
+
+ assert(MORE()); /* caller should have ensured this */
+ c = GETNEXT();
+ if (c == '\\') {
+ (void)REQUIRE(MORE(), REG_EESCAPE);
+ c = BACKSL | GETNEXT();
+ }
+ switch (c) {
+ case '.':
+ if (p->g->cflags&REG_NEWLINE)
+ nonnewline(p);
+ else
+ EMIT(OANY, 0);
+ break;
+ case '[':
+ p_bracket(p);
+ break;
+ case BACKSL|'{':
+ SETERROR(REG_BADRPT);
+ break;
+ case BACKSL|'(':
+ p->g->nsub++;
+ subno = p->g->nsub;
+ if (subno < NPAREN)
+ p->pbegin[subno] = HERE();
+ EMIT(OLPAREN, subno);
+ /* the MORE here is an error heuristic */
+ if (MORE() && !SEETWO('\\', ')'))
+ p_bre(p, '\\', ')');
+ if (subno < NPAREN) {
+ p->pend[subno] = HERE();
+ assert(p->pend[subno] != 0);
+ }
+ EMIT(ORPAREN, subno);
+ (void)REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
+ break;
+ case BACKSL|')': /* should not get here -- must be user */
+ case BACKSL|'}':
+ SETERROR(REG_EPAREN);
+ break;
+ case BACKSL|'1':
+ case BACKSL|'2':
+ case BACKSL|'3':
+ case BACKSL|'4':
+ case BACKSL|'5':
+ case BACKSL|'6':
+ case BACKSL|'7':
+ case BACKSL|'8':
+ case BACKSL|'9':
+ i = (c&~BACKSL) - '0';
+ assert(i < NPAREN);
+ if (p->pend[i] != 0) {
+ assert(i <= p->g->nsub);
+ EMIT(OBACK_, i);
+ assert(p->pbegin[i] != 0);
+ assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
+ assert(OP(p->strip[p->pend[i]]) == ORPAREN);
+ (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
+ EMIT(O_BACK, i);
+ } else
+ SETERROR(REG_ESUBREG);
+ p->g->backrefs = 1;
+ break;
+ case '*':
+ (void)REQUIRE(starordinary, REG_BADRPT);
+ /* FALLTHROUGH */
+ default:
+ ordinary(p, (char)c);
+ break;
+ }
+
+ if (EAT('*')) { /* implemented as +? */
+ /* this case does not require the (y|) trick, noKLUDGE */
+ INSERT(OPLUS_, pos);
+ ASTERN(O_PLUS, pos);
+ INSERT(OQUEST_, pos);
+ ASTERN(O_QUEST, pos);
+ } else if (EATTWO('\\', '{')) {
+ count = p_count(p);
+ if (EAT(',')) {
+ if (MORE() && isdigit((uch)PEEK())) {
+ count2 = p_count(p);
+ (void)REQUIRE(count <= count2, REG_BADBR);
+ } else /* single number with comma */
+ count2 = INFINITY;
+ } else /* just a single number */
+ count2 = count;
+ repeat(p, pos, count, count2);
+ if (!EATTWO('\\', '}')) { /* error heuristics */
+ while (MORE() && !SEETWO('\\', '}'))
+ NEXT();
+ (void)REQUIRE(MORE(), REG_EBRACE);
+ SETERROR(REG_BADBR);
+ }
+ } else if (c == '$') /* $ (but not \$) ends it */
+ return(1);
+
+ return(0);
+}
+
+/*
+ - p_count - parse a repetition count
+ == static int p_count(struct parse *p);
+ */
+static int /* the value */
+p_count(p)
+struct parse *p;
+{
+ int count = 0;
+ int ndigits = 0;
+
+ while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
+ count = count*10 + (GETNEXT() - '0');
+ ndigits++;
+ }
+
+ (void)REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
+ return(count);
+}
+
+/*
+ - p_bracket - parse a bracketed character list
+ == static void p_bracket(struct parse *p);
+ *
+ * Note a significant property of this code: if the allocset() did SETERROR,
+ * no set operations are done.
+ */
+static void
+p_bracket(p)
+struct parse *p;
+{
+ cset *cs = allocset(p);
+ int invert = 0;
+
+ /* Dept of Truly Sickening Special-Case Kludges */
+ if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
+ EMIT(OBOW, 0);
+ NEXTn(6);
+ return;
+ }
+ if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
+ EMIT(OEOW, 0);
+ NEXTn(6);
+ return;
+ }
+
+ if (EAT('^'))
+ invert++; /* make note to invert set at end */
+ if (EAT(']'))
+ CHadd(cs, ']');
+ else if (EAT('-'))
+ CHadd(cs, '-');
+ while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
+ p_b_term(p, cs);
+ if (EAT('-'))
+ CHadd(cs, '-');
+ (void)MUSTEAT(']', REG_EBRACK);
+
+ if (p->error != 0) /* don't mess things up further */
+ return;
+
+ if (p->g->cflags&REG_ICASE) {
+ int i;
+ int ci;
+
+ for (i = p->g->csetsize - 1; i >= 0; i--)
+ if (CHIN(cs, i) && isalpha(i)) {
+ ci = othercase(i);
+ if (ci != i)
+ CHadd(cs, ci);
+ }
+ if (cs->multis != NULL)
+ mccase(p, cs);
+ }
+ if (invert) {
+ int i;
+
+ for (i = p->g->csetsize - 1; i >= 0; i--)
+ if (CHIN(cs, i))
+ CHsub(cs, i);
+ else
+ CHadd(cs, i);
+ if (p->g->cflags&REG_NEWLINE)
+ CHsub(cs, '\n');
+ if (cs->multis != NULL)
+ mcinvert(p, cs);
+ }
+
+ assert(cs->multis == NULL); /* xxx */
+
+ if (nch(p, cs) == 1) { /* optimize singleton sets */
+ ordinary(p, firstch(p, cs));
+ freeset(p, cs);
+ } else
+ EMIT(OANYOF, freezeset(p, cs));
+}
+
+/*
+ - p_b_term - parse one term of a bracketed character list
+ == static void p_b_term(struct parse *p, cset *cs);
+ */
+static void
+p_b_term(p, cs)
+struct parse *p;
+cset *cs;
+{
+ char c;
+ char start, finish;
+ int i;
+
+ /* classify what we've got */
+ switch ((MORE()) ? PEEK() : '\0') {
+ case '[':
+ c = (MORE2()) ? PEEK2() : '\0';
+ break;
+ case '-':
+ SETERROR(REG_ERANGE);
+ return; /* NOTE RETURN */
+ break;
+ default:
+ c = '\0';
+ break;
+ }
+
+ switch (c) {
+ case ':': /* character class */
+ NEXT2();
+ (void)REQUIRE(MORE(), REG_EBRACK);
+ c = PEEK();
+ (void)REQUIRE(c != '-' && c != ']', REG_ECTYPE);
+ p_b_cclass(p, cs);
+ (void)REQUIRE(MORE(), REG_EBRACK);
+ (void)REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
+ break;
+ case '=': /* equivalence class */
+ NEXT2();
+ (void)REQUIRE(MORE(), REG_EBRACK);
+ c = PEEK();
+ (void)REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
+ p_b_eclass(p, cs);
+ (void)REQUIRE(MORE(), REG_EBRACK);
+ (void)REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
+ break;
+ default: /* symbol, ordinary character, or range */
+/* xxx revision needed for multichar stuff */
+ start = p_b_symbol(p);
+ if (SEE('-') && MORE2() && PEEK2() != ']') {
+ /* range */
+ NEXT();
+ if (EAT('-'))
+ finish = '-';
+ else
+ finish = p_b_symbol(p);
+ } else
+ finish = start;
+ if (start == finish)
+ CHadd(cs, start);
+ else {
+ if (__collate_load_error) {
+ (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE);
+ for (i = (uch)start; i <= (uch)finish; i++)
+ CHadd(cs, i);
+ } else {
+ (void)REQUIRE(__collate_range_cmp(start, finish) <= 0, REG_ERANGE);
+ for (i = CHAR_MIN; i <= CHAR_MAX; i++) {
+ if ( __collate_range_cmp(start, i) <= 0
+ && __collate_range_cmp(i, finish) <= 0
+ )
+ CHadd(cs, i);
+ }
+ }
+ }
+ break;
+ }
+}
+
+/*
+ - p_b_cclass - parse a character-class name and deal with it
+ == static void p_b_cclass(struct parse *p, cset *cs);
+ */
+static void
+p_b_cclass(p, cs)
+struct parse *p;
+cset *cs;
+{
+ int c;
+ char *sp = p->next;
+ struct cclass *cp;
+ size_t len;
+
+ while (MORE() && isalpha((uch)PEEK()))
+ NEXT();
+ len = p->next - sp;
+ for (cp = cclasses; cp->name != NULL; cp++)
+ if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
+ break;
+ if (cp->name == NULL) {
+ /* oops, didn't find it */
+ SETERROR(REG_ECTYPE);
+ return;
+ }
+
+ switch (cp->fidx) {
+ case CALNUM:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isalnum((uch)c))
+ CHadd(cs, c);
+ break;
+ case CALPHA:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isalpha((uch)c))
+ CHadd(cs, c);
+ break;
+ case CBLANK:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isblank((uch)c))
+ CHadd(cs, c);
+ break;
+ case CCNTRL:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (iscntrl((uch)c))
+ CHadd(cs, c);
+ break;
+ case CDIGIT:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isdigit((uch)c))
+ CHadd(cs, c);
+ break;
+ case CGRAPH:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isgraph((uch)c))
+ CHadd(cs, c);
+ break;
+ case CLOWER:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (islower((uch)c))
+ CHadd(cs, c);
+ break;
+ case CPRINT:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isprint((uch)c))
+ CHadd(cs, c);
+ break;
+ case CPUNCT:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (ispunct((uch)c))
+ CHadd(cs, c);
+ break;
+ case CSPACE:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isspace((uch)c))
+ CHadd(cs, c);
+ break;
+ case CUPPER:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isupper((uch)c))
+ CHadd(cs, c);
+ break;
+ case CXDIGIT:
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (isxdigit((uch)c))
+ CHadd(cs, c);
+ break;
+ }
+#if 0
+ for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
+ MCadd(p, cs, u);
+#endif
+}
+
+/*
+ - p_b_eclass - parse an equivalence-class name and deal with it
+ == static void p_b_eclass(struct parse *p, cset *cs);
+ *
+ * This implementation is incomplete. xxx
+ */
+static void
+p_b_eclass(p, cs)
+struct parse *p;
+cset *cs;
+{
+ char c;
+
+ c = p_b_coll_elem(p, '=');
+ CHadd(cs, c);
+}
+
+/*
+ - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
+ == static char p_b_symbol(struct parse *p);
+ */
+static char /* value of symbol */
+p_b_symbol(p)
+struct parse *p;
+{
+ char value;
+
+ (void)REQUIRE(MORE(), REG_EBRACK);
+ if (!EATTWO('[', '.'))
+ return(GETNEXT());
+
+ /* collating symbol */
+ value = p_b_coll_elem(p, '.');
+ (void)REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
+ return(value);
+}
+
+/*
+ - p_b_coll_elem - parse a collating-element name and look it up
+ == static char p_b_coll_elem(struct parse *p, int endc);
+ */
+static char /* value of collating element */
+p_b_coll_elem(p, endc)
+struct parse *p;
+int endc; /* name ended by endc,']' */
+{
+ char *sp = p->next;
+ struct cname *cp;
+ int len;
+
+ while (MORE() && !SEETWO(endc, ']'))
+ NEXT();
+ if (!MORE()) {
+ SETERROR(REG_EBRACK);
+ return(0);
+ }
+ len = p->next - sp;
+ for (cp = cnames; cp->name != NULL; cp++)
+ if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
+ return(cp->code); /* known name */
+ if (len == 1)
+ return(*sp); /* single character */
+ SETERROR(REG_ECOLLATE); /* neither */
+ return(0);
+}
+
+/*
+ - othercase - return the case counterpart of an alphabetic
+ == static char othercase(int ch);
+ */
+static char /* if no counterpart, return ch */
+othercase(ch)
+int ch;
+{
+ ch = (uch)ch;
+ assert(isalpha(ch));
+ if (isupper(ch))
+ return(tolower(ch));
+ else if (islower(ch))
+ return(toupper(ch));
+ else /* peculiar, but could happen */
+ return(ch);
+}
+
+/*
+ - bothcases - emit a dualcase version of a two-case character
+ == static void bothcases(struct parse *p, int ch);
+ *
+ * Boy, is this implementation ever a kludge...
+ */
+static void
+bothcases(p, ch)
+struct parse *p;
+int ch;
+{
+ char *oldnext = p->next;
+ char *oldend = p->end;
+ char bracket[3];
+
+ ch = (uch)ch;
+ assert(othercase(ch) != ch); /* p_bracket() would recurse */
+ p->next = bracket;
+ p->end = bracket+2;
+ bracket[0] = ch;
+ bracket[1] = ']';
+ bracket[2] = '\0';
+ p_bracket(p);
+ assert(p->next == bracket+2);
+ p->next = oldnext;
+ p->end = oldend;
+}
+
+/*
+ - ordinary - emit an ordinary character
+ == static void ordinary(struct parse *p, int ch);
+ */
+static void
+ordinary(p, ch)
+struct parse *p;
+int ch;
+{
+ cat_t *cap = p->g->categories;
+
+ if ((p->g->cflags&REG_ICASE) && isalpha((uch)ch) && othercase(ch) != ch)
+ bothcases(p, ch);
+ else {
+ EMIT(OCHAR, (uch)ch);
+ if (cap[ch] == 0)
+ cap[ch] = p->g->ncategories++;
+ }
+}
+
+/*
+ - nonnewline - emit REG_NEWLINE version of OANY
+ == static void nonnewline(struct parse *p);
+ *
+ * Boy, is this implementation ever a kludge...
+ */
+static void
+nonnewline(p)
+struct parse *p;
+{
+ char *oldnext = p->next;
+ char *oldend = p->end;
+ char bracket[4];
+
+ p->next = bracket;
+ p->end = bracket+3;
+ bracket[0] = '^';
+ bracket[1] = '\n';
+ bracket[2] = ']';
+ bracket[3] = '\0';
+ p_bracket(p);
+ assert(p->next == bracket+3);
+ p->next = oldnext;
+ p->end = oldend;
+}
+
+/*
+ - repeat - generate code for a bounded repetition, recursively if needed
+ == static void repeat(struct parse *p, sopno start, int from, int to);
+ */
+static void
+repeat(p, start, from, to)
+struct parse *p;
+sopno start; /* operand from here to end of strip */
+int from; /* repeated from this number */
+int to; /* to this number of times (maybe INFINITY) */
+{
+ sopno finish = HERE();
+# define N 2
+# define INF 3
+# define REP(f, t) ((f)*8 + (t))
+# define MAP(n) (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
+ sopno copy;
+
+ if (p->error != 0) /* head off possible runaway recursion */
+ return;
+
+ assert(from <= to);
+
+ switch (REP(MAP(from), MAP(to))) {
+ case REP(0, 0): /* must be user doing this */
+ DROP(finish-start); /* drop the operand */
+ break;
+ case REP(0, 1): /* as x{1,1}? */
+ case REP(0, N): /* as x{1,n}? */
+ case REP(0, INF): /* as x{1,}? */
+ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
+ INSERT(OCH_, start); /* offset is wrong... */
+ repeat(p, start+1, 1, to);
+ ASTERN(OOR1, start);
+ AHEAD(start); /* ... fix it */
+ EMIT(OOR2, 0);
+ AHEAD(THERE());
+ ASTERN(O_CH, THERETHERE());
+ break;
+ case REP(1, 1): /* trivial case */
+ /* done */
+ break;
+ case REP(1, N): /* as x?x{1,n-1} */
+ /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
+ INSERT(OCH_, start);
+ ASTERN(OOR1, start);
+ AHEAD(start);
+ EMIT(OOR2, 0); /* offset very wrong... */
+ AHEAD(THERE()); /* ...so fix it */
+ ASTERN(O_CH, THERETHERE());
+ copy = dupl(p, start+1, finish+1);
+ assert(copy == finish+4);
+ repeat(p, copy, 1, to-1);
+ break;
+ case REP(1, INF): /* as x+ */
+ INSERT(OPLUS_, start);
+ ASTERN(O_PLUS, start);
+ break;
+ case REP(N, N): /* as xx{m-1,n-1} */
+ copy = dupl(p, start, finish);
+ repeat(p, copy, from-1, to-1);
+ break;
+ case REP(N, INF): /* as xx{n-1,INF} */
+ copy = dupl(p, start, finish);
+ repeat(p, copy, from-1, to);
+ break;
+ default: /* "can't happen" */
+ SETERROR(REG_ASSERT); /* just in case */
+ break;
+ }
+}
+
+/*
+ - seterr - set an error condition
+ == static int seterr(struct parse *p, int e);
+ */
+static int /* useless but makes type checking happy */
+seterr(p, e)
+struct parse *p;
+int e;
+{
+ if (p->error == 0) /* keep earliest error condition */
+ p->error = e;
+ p->next = nuls; /* try to bring things to a halt */
+ p->end = nuls;
+ return(0); /* make the return value well-defined */
+}
+
+/*
+ - allocset - allocate a set of characters for []
+ == static cset *allocset(struct parse *p);
+ */
+static cset *
+allocset(p)
+struct parse *p;
+{
+ int no = p->g->ncsets++;
+ size_t nc;
+ size_t nbytes;
+ cset *cs;
+ size_t css = (size_t)p->g->csetsize;
+ int i;
+
+ if (no >= p->ncsalloc) { /* need another column of space */
+ p->ncsalloc += CHAR_BIT;
+ nc = p->ncsalloc;
+ assert(nc % CHAR_BIT == 0);
+ nbytes = nc / CHAR_BIT * css;
+ if (p->g->sets == NULL)
+ p->g->sets = (cset *)malloc(nc * sizeof(cset));
+ else
+ p->g->sets = (cset *)reallocf((char *)p->g->sets,
+ nc * sizeof(cset));
+ if (p->g->setbits == NULL)
+ p->g->setbits = (uch *)malloc(nbytes);
+ else {
+ p->g->setbits = (uch *)reallocf((char *)p->g->setbits,
+ nbytes);
+ /* xxx this isn't right if setbits is now NULL */
+ for (i = 0; i < no; i++)
+ p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
+ }
+ if (p->g->sets != NULL && p->g->setbits != NULL)
+ (void) memset((char *)p->g->setbits + (nbytes - css),
+ 0, css);
+ else {
+ no = 0;
+ SETERROR(REG_ESPACE);
+ /* caller's responsibility not to do set ops */
+ }
+ }
+
+ assert(p->g->sets != NULL); /* xxx */
+ cs = &p->g->sets[no];
+ cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
+ cs->mask = 1 << ((no) % CHAR_BIT);
+ cs->hash = 0;
+ cs->smultis = 0;
+ cs->multis = NULL;
+
+ return(cs);
+}
+
+/*
+ - freeset - free a now-unused set
+ == static void freeset(struct parse *p, cset *cs);
+ */
+static void
+freeset(p, cs)
+struct parse *p;
+cset *cs;
+{
+ int i;
+ cset *top = &p->g->sets[p->g->ncsets];
+ size_t css = (size_t)p->g->csetsize;
+
+ for (i = 0; i < css; i++)
+ CHsub(cs, i);
+ if (cs == top-1) /* recover only the easy case */
+ p->g->ncsets--;
+}
+
+/*
+ - freezeset - final processing on a set of characters
+ == static int freezeset(struct parse *p, cset *cs);
+ *
+ * The main task here is merging identical sets. This is usually a waste
+ * of time (although the hash code minimizes the overhead), but can win
+ * big if REG_ICASE is being used. REG_ICASE, by the way, is why the hash
+ * is done using addition rather than xor -- all ASCII [aA] sets xor to
+ * the same value!
+ */
+static int /* set number */
+freezeset(p, cs)
+struct parse *p;
+cset *cs;
+{
+ short h = cs->hash;
+ int i;
+ cset *top = &p->g->sets[p->g->ncsets];
+ cset *cs2;
+ size_t css = (size_t)p->g->csetsize;
+
+ /* look for an earlier one which is the same */
+ for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
+ if (cs2->hash == h && cs2 != cs) {
+ /* maybe */
+ for (i = 0; i < css; i++)
+ if (!!CHIN(cs2, i) != !!CHIN(cs, i))
+ break; /* no */
+ if (i == css)
+ break; /* yes */
+ }
+
+ if (cs2 < top) { /* found one */
+ freeset(p, cs);
+ cs = cs2;
+ }
+
+ return((int)(cs - p->g->sets));
+}
+
+/*
+ - firstch - return first character in a set (which must have at least one)
+ == static int firstch(struct parse *p, cset *cs);
+ */
+static int /* character; there is no "none" value */
+firstch(p, cs)
+struct parse *p;
+cset *cs;
+{
+ int i;
+ size_t css = (size_t)p->g->csetsize;
+
+ for (i = 0; i < css; i++)
+ if (CHIN(cs, i))
+ return((char)i);
+ assert(never);
+ return(0); /* arbitrary */
+}
+
+/*
+ - nch - number of characters in a set
+ == static int nch(struct parse *p, cset *cs);
+ */
+static int
+nch(p, cs)
+struct parse *p;
+cset *cs;
+{
+ int i;
+ size_t css = (size_t)p->g->csetsize;
+ int n = 0;
+
+ for (i = 0; i < css; i++)
+ if (CHIN(cs, i))
+ n++;
+ return(n);
+}
+
+/*
+ - mcadd - add a collating element to a cset
+ == static void mcadd(struct parse *p, cset *cs, \
+ == char *cp);
+ */
+static void
+mcadd(p, cs, cp)
+struct parse *p;
+cset *cs;
+char *cp;
+{
+ size_t oldend = cs->smultis;
+
+ cs->smultis += strlen(cp) + 1;
+ if (cs->multis == NULL)
+ cs->multis = malloc(cs->smultis);
+ else
+ cs->multis = reallocf(cs->multis, cs->smultis);
+ if (cs->multis == NULL) {
+ SETERROR(REG_ESPACE);
+ return;
+ }
+
+ (void) strcpy(cs->multis + oldend - 1, cp);
+ cs->multis[cs->smultis - 1] = '\0';
+}
+
+#if used
+/*
+ - mcsub - subtract a collating element from a cset
+ == static void mcsub(cset *cs, char *cp);
+ */
+static void
+mcsub(cs, cp)
+cset *cs;
+char *cp;
+{
+ char *fp = mcfind(cs, cp);
+ size_t len = strlen(fp);
+
+ assert(fp != NULL);
+ (void) memmove(fp, fp + len + 1,
+ cs->smultis - (fp + len + 1 - cs->multis));
+ cs->smultis -= len;
+
+ if (cs->smultis == 0) {
+ free(cs->multis);
+ cs->multis = NULL;
+ return;
+ }
+
+ cs->multis = reallocf(cs->multis, cs->smultis);
+ assert(cs->multis != NULL);
+}
+
+/*
+ - mcin - is a collating element in a cset?
+ == static int mcin(cset *cs, char *cp);
+ */
+static int
+mcin(cs, cp)
+cset *cs;
+char *cp;
+{
+ return(mcfind(cs, cp) != NULL);
+}
+
+/*
+ - mcfind - find a collating element in a cset
+ == static char *mcfind(cset *cs, char *cp);
+ */
+static char *
+mcfind(cs, cp)
+cset *cs;
+char *cp;
+{
+ char *p;
+
+ if (cs->multis == NULL)
+ return(NULL);
+ for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
+ if (strcmp(cp, p) == 0)
+ return(p);
+ return(NULL);
+}
+#endif
+
+/*
+ - mcinvert - invert the list of collating elements in a cset
+ == static void mcinvert(struct parse *p, cset *cs);
+ *
+ * This would have to know the set of possibilities. Implementation
+ * is deferred.
+ */
+static void
+mcinvert(p, cs)
+struct parse *p;
+cset *cs;
+{
+ assert(cs->multis == NULL); /* xxx */
+}
+
+/*
+ - mccase - add case counterparts of the list of collating elements in a cset
+ == static void mccase(struct parse *p, cset *cs);
+ *
+ * This would have to know the set of possibilities. Implementation
+ * is deferred.
+ */
+static void
+mccase(p, cs)
+struct parse *p;
+cset *cs;
+{
+ assert(cs->multis == NULL); /* xxx */
+}
+
+/*
+ - isinsets - is this character in any sets?
+ == static int isinsets(struct re_guts *g, int c);
+ */
+static int /* predicate */
+isinsets(g, c)
+struct re_guts *g;
+int c;
+{
+ uch *col;
+ int i;
+ int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
+ unsigned uc = (uch)c;
+
+ for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
+ if (col[uc] != 0)
+ return(1);
+ return(0);
+}
+
+/*
+ - samesets - are these two characters in exactly the same sets?
+ == static int samesets(struct re_guts *g, int c1, int c2);
+ */
+static int /* predicate */
+samesets(g, c1, c2)
+struct re_guts *g;
+int c1;
+int c2;
+{
+ uch *col;
+ int i;
+ int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
+ unsigned uc1 = (uch)c1;
+ unsigned uc2 = (uch)c2;
+
+ for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
+ if (col[uc1] != col[uc2])
+ return(0);
+ return(1);
+}
+
+/*
+ - categorize - sort out character categories
+ == static void categorize(struct parse *p, struct re_guts *g);
+ */
+static void
+categorize(p, g)
+struct parse *p;
+struct re_guts *g;
+{
+ cat_t *cats = g->categories;
+ int c;
+ int c2;
+ cat_t cat;
+
+ /* avoid making error situations worse */
+ if (p->error != 0)
+ return;
+
+ for (c = CHAR_MIN; c <= CHAR_MAX; c++)
+ if (cats[c] == 0 && isinsets(g, c)) {
+ cat = g->ncategories++;
+ cats[c] = cat;
+ for (c2 = c+1; c2 <= CHAR_MAX; c2++)
+ if (cats[c2] == 0 && samesets(g, c, c2))
+ cats[c2] = cat;
+ }
+}
+
+/*
+ - dupl - emit a duplicate of a bunch of sops
+ == static sopno dupl(struct parse *p, sopno start, sopno finish);
+ */
+static sopno /* start of duplicate */
+dupl(p, start, finish)
+struct parse *p;
+sopno start; /* from here */
+sopno finish; /* to this less one */
+{
+ sopno ret = HERE();
+ sopno len = finish - start;
+
+ assert(finish >= start);
+ if (len == 0)
+ return(ret);
+ enlarge(p, p->ssize + len); /* this many unexpected additions */
+ assert(p->ssize >= p->slen + len);
+ (void) memcpy((char *)(p->strip + p->slen),
+ (char *)(p->strip + start), (size_t)len*sizeof(sop));
+ p->slen += len;
+ return(ret);
+}
+
+/*
+ - doemit - emit a strip operator
+ == static void doemit(struct parse *p, sop op, size_t opnd);
+ *
+ * It might seem better to implement this as a macro with a function as
+ * hard-case backup, but it's just too big and messy unless there are
+ * some changes to the data structures. Maybe later.
+ */
+static void
+doemit(p, op, opnd)
+struct parse *p;
+sop op;
+size_t opnd;
+{
+ /* avoid making error situations worse */
+ if (p->error != 0)
+ return;
+
+ /* deal with oversize operands ("can't happen", more or less) */
+ assert(opnd < 1<<OPSHIFT);
+
+ /* deal with undersized strip */
+ if (p->slen >= p->ssize)
+ enlarge(p, (p->ssize+1) / 2 * 3); /* +50% */
+ assert(p->slen < p->ssize);
+
+ /* finally, it's all reduced to the easy case */
+ p->strip[p->slen++] = SOP(op, opnd);
+}
+
+/*
+ - doinsert - insert a sop into the strip
+ == static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
+ */
+static void
+doinsert(p, op, opnd, pos)
+struct parse *p;
+sop op;
+size_t opnd;
+sopno pos;
+{
+ sopno sn;
+ sop s;
+ int i;
+
+ /* avoid making error situations worse */
+ if (p->error != 0)
+ return;
+
+ sn = HERE();
+ EMIT(op, opnd); /* do checks, ensure space */
+ assert(HERE() == sn+1);
+ s = p->strip[sn];
+
+ /* adjust paren pointers */
+ assert(pos > 0);
+ for (i = 1; i < NPAREN; i++) {
+ if (p->pbegin[i] >= pos) {
+ p->pbegin[i]++;
+ }
+ if (p->pend[i] >= pos) {
+ p->pend[i]++;
+ }
+ }
+
+ memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
+ (HERE()-pos-1)*sizeof(sop));
+ p->strip[pos] = s;
+}
+
+/*
+ - dofwd - complete a forward reference
+ == static void dofwd(struct parse *p, sopno pos, sop value);
+ */
+static void
+dofwd(p, pos, value)
+struct parse *p;
+sopno pos;
+sop value;
+{
+ /* avoid making error situations worse */
+ if (p->error != 0)
+ return;
+
+ assert(value < 1<<OPSHIFT);
+ p->strip[pos] = OP(p->strip[pos]) | value;
+}
+
+/*
+ - enlarge - enlarge the strip
+ == static void enlarge(struct parse *p, sopno size);
+ */
+static void
+enlarge(p, size)
+struct parse *p;
+sopno size;
+{
+ sop *sp;
+
+ if (p->ssize >= size)
+ return;
+
+ sp = (sop *)realloc(p->strip, size*sizeof(sop));
+ if (sp == NULL) {
+ SETERROR(REG_ESPACE);
+ return;
+ }
+ p->strip = sp;
+ p->ssize = size;
+}
+
+/*
+ - stripsnug - compact the strip
+ == static void stripsnug(struct parse *p, struct re_guts *g);
+ */
+static void
+stripsnug(p, g)
+struct parse *p;
+struct re_guts *g;
+{
+ g->nstates = p->slen;
+ g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
+ if (g->strip == NULL) {
+ SETERROR(REG_ESPACE);
+ g->strip = p->strip;
+ }
+}
+
+/*
+ - findmust - fill in must and mlen with longest mandatory literal string
+ == static void findmust(struct parse *p, struct re_guts *g);
+ *
+ * This algorithm could do fancy things like analyzing the operands of |
+ * for common subsequences. Someday. This code is simple and finds most
+ * of the interesting cases.
+ *
+ * Note that must and mlen got initialized during setup.
+ */
+static void
+findmust(p, g)
+struct parse *p;
+struct re_guts *g;
+{
+ sop *scan;
+ sop *start;
+ sop *newstart;
+ sopno newlen;
+ sop s;
+ char *cp;
+ sopno i;
+ int offset;
+ int cs, mccs;
+
+ /* avoid making error situations worse */
+ if (p->error != 0)
+ return;
+
+ /* Find out if we can handle OANYOF or not */
+ mccs = 0;
+ for (cs = 0; cs < g->ncsets; cs++)
+ if (g->sets[cs].multis != NULL)
+ mccs = 1;
+
+ /* find the longest OCHAR sequence in strip */
+ newlen = 0;
+ offset = 0;
+ g->moffset = 0;
+ scan = g->strip + 1;
+ do {
+ s = *scan++;
+ switch (OP(s)) {
+ case OCHAR: /* sequence member */
+ if (newlen == 0) /* new sequence */
+ newstart = scan - 1;
+ newlen++;
+ break;
+ case OPLUS_: /* things that don't break one */
+ case OLPAREN:
+ case ORPAREN:
+ break;
+ case OQUEST_: /* things that must be skipped */
+ case OCH_:
+ offset = altoffset(scan, offset, mccs);
+ scan--;
+ do {
+ scan += OPND(s);
+ s = *scan;
+ /* assert() interferes w debug printouts */
+ if (OP(s) != O_QUEST && OP(s) != O_CH &&
+ OP(s) != OOR2) {
+ g->iflags |= BAD;
+ return;
+ }
+ } while (OP(s) != O_QUEST && OP(s) != O_CH);
+ /* fallthrough */
+ case OBOW: /* things that break a sequence */
+ case OEOW:
+ case OBOL:
+ case OEOL:
+ case O_QUEST:
+ case O_CH:
+ case OEND:
+ if (newlen > g->mlen) { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
+ if (offset > -1) {
+ g->moffset += offset;
+ offset = newlen;
+ } else
+ g->moffset = offset;
+ } else {
+ if (offset > -1)
+ offset += newlen;
+ }
+ newlen = 0;
+ break;
+ case OANY:
+ if (newlen > g->mlen) { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
+ if (offset > -1) {
+ g->moffset += offset;
+ offset = newlen;
+ } else
+ g->moffset = offset;
+ } else {
+ if (offset > -1)
+ offset += newlen;
+ }
+ if (offset > -1)
+ offset++;
+ newlen = 0;
+ break;
+ case OANYOF: /* may or may not invalidate offset */
+ /* First, everything as OANY */
+ if (newlen > g->mlen) { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
+ if (offset > -1) {
+ g->moffset += offset;
+ offset = newlen;
+ } else
+ g->moffset = offset;
+ } else {
+ if (offset > -1)
+ offset += newlen;
+ }
+ if (offset > -1)
+ offset++;
+ newlen = 0;
+ /* And, now, if we found out we can't deal with
+ * it, make offset = -1.
+ */
+ if (mccs)
+ offset = -1;
+ break;
+ default:
+ /* Anything here makes it impossible or too hard
+ * to calculate the offset -- so we give up;
+ * save the last known good offset, in case the
+ * must sequence doesn't occur later.
+ */
+ if (newlen > g->mlen) { /* ends one */
+ start = newstart;
+ g->mlen = newlen;
+ if (offset > -1)
+ g->moffset += offset;
+ else
+ g->moffset = offset;
+ }
+ offset = -1;
+ newlen = 0;
+ break;
+ }
+ } while (OP(s) != OEND);
+
+ if (g->mlen == 0) { /* there isn't one */
+ g->moffset = -1;
+ return;
+ }
+
+ /* turn it into a character string */
+ g->must = malloc((size_t)g->mlen + 1);
+ if (g->must == NULL) { /* argh; just forget it */
+ g->mlen = 0;
+ g->moffset = -1;
+ return;
+ }
+ cp = g->must;
+ scan = start;
+ for (i = g->mlen; i > 0; i--) {
+ while (OP(s = *scan++) != OCHAR)
+ continue;
+ assert(cp < g->must + g->mlen);
+ *cp++ = (char)OPND(s);
+ }
+ assert(cp == g->must + g->mlen);
+ *cp++ = '\0'; /* just on general principles */
+}
+
+/*
+ - altoffset - choose biggest offset among multiple choices
+ == static int altoffset(sop *scan, int offset, int mccs);
+ *
+ * Compute, recursively if necessary, the largest offset among multiple
+ * re paths.
+ */
+static int
+altoffset(scan, offset, mccs)
+sop *scan;
+int offset;
+int mccs;
+{
+ int largest;
+ int try;
+ sop s;
+
+ /* If we gave up already on offsets, return */
+ if (offset == -1)
+ return -1;
+
+ largest = 0;
+ try = 0;
+ s = *scan++;
+ while (OP(s) != O_QUEST && OP(s) != O_CH) {
+ switch (OP(s)) {
+ case OOR1:
+ if (try > largest)
+ largest = try;
+ try = 0;
+ break;
+ case OQUEST_:
+ case OCH_:
+ try = altoffset(scan, try, mccs);
+ if (try == -1)
+ return -1;
+ scan--;
+ do {
+ scan += OPND(s);
+ s = *scan;
+ if (OP(s) != O_QUEST && OP(s) != O_CH &&
+ OP(s) != OOR2)
+ return -1;
+ } while (OP(s) != O_QUEST && OP(s) != O_CH);
+ /* We must skip to the next position, or we'll
+ * leave altoffset() too early.
+ */
+ scan++;
+ break;
+ case OANYOF:
+ if (mccs)
+ return -1;
+ case OCHAR:
+ case OANY:
+ try++;
+ case OBOW:
+ case OEOW:
+ case OLPAREN:
+ case ORPAREN:
+ case OOR2:
+ break;
+ default:
+ try = -1;
+ break;
+ }
+ if (try == -1)
+ return -1;
+ s = *scan++;
+ }
+
+ if (try > largest)
+ largest = try;
+
+ return largest+offset;
+}
+
+/*
+ - computejumps - compute char jumps for BM scan
+ == static void computejumps(struct parse *p, struct re_guts *g);
+ *
+ * This algorithm assumes g->must exists and is has size greater than
+ * zero. It's based on the algorithm found on Computer Algorithms by
+ * Sara Baase.
+ *
+ * A char jump is the number of characters one needs to jump based on
+ * the value of the character from the text that was mismatched.
+ */
+static void
+computejumps(p, g)
+struct parse *p;
+struct re_guts *g;
+{
+ int ch;
+ int mindex;
+
+ /* Avoid making errors worse */
+ if (p->error != 0)
+ return;
+
+ g->charjump = (int*) malloc((NC + 1) * sizeof(int));
+ if (g->charjump == NULL) /* Not a fatal error */
+ return;
+ /* Adjust for signed chars, if necessary */
+ g->charjump = &g->charjump[-(CHAR_MIN)];
+
+ /* If the character does not exist in the pattern, the jump
+ * is equal to the number of characters in the pattern.
+ */
+ for (ch = CHAR_MIN; ch < (CHAR_MAX + 1); ch++)
+ g->charjump[ch] = g->mlen;
+
+ /* If the character does exist, compute the jump that would
+ * take us to the last character in the pattern equal to it
+ * (notice that we match right to left, so that last character
+ * is the first one that would be matched).
+ */
+ for (mindex = 0; mindex < g->mlen; mindex++)
+ g->charjump[g->must[mindex]] = g->mlen - mindex - 1;
+}
+
+/*
+ - computematchjumps - compute match jumps for BM scan
+ == static void computematchjumps(struct parse *p, struct re_guts *g);
+ *
+ * This algorithm assumes g->must exists and is has size greater than
+ * zero. It's based on the algorithm found on Computer Algorithms by
+ * Sara Baase.
+ *
+ * A match jump is the number of characters one needs to advance based
+ * on the already-matched suffix.
+ * Notice that all values here are minus (g->mlen-1), because of the way
+ * the search algorithm works.
+ */
+static void
+computematchjumps(p, g)
+struct parse *p;
+struct re_guts *g;
+{
+ int mindex; /* General "must" iterator */
+ int suffix; /* Keeps track of matching suffix */
+ int ssuffix; /* Keeps track of suffixes' suffix */
+ int* pmatches; /* pmatches[k] points to the next i
+ * such that i+1...mlen is a substring
+ * of k+1...k+mlen-i-1
+ */
+
+ /* Avoid making errors worse */
+ if (p->error != 0)
+ return;
+
+ pmatches = (int*) malloc(g->mlen * sizeof(unsigned int));
+ if (pmatches == NULL) {
+ g->matchjump = NULL;
+ return;
+ }
+
+ g->matchjump = (int*) malloc(g->mlen * sizeof(unsigned int));
+ if (g->matchjump == NULL) /* Not a fatal error */
+ return;
+
+ /* Set maximum possible jump for each character in the pattern */
+ for (mindex = 0; mindex < g->mlen; mindex++)
+ g->matchjump[mindex] = 2*g->mlen - mindex - 1;
+
+ /* Compute pmatches[] */
+ for (mindex = g->mlen - 1, suffix = g->mlen; mindex >= 0;
+ mindex--, suffix--) {
+ pmatches[mindex] = suffix;
+
+ /* If a mismatch is found, interrupting the substring,
+ * compute the matchjump for that position. If no
+ * mismatch is found, then a text substring mismatched
+ * against the suffix will also mismatch against the
+ * substring.
+ */
+ while (suffix < g->mlen
+ && g->must[mindex] != g->must[suffix]) {
+ g->matchjump[suffix] = MIN(g->matchjump[suffix],
+ g->mlen - mindex - 1);
+ suffix = pmatches[suffix];
+ }
+ }
+
+ /* Compute the matchjump up to the last substring found to jump
+ * to the beginning of the largest must pattern prefix matching
+ * it's own suffix.
+ */
+ for (mindex = 0; mindex <= suffix; mindex++)
+ g->matchjump[mindex] = MIN(g->matchjump[mindex],
+ g->mlen + suffix - mindex);
+
+ ssuffix = pmatches[suffix];
+ while (suffix < g->mlen) {
+ while (suffix <= ssuffix && suffix < g->mlen) {
+ g->matchjump[suffix] = MIN(g->matchjump[suffix],
+ g->mlen + ssuffix - suffix);
+ suffix++;
+ }
+ if (suffix < g->mlen)
+ ssuffix = pmatches[ssuffix];
+ }
+
+ free(pmatches);
+}
+
+/*
+ - pluscount - count + nesting
+ == static sopno pluscount(struct parse *p, struct re_guts *g);
+ */
+static sopno /* nesting depth */
+pluscount(p, g)
+struct parse *p;
+struct re_guts *g;
+{
+ sop *scan;
+ sop s;
+ sopno plusnest = 0;
+ sopno maxnest = 0;
+
+ if (p->error != 0)
+ return(0); /* there may not be an OEND */
+
+ scan = g->strip + 1;
+ do {
+ s = *scan++;
+ switch (OP(s)) {
+ case OPLUS_:
+ plusnest++;
+ break;
+ case O_PLUS:
+ if (plusnest > maxnest)
+ maxnest = plusnest;
+ plusnest--;
+ break;
+ }
+ } while (OP(s) != OEND);
+ if (plusnest != 0)
+ g->iflags |= BAD;
+ return(maxnest);
+}
diff --git a/newlib/libc/sys/linux/stdlib/regerror.c b/newlib/libc/sys/linux/stdlib/regerror.c
new file mode 100644
index 000000000..30a9759b2
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/regerror.c
@@ -0,0 +1,178 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)regerror.c 8.4 (Berkeley) 3/20/94
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <regex.h>
+
+#include "utils.h"
+
+/* ========= begin header generated by ./mkh ========= */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* === regerror.c === */
+static char *regatoi(const regex_t *preg, char *localbuf);
+
+#ifdef __cplusplus
+}
+#endif
+/* ========= end header generated by ./mkh ========= */
+/*
+ = #define REG_NOMATCH 1
+ = #define REG_BADPAT 2
+ = #define REG_ECOLLATE 3
+ = #define REG_ECTYPE 4
+ = #define REG_EESCAPE 5
+ = #define REG_ESUBREG 6
+ = #define REG_EBRACK 7
+ = #define REG_EPAREN 8
+ = #define REG_EBRACE 9
+ = #define REG_BADBR 10
+ = #define REG_ERANGE 11
+ = #define REG_ESPACE 12
+ = #define REG_BADRPT 13
+ = #define REG_EMPTY 14
+ = #define REG_ASSERT 15
+ = #define REG_INVARG 16
+ = #define REG_ATOI 255 // convert name to number (!)
+ = #define REG_ITOA 0400 // convert number to name (!)
+ */
+static struct rerr {
+ int code;
+ char *name;
+ char *explain;
+} rerrs[] = {
+ {REG_NOMATCH, "REG_NOMATCH", "regexec() failed to match"},
+ {REG_BADPAT, "REG_BADPAT", "invalid regular expression"},
+ {REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"},
+ {REG_ECTYPE, "REG_ECTYPE", "invalid character class"},
+ {REG_EESCAPE, "REG_EESCAPE", "trailing backslash (\\)"},
+ {REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"},
+ {REG_EBRACK, "REG_EBRACK", "brackets ([ ]) not balanced"},
+ {REG_EPAREN, "REG_EPAREN", "parentheses not balanced"},
+ {REG_EBRACE, "REG_EBRACE", "braces not balanced"},
+ {REG_BADBR, "REG_BADBR", "invalid repetition count(s)"},
+ {REG_ERANGE, "REG_ERANGE", "invalid character range"},
+ {REG_ESPACE, "REG_ESPACE", "out of memory"},
+ {REG_BADRPT, "REG_BADRPT", "repetition-operator operand invalid"},
+ {REG_EMPTY, "REG_EMPTY", "empty (sub)expression"},
+ {REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"},
+ {REG_INVARG, "REG_INVARG", "invalid argument to regex routine"},
+ {0, "", "*** unknown regexp error code ***"}
+};
+
+/*
+ - regerror - the interface to error numbers
+ = extern size_t regerror(int, const regex_t *, char *, size_t);
+ */
+/* ARGSUSED */
+size_t
+regerror(errcode, preg, errbuf, errbuf_size)
+int errcode;
+const regex_t *preg;
+char *errbuf;
+size_t errbuf_size;
+{
+ struct rerr *r;
+ size_t len;
+ int target = errcode &~ REG_ITOA;
+ char *s;
+ char convbuf[50];
+
+ if (errcode == REG_ATOI)
+ s = regatoi(preg, convbuf);
+ else {
+ for (r = rerrs; r->code != 0; r++)
+ if (r->code == target)
+ break;
+
+ if (errcode&REG_ITOA) {
+ if (r->code != 0)
+ (void) strcpy(convbuf, r->name);
+ else
+ sprintf(convbuf, "REG_0x%x", target);
+ assert(strlen(convbuf) < sizeof(convbuf));
+ s = convbuf;
+ } else
+ s = r->explain;
+ }
+
+ len = strlen(s) + 1;
+ if (errbuf_size > 0) {
+ if (errbuf_size > len)
+ (void) strcpy(errbuf, s);
+ else {
+ (void) strncpy(errbuf, s, errbuf_size-1);
+ errbuf[errbuf_size-1] = '\0';
+ }
+ }
+
+ return(len);
+}
+
+/*
+ - regatoi - internal routine to implement REG_ATOI
+ == static char *regatoi(const regex_t *preg, char *localbuf);
+ */
+static char *
+regatoi(preg, localbuf)
+const regex_t *preg;
+char *localbuf;
+{
+ struct rerr *r;
+
+ for (r = rerrs; r->code != 0; r++)
+ if (strcmp(r->name, preg->re_endp) == 0)
+ break;
+ if (r->code == 0)
+ return("0");
+
+ sprintf(localbuf, "%d", r->code);
+ return(localbuf);
+}
diff --git a/newlib/libc/sys/linux/stdlib/regex.3 b/newlib/libc/sys/linux/stdlib/regex.3
new file mode 100644
index 000000000..d87164177
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/regex.3
@@ -0,0 +1,701 @@
+.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
+.\" Copyright (c) 1992, 1993, 1994
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Henry Spencer.
+.\"
+.\" 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.
+.\"
+.\" @(#)regex.3 8.4 (Berkeley) 3/20/94
+.\" $FreeBSD: src/lib/libc/regex/regex.3,v 1.9 2001/10/01 16:08:58 ru Exp $
+.\"
+.Dd March 20, 1994
+.Dt REGEX 3
+.Os
+.Sh NAME
+.Nm regcomp ,
+.Nm regexec ,
+.Nm regerror ,
+.Nm regfree
+.Nd regular-expression library
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/types.h
+.In regex.h
+.Ft int
+.Fn regcomp "regex_t *preg" "const char *pattern" "int cflags"
+.Ft int
+.Fo regexec
+.Fa "const regex_t *preg" "const char *string"
+.Fa "size_t nmatch" "regmatch_t pmatch[]" "int eflags"
+.Fc
+.Ft size_t
+.Fo regerror
+.Fa "int errcode" "const regex_t *preg"
+.Fa "char *errbuf" "size_t errbuf_size"
+.Fc
+.Ft void
+.Fn regfree "regex_t *preg"
+.Sh DESCRIPTION
+These routines implement
+.St -p1003.2
+regular expressions
+.Pq Do RE Dc Ns s ;
+see
+.Xr re_format 7 .
+.Fn Regcomp
+compiles an RE written as a string into an internal form,
+.Fn regexec
+matches that internal form against a string and reports results,
+.Fn regerror
+transforms error codes from either into human-readable messages,
+and
+.Fn regfree
+frees any dynamically-allocated storage used by the internal form
+of an RE.
+.Pp
+The header
+.Aq Pa regex.h
+declares two structure types,
+.Ft regex_t
+and
+.Ft regmatch_t ,
+the former for compiled internal forms and the latter for match reporting.
+It also declares the four functions,
+a type
+.Ft regoff_t ,
+and a number of constants with names starting with
+.Dq Dv REG_ .
+.Pp
+.Fn Regcomp
+compiles the regular expression contained in the
+.Fa pattern
+string,
+subject to the flags in
+.Fa cflags ,
+and places the results in the
+.Ft regex_t
+structure pointed to by
+.Fa preg .
+.Fa Cflags
+is the bitwise OR of zero or more of the following flags:
+.Bl -tag -width REG_EXTENDED
+.It Dv REG_EXTENDED
+Compile modern
+.Pq Dq extended
+REs,
+rather than the obsolete
+.Pq Dq basic
+REs that
+are the default.
+.It Dv REG_BASIC
+This is a synonym for 0,
+provided as a counterpart to
+.Dv REG_EXTENDED
+to improve readability.
+.It Dv REG_NOSPEC
+Compile with recognition of all special characters turned off.
+All characters are thus considered ordinary,
+so the
+.Dq RE
+is a literal string.
+This is an extension,
+compatible with but not specified by
+.St -p1003.2 ,
+and should be used with
+caution in software intended to be portable to other systems.
+.Dv REG_EXTENDED
+and
+.Dv REG_NOSPEC
+may not be used
+in the same call to
+.Fn regcomp .
+.It Dv REG_ICASE
+Compile for matching that ignores upper/lower case distinctions.
+See
+.Xr re_format 7 .
+.It Dv REG_NOSUB
+Compile for matching that need only report success or failure,
+not what was matched.
+.It Dv REG_NEWLINE
+Compile for newline-sensitive matching.
+By default, newline is a completely ordinary character with no special
+meaning in either REs or strings.
+With this flag,
+.Ql [^
+bracket expressions and
+.Ql .\&
+never match newline,
+a
+.Ql ^\&
+anchor matches the null string after any newline in the string
+in addition to its normal function,
+and the
+.Ql $\&
+anchor matches the null string before any newline in the
+string in addition to its normal function.
+.It Dv REG_PEND
+The regular expression ends,
+not at the first NUL,
+but just before the character pointed to by the
+.Va re_endp
+member of the structure pointed to by
+.Fa preg .
+The
+.Va re_endp
+member is of type
+.Ft "const char *" .
+This flag permits inclusion of NULs in the RE;
+they are considered ordinary characters.
+This is an extension,
+compatible with but not specified by
+.St -p1003.2 ,
+and should be used with
+caution in software intended to be portable to other systems.
+.El
+.Pp
+When successful,
+.Fn regcomp
+returns 0 and fills in the structure pointed to by
+.Fa preg .
+One member of that structure
+(other than
+.Va re_endp )
+is publicized:
+.Va re_nsub ,
+of type
+.Ft size_t ,
+contains the number of parenthesized subexpressions within the RE
+(except that the value of this member is undefined if the
+.Dv REG_NOSUB
+flag was used).
+If
+.Fn regcomp
+fails, it returns a non-zero error code;
+see
+.Sx DIAGNOSTICS .
+.Pp
+.Fn Regexec
+matches the compiled RE pointed to by
+.Fa preg
+against the
+.Fa string ,
+subject to the flags in
+.Fa eflags ,
+and reports results using
+.Fa nmatch ,
+.Fa pmatch ,
+and the returned value.
+The RE must have been compiled by a previous invocation of
+.Fn regcomp .
+The compiled form is not altered during execution of
+.Fn regexec ,
+so a single compiled RE can be used simultaneously by multiple threads.
+.Pp
+By default,
+the NUL-terminated string pointed to by
+.Fa string
+is considered to be the text of an entire line, minus any terminating
+newline.
+The
+.Fa eflags
+argument is the bitwise OR of zero or more of the following flags:
+.Bl -tag -width REG_STARTEND
+.It Dv REG_NOTBOL
+The first character of
+the string
+is not the beginning of a line, so the
+.Ql ^\&
+anchor should not match before it.
+This does not affect the behavior of newlines under
+.Dv REG_NEWLINE .
+.It Dv REG_NOTEOL
+The NUL terminating
+the string
+does not end a line, so the
+.Ql $\&
+anchor should not match before it.
+This does not affect the behavior of newlines under
+.Dv REG_NEWLINE .
+.It Dv REG_STARTEND
+The string is considered to start at
+.Fa string
++
+.Fa pmatch Ns [0]. Ns Va rm_so
+and to have a terminating NUL located at
+.Fa string
++
+.Fa pmatch Ns [0]. Ns Va rm_eo
+(there need not actually be a NUL at that location),
+regardless of the value of
+.Fa nmatch .
+See below for the definition of
+.Fa pmatch
+and
+.Fa nmatch .
+This is an extension,
+compatible with but not specified by
+.St -p1003.2 ,
+and should be used with
+caution in software intended to be portable to other systems.
+Note that a non-zero
+.Va rm_so
+does not imply
+.Dv REG_NOTBOL ;
+.Dv REG_STARTEND
+affects only the location of the string,
+not how it is matched.
+.El
+.Pp
+See
+.Xr re_format 7
+for a discussion of what is matched in situations where an RE or a
+portion thereof could match any of several substrings of
+.Fa string .
+.Pp
+Normally,
+.Fn regexec
+returns 0 for success and the non-zero code
+.Dv REG_NOMATCH
+for failure.
+Other non-zero error codes may be returned in exceptional situations;
+see
+.Sx DIAGNOSTICS .
+.Pp
+If
+.Dv REG_NOSUB
+was specified in the compilation of the RE,
+or if
+.Fa nmatch
+is 0,
+.Fn regexec
+ignores the
+.Fa pmatch
+argument (but see below for the case where
+.Dv REG_STARTEND
+is specified).
+Otherwise,
+.Fa pmatch
+points to an array of
+.Fa nmatch
+structures of type
+.Ft regmatch_t .
+Such a structure has at least the members
+.Va rm_so
+and
+.Va rm_eo ,
+both of type
+.Ft regoff_t
+(a signed arithmetic type at least as large as an
+.Ft off_t
+and a
+.Ft ssize_t ) ,
+containing respectively the offset of the first character of a substring
+and the offset of the first character after the end of the substring.
+Offsets are measured from the beginning of the
+.Fa string
+argument given to
+.Fn regexec .
+An empty substring is denoted by equal offsets,
+both indicating the character following the empty substring.
+.Pp
+The 0th member of the
+.Fa pmatch
+array is filled in to indicate what substring of
+.Fa string
+was matched by the entire RE.
+Remaining members report what substring was matched by parenthesized
+subexpressions within the RE;
+member
+.Va i
+reports subexpression
+.Va i ,
+with subexpressions counted (starting at 1) by the order of their opening
+parentheses in the RE, left to right.
+Unused entries in the array (corresponding either to subexpressions that
+did not participate in the match at all, or to subexpressions that do not
+exist in the RE (that is,
+.Va i
+>
+.Fa preg Ns -> Ns Va re_nsub ) )
+have both
+.Va rm_so
+and
+.Va rm_eo
+set to -1.
+If a subexpression participated in the match several times,
+the reported substring is the last one it matched.
+(Note, as an example in particular, that when the RE
+.Ql "(b*)+"
+matches
+.Ql bbb ,
+the parenthesized subexpression matches each of the three
+.So Li b Sc Ns s
+and then
+an infinite number of empty strings following the last
+.Ql b ,
+so the reported substring is one of the empties.)
+.Pp
+If
+.Dv REG_STARTEND
+is specified,
+.Fa pmatch
+must point to at least one
+.Ft regmatch_t
+(even if
+.Fa nmatch
+is 0 or
+.Dv REG_NOSUB
+was specified),
+to hold the input offsets for
+.Dv REG_STARTEND .
+Use for output is still entirely controlled by
+.Fa nmatch ;
+if
+.Fa nmatch
+is 0 or
+.Dv REG_NOSUB
+was specified,
+the value of
+.Fa pmatch Ns [0]
+will not be changed by a successful
+.Fn regexec .
+.Pp
+.Fn Regerror
+maps a non-zero
+.Fa errcode
+from either
+.Fn regcomp
+or
+.Fn regexec
+to a human-readable, printable message.
+If
+.Fa preg
+is
+.No non\- Ns Dv NULL ,
+the error code should have arisen from use of
+the
+.Ft regex_t
+pointed to by
+.Fa preg ,
+and if the error code came from
+.Fn regcomp ,
+it should have been the result from the most recent
+.Fn regcomp
+using that
+.Ft regex_t .
+.No ( Fn Regerror
+may be able to supply a more detailed message using information
+from the
+.Ft regex_t . )
+.Fn Regerror
+places the NUL-terminated message into the buffer pointed to by
+.Fa errbuf ,
+limiting the length (including the NUL) to at most
+.Fa errbuf_size
+bytes.
+If the whole message won't fit,
+as much of it as will fit before the terminating NUL is supplied.
+In any case,
+the returned value is the size of buffer needed to hold the whole
+message (including terminating NUL).
+If
+.Fa errbuf_size
+is 0,
+.Fa errbuf
+is ignored but the return value is still correct.
+.Pp
+If the
+.Fa errcode
+given to
+.Fn regerror
+is first ORed with
+.Dv REG_ITOA ,
+the
+.Dq message
+that results is the printable name of the error code,
+e.g.\&
+.Dq Dv REG_NOMATCH ,
+rather than an explanation thereof.
+If
+.Fa errcode
+is
+.Dv REG_ATOI ,
+then
+.Fa preg
+shall be
+.No non\- Ns Dv NULL
+and the
+.Va re_endp
+member of the structure it points to
+must point to the printable name of an error code;
+in this case, the result in
+.Fa errbuf
+is the decimal digits of
+the numeric value of the error code
+(0 if the name is not recognized).
+.Dv REG_ITOA
+and
+.Dv REG_ATOI
+are intended primarily as debugging facilities;
+they are extensions,
+compatible with but not specified by
+.St -p1003.2 ,
+and should be used with
+caution in software intended to be portable to other systems.
+Be warned also that they are considered experimental and changes are possible.
+.Pp
+.Fn Regfree
+frees any dynamically-allocated storage associated with the compiled RE
+pointed to by
+.Fa preg .
+The remaining
+.Ft regex_t
+is no longer a valid compiled RE
+and the effect of supplying it to
+.Fn regexec
+or
+.Fn regerror
+is undefined.
+.Pp
+None of these functions references global variables except for tables
+of constants;
+all are safe for use from multiple threads if the arguments are safe.
+.Sh IMPLEMENTATION CHOICES
+There are a number of decisions that
+.St -p1003.2
+leaves up to the implementor,
+either by explicitly saying
+.Dq undefined
+or by virtue of them being
+forbidden by the RE grammar.
+This implementation treats them as follows.
+.Pp
+See
+.Xr re_format 7
+for a discussion of the definition of case-independent matching.
+.Pp
+There is no particular limit on the length of REs,
+except insofar as memory is limited.
+Memory usage is approximately linear in RE size, and largely insensitive
+to RE complexity, except for bounded repetitions.
+See
+.Sx BUGS
+for one short RE using them
+that will run almost any system out of memory.
+.Pp
+A backslashed character other than one specifically given a magic meaning
+by
+.St -p1003.2
+(such magic meanings occur only in obsolete
+.Bq Dq basic
+REs)
+is taken as an ordinary character.
+.Pp
+Any unmatched
+.Ql [\&
+is a
+.Dv REG_EBRACK
+error.
+.Pp
+Equivalence classes cannot begin or end bracket-expression ranges.
+The endpoint of one range cannot begin another.
+.Pp
+.Dv RE_DUP_MAX ,
+the limit on repetition counts in bounded repetitions, is 255.
+.Pp
+A repetition operator
+.Ql ( ?\& ,
+.Ql *\& ,
+.Ql +\& ,
+or bounds)
+cannot follow another
+repetition operator.
+A repetition operator cannot begin an expression or subexpression
+or follow
+.Ql ^\&
+or
+.Ql |\& .
+.Pp
+.Ql |\&
+cannot appear first or last in a (sub)expression or after another
+.Ql |\& ,
+i.e. an operand of
+.Ql |\&
+cannot be an empty subexpression.
+An empty parenthesized subexpression,
+.Ql "()" ,
+is legal and matches an
+empty (sub)string.
+An empty string is not a legal RE.
+.Pp
+A
+.Ql {\&
+followed by a digit is considered the beginning of bounds for a
+bounded repetition, which must then follow the syntax for bounds.
+A
+.Ql {\&
+.Em not
+followed by a digit is considered an ordinary character.
+.Pp
+.Ql ^\&
+and
+.Ql $\&
+beginning and ending subexpressions in obsolete
+.Pq Dq basic
+REs are anchors, not ordinary characters.
+.Sh SEE ALSO
+.Xr grep 1 ,
+.Xr re_format 7
+.Pp
+.St -p1003.2 ,
+sections 2.8 (Regular Expression Notation)
+and
+B.5 (C Binding for Regular Expression Matching).
+.Sh DIAGNOSTICS
+Non-zero error codes from
+.Fn regcomp
+and
+.Fn regexec
+include the following:
+.Pp
+.Bl -tag -width REG_ECOLLATE -compact
+.It Dv REG_NOMATCH
+.Fn regexec
+failed to match
+.It Dv REG_BADPAT
+invalid regular expression
+.It Dv REG_ECOLLATE
+invalid collating element
+.It Dv REG_ECTYPE
+invalid character class
+.It Dv REG_EESCAPE
+.Ql \e
+applied to unescapable character
+.It Dv REG_ESUBREG
+invalid backreference number
+.It Dv REG_EBRACK
+brackets
+.Ql "[ ]"
+not balanced
+.It Dv REG_EPAREN
+parentheses
+.Ql "( )"
+not balanced
+.It Dv REG_EBRACE
+braces
+.Ql "{ }"
+not balanced
+.It Dv REG_BADBR
+invalid repetition count(s) in
+.Ql "{ }"
+.It Dv REG_ERANGE
+invalid character range in
+.Ql "[ ]"
+.It Dv REG_ESPACE
+ran out of memory
+.It Dv REG_BADRPT
+.Ql ?\& ,
+.Ql *\& ,
+or
+.Ql +\&
+operand invalid
+.It Dv REG_EMPTY
+empty (sub)expression
+.It Dv REG_ASSERT
+can't happen - you found a bug
+.It Dv REG_INVARG
+invalid argument, e.g. negative-length string
+.El
+.Sh HISTORY
+Originally written by
+.An Henry Spencer .
+Altered for inclusion in the
+.Bx 4.4
+distribution.
+.Sh BUGS
+This is an alpha release with known defects.
+Please report problems.
+.Pp
+The back-reference code is subtle and doubts linger about its correctness
+in complex cases.
+.Pp
+.Fn Regexec
+performance is poor.
+This will improve with later releases.
+.Fa Nmatch
+exceeding 0 is expensive;
+.Fa nmatch
+exceeding 1 is worse.
+.Fn Regexec
+is largely insensitive to RE complexity
+.Em except
+that back
+references are massively expensive.
+RE length does matter; in particular, there is a strong speed bonus
+for keeping RE length under about 30 characters,
+with most special characters counting roughly double.
+.Pp
+.Fn Regcomp
+implements bounded repetitions by macro expansion,
+which is costly in time and space if counts are large
+or bounded repetitions are nested.
+An RE like, say,
+.Ql "((((a{1,100}){1,100}){1,100}){1,100}){1,100}"
+will (eventually) run almost any existing machine out of swap space.
+.Pp
+There are suspected problems with response to obscure error conditions.
+Notably,
+certain kinds of internal overflow,
+produced only by truly enormous REs or by multiply nested bounded repetitions,
+are probably not handled well.
+.Pp
+Due to a mistake in
+.St -p1003.2 ,
+things like
+.Ql "a)b"
+are legal REs because
+.Ql )\&
+is
+a special character only in the presence of a previous unmatched
+.Ql (\& .
+This can't be fixed until the spec is fixed.
+.Pp
+The standard's definition of back references is vague.
+For example, does
+.Ql "a\e(\e(b\e)*\e2\e)*d"
+match
+.Ql "abbbd" ?
+Until the standard is clarified,
+behavior in such cases should not be relied on.
+.Pp
+The implementation of word-boundary matching is a bit of a kludge,
+and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/newlib/libc/sys/linux/stdlib/regex2.h b/newlib/libc/sys/linux/stdlib/regex2.h
new file mode 100644
index 000000000..303b7f7b3
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/regex2.h
@@ -0,0 +1,177 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)regex2.h 8.4 (Berkeley) 3/20/94
+ * $FreeBSD: src/lib/libc/regex/regex2.h,v 1.6 2002/03/22 23:41:56 obrien Exp $
+ */
+
+/*
+ * First, the stuff that ends up in the outside-world include file
+ = typedef off_t regoff_t;
+ = typedef struct {
+ = int re_magic;
+ = size_t re_nsub; // number of parenthesized subexpressions
+ = const char *re_endp; // end pointer for REG_PEND
+ = struct re_guts *re_g; // none of your business :-)
+ = } regex_t;
+ = typedef struct {
+ = regoff_t rm_so; // start of match
+ = regoff_t rm_eo; // end of match
+ = } regmatch_t;
+ */
+/*
+ * internals of regex_t
+ */
+#define MAGIC1 ((('r'^0200)<<8) | 'e')
+
+/*
+ * The internal representation is a *strip*, a sequence of
+ * operators ending with an endmarker. (Some terminology etc. is a
+ * historical relic of earlier versions which used multiple strips.)
+ * Certain oddities in the representation are there to permit running
+ * the machinery backwards; in particular, any deviation from sequential
+ * flow must be marked at both its source and its destination. Some
+ * fine points:
+ *
+ * - OPLUS_ and O_PLUS are *inside* the loop they create.
+ * - OQUEST_ and O_QUEST are *outside* the bypass they create.
+ * - OCH_ and O_CH are *outside* the multi-way branch they create, while
+ * OOR1 and OOR2 are respectively the end and the beginning of one of
+ * the branches. Note that there is an implicit OOR2 following OCH_
+ * and an implicit OOR1 preceding O_CH.
+ *
+ * In state representations, an operator's bit is on to signify a state
+ * immediately *preceding* "execution" of that operator.
+ */
+typedef unsigned long sop; /* strip operator */
+typedef long sopno;
+#define OPRMASK 0xf8000000L
+#define OPDMASK 0x07ffffffL
+#define OPSHIFT ((unsigned)27)
+#define OP(n) ((n)&OPRMASK)
+#define OPND(n) ((n)&OPDMASK)
+#define SOP(op, opnd) ((op)|(opnd))
+/* operators meaning operand */
+/* (back, fwd are offsets) */
+#define OEND (1L<<OPSHIFT) /* endmarker - */
+#define OCHAR (2L<<OPSHIFT) /* character unsigned char */
+#define OBOL (3L<<OPSHIFT) /* left anchor - */
+#define OEOL (4L<<OPSHIFT) /* right anchor - */
+#define OANY (5L<<OPSHIFT) /* . - */
+#define OANYOF (6L<<OPSHIFT) /* [...] set number */
+#define OBACK_ (7L<<OPSHIFT) /* begin \d paren number */
+#define O_BACK (8L<<OPSHIFT) /* end \d paren number */
+#define OPLUS_ (9L<<OPSHIFT) /* + prefix fwd to suffix */
+#define O_PLUS (10L<<OPSHIFT) /* + suffix back to prefix */
+#define OQUEST_ (11L<<OPSHIFT) /* ? prefix fwd to suffix */
+#define O_QUEST (12L<<OPSHIFT) /* ? suffix back to prefix */
+#define OLPAREN (13L<<OPSHIFT) /* ( fwd to ) */
+#define ORPAREN (14L<<OPSHIFT) /* ) back to ( */
+#define OCH_ (15L<<OPSHIFT) /* begin choice fwd to OOR2 */
+#define OOR1 (16L<<OPSHIFT) /* | pt. 1 back to OOR1 or OCH_ */
+#define OOR2 (17L<<OPSHIFT) /* | pt. 2 fwd to OOR2 or O_CH */
+#define O_CH (18L<<OPSHIFT) /* end choice back to OOR1 */
+#define OBOW (19L<<OPSHIFT) /* begin word - */
+#define OEOW (20L<<OPSHIFT) /* end word - */
+
+/*
+ * Structure for [] character-set representation. Character sets are
+ * done as bit vectors, grouped 8 to a byte vector for compactness.
+ * The individual set therefore has both a pointer to the byte vector
+ * and a mask to pick out the relevant bit of each byte. A hash code
+ * simplifies testing whether two sets could be identical.
+ *
+ * This will get trickier for multicharacter collating elements. As
+ * preliminary hooks for dealing with such things, we also carry along
+ * a string of multi-character elements, and decide the size of the
+ * vectors at run time.
+ */
+typedef struct {
+ uch *ptr; /* -> uch [csetsize] */
+ uch mask; /* bit within array */
+ short hash; /* hash code */
+ size_t smultis;
+ char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
+} cset;
+/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
+#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (uch)(c))
+#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (uch)(c))
+#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
+#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
+#define MCsub(p, cs, cp) mcsub(p, cs, cp)
+#define MCin(p, cs, cp) mcin(p, cs, cp)
+
+/* stuff for character categories */
+typedef unsigned char cat_t;
+
+/*
+ * main compiled-expression structure
+ */
+struct re_guts {
+ int magic;
+# define MAGIC2 ((('R'^0200)<<8)|'E')
+ sop *strip; /* malloced area for strip */
+ int csetsize; /* number of bits in a cset vector */
+ int ncsets; /* number of csets in use */
+ cset *sets; /* -> cset [ncsets] */
+ uch *setbits; /* -> uch[csetsize][ncsets/CHAR_BIT] */
+ int cflags; /* copy of regcomp() cflags argument */
+ sopno nstates; /* = number of sops */
+ sopno firststate; /* the initial OEND (normally 0) */
+ sopno laststate; /* the final OEND */
+ int iflags; /* internal flags */
+# define USEBOL 01 /* used ^ */
+# define USEEOL 02 /* used $ */
+# define BAD 04 /* something wrong */
+ int nbol; /* number of ^ used */
+ int neol; /* number of $ used */
+ int ncategories; /* how many character categories */
+ cat_t *categories; /* ->catspace[-CHAR_MIN] */
+ char *must; /* match must contain this string */
+ int moffset; /* latest point at which must may be located */
+ int *charjump; /* Boyer-Moore char jump table */
+ int *matchjump; /* Boyer-Moore match jump table */
+ int mlen; /* length of must */
+ size_t nsub; /* copy of re_nsub */
+ int backrefs; /* does it use back references? */
+ sopno nplus; /* how deep does it nest +s? */
+ /* catspace must be last */
+ cat_t catspace[1]; /* actually [NC] */
+};
+
+/* misc utilities */
+#define OUT (CHAR_MAX+1) /* a non-character value */
+#define ISWORD(c) (isalnum((uch)(c)) || (c) == '_')
diff --git a/newlib/libc/sys/linux/stdlib/regexec.c b/newlib/libc/sys/linux/stdlib/regexec.c
new file mode 100644
index 000000000..bb2882951
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/regexec.c
@@ -0,0 +1,182 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)regexec.c 8.3 (Berkeley) 3/20/94
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+
+/*
+ * the outer shell of regexec()
+ *
+ * This file includes engine.c *twice*, after muchos fiddling with the
+ * macros that code uses. This lets the same code operate on two different
+ * representations for state sets.
+ */
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include <ctype.h>
+#include <regex.h>
+
+#include "utils.h"
+#include "regex2.h"
+
+static int nope = 0; /* for use in asserts; shuts lint up */
+
+/* macros for manipulating states, small version */
+#define states long
+#define states1 states /* for later use in regexec() decision */
+#define CLEAR(v) ((v) = 0)
+#define SET0(v, n) ((v) &= ~((unsigned long)1 << (n)))
+#define SET1(v, n) ((v) |= (unsigned long)1 << (n))
+#define ISSET(v, n) (((v) & ((unsigned long)1 << (n))) != 0)
+#define ASSIGN(d, s) ((d) = (s))
+#define EQ(a, b) ((a) == (b))
+#define STATEVARS long dummy /* dummy version */
+#define STATESETUP(m, n) /* nothing */
+#define STATETEARDOWN(m) /* nothing */
+#define SETUP(v) ((v) = 0)
+#define onestate long
+#define INIT(o, n) ((o) = (unsigned long)1 << (n))
+#define INC(o) ((o) <<= 1)
+#define ISSTATEIN(v, o) (((v) & (o)) != 0)
+/* some abbreviations; note that some of these know variable names! */
+/* do "if I'm here, I can also be there" etc without branches */
+#define FWD(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) << (n))
+#define BACK(dst, src, n) ((dst) |= ((unsigned long)(src)&(here)) >> (n))
+#define ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
+/* function names */
+#define SNAMES /* engine.c looks after details */
+
+#include "engine.c"
+
+/* now undo things */
+#undef states
+#undef CLEAR
+#undef SET0
+#undef SET1
+#undef ISSET
+#undef ASSIGN
+#undef EQ
+#undef STATEVARS
+#undef STATESETUP
+#undef STATETEARDOWN
+#undef SETUP
+#undef onestate
+#undef INIT
+#undef INC
+#undef ISSTATEIN
+#undef FWD
+#undef BACK
+#undef ISSETBACK
+#undef SNAMES
+
+/* macros for manipulating states, large version */
+#define states char *
+#define CLEAR(v) memset(v, 0, m->g->nstates)
+#define SET0(v, n) ((v)[n] = 0)
+#define SET1(v, n) ((v)[n] = 1)
+#define ISSET(v, n) ((v)[n])
+#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
+#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
+#define STATEVARS long vn; char *space
+#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
+ if ((m)->space == NULL) return(REG_ESPACE); \
+ (m)->vn = 0; }
+#define STATETEARDOWN(m) { free((m)->space); }
+#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
+#define onestate long
+#define INIT(o, n) ((o) = (n))
+#define INC(o) ((o)++)
+#define ISSTATEIN(v, o) ((v)[o])
+/* some abbreviations; note that some of these know variable names! */
+/* do "if I'm here, I can also be there" etc without branches */
+#define FWD(dst, src, n) ((dst)[here+(n)] |= (src)[here])
+#define BACK(dst, src, n) ((dst)[here-(n)] |= (src)[here])
+#define ISSETBACK(v, n) ((v)[here - (n)])
+/* function names */
+#define LNAMES /* flag */
+
+#include "engine.c"
+
+/*
+ - regexec - interface for matching
+ = extern int regexec(const regex_t *, const char *, size_t, \
+ = regmatch_t [], int);
+ = #define REG_NOTBOL 00001
+ = #define REG_NOTEOL 00002
+ = #define REG_STARTEND 00004
+ = #define REG_TRACE 00400 // tracing of execution
+ = #define REG_LARGE 01000 // force large representation
+ = #define REG_BACKR 02000 // force use of backref code
+ *
+ * We put this here so we can exploit knowledge of the state representation
+ * when choosing which matcher to call. Also, by this point the matchers
+ * have been prototyped.
+ */
+int /* 0 success, REG_NOMATCH failure */
+regexec(preg, string, nmatch, pmatch, eflags)
+const regex_t *preg;
+const char *string;
+size_t nmatch;
+regmatch_t pmatch[];
+int eflags;
+{
+ struct re_guts *g = preg->re_g;
+#ifdef REDEBUG
+# define GOODFLAGS(f) (f)
+#else
+# define GOODFLAGS(f) ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
+#endif
+
+ if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
+ return(REG_BADPAT);
+ assert(!(g->iflags&BAD));
+ if (g->iflags&BAD) /* backstop for no-debug case */
+ return(REG_BADPAT);
+ eflags = GOODFLAGS(eflags);
+
+ if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
+ return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
+ else
+ return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
+}
diff --git a/newlib/libc/sys/linux/stdlib/regfree.c b/newlib/libc/sys/linux/stdlib/regfree.c
new file mode 100644
index 000000000..982d7f1d4
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/regfree.c
@@ -0,0 +1,86 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)regfree.c 8.3 (Berkeley) 3/20/94
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
+#endif /* LIBC_SCCS and not lint */
+#include <sys/cdefs.h>
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <regex.h>
+
+#include "utils.h"
+#include "regex2.h"
+
+/*
+ - regfree - free everything
+ = extern void regfree(regex_t *);
+ */
+void
+regfree(preg)
+regex_t *preg;
+{
+ struct re_guts *g;
+
+ if (preg->re_magic != MAGIC1) /* oops */
+ return; /* nice to complain, but hard */
+
+ g = preg->re_g;
+ if (g == NULL || g->magic != MAGIC2) /* oops again */
+ return;
+ preg->re_magic = 0; /* mark it invalid */
+ g->magic = 0; /* mark it invalid */
+
+ if (g->strip != NULL)
+ free((char *)g->strip);
+ if (g->sets != NULL)
+ free((char *)g->sets);
+ if (g->setbits != NULL)
+ free((char *)g->setbits);
+ if (g->must != NULL)
+ free(g->must);
+ if (g->charjump != NULL)
+ free(&g->charjump[CHAR_MIN]);
+ if (g->matchjump != NULL)
+ free(g->matchjump);
+ free((char *)g);
+}
diff --git a/newlib/libc/sys/linux/stdlib/utils.h b/newlib/libc/sys/linux/stdlib/utils.h
new file mode 100644
index 000000000..5439b6cd4
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/utils.h
@@ -0,0 +1,58 @@
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ * Copyright (c) 1992, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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.
+ *
+ * @(#)utils.h 8.3 (Berkeley) 3/20/94
+ * $FreeBSD: src/lib/libc/regex/utils.h,v 1.2 2002/03/22 23:41:56 obrien Exp $
+ */
+
+/* utility definitions */
+#define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */
+#define INFINITY (DUPMAX + 1)
+#define NC (CHAR_MAX - CHAR_MIN + 1)
+typedef unsigned char uch;
+
+/* switch off assertions (if not already off) if no REDEBUG */
+#ifndef REDEBUG
+#ifndef NDEBUG
+#define NDEBUG /* no assertions please */
+#endif
+#endif
+#include <assert.h>
+
+/* for old systems with bcopy() but no memmove() */
+#ifdef USEBCOPY
+#define memmove(d, s, c) bcopy(s, d, c)
+#endif
diff --git a/newlib/libc/sys/linux/stdlib/wordexp.c b/newlib/libc/sys/linux/stdlib/wordexp.c
new file mode 100644
index 000000000..3928b857e
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/wordexp.c
@@ -0,0 +1,186 @@
+/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <glob.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#include <wordexp.h>
+
+#define MAXLINELEN 500
+
+/* Note: This implementation of wordexp requires a version of bash
+ that supports the --wordexp and --protected arguments to be present
+ on the system. It does not support the WRDE_UNDEF flag. */
+int
+wordexp(const char *words, wordexp_t *pwordexp, int flags)
+{
+ FILE *f;
+ FILE *f_err;
+ char tmp[MAXLINELEN];
+ int i = 0;
+ int offs = 0;
+ char *iter;
+ pid_t pid;
+ int num_words = 0;
+ int num_bytes = 0;
+ int fd[2];
+ int fd_err[2];
+ int err = 0;
+
+ if (pwordexp == NULL)
+ {
+ return WRDE_NOSPACE;
+ }
+
+ if (flags & WRDE_REUSE)
+ wordfree(pwordexp);
+
+ if ((flags & WRDE_APPEND) == 0)
+ {
+ pwordexp->we_wordc = 0;
+ pwordexp->we_wordv = NULL;
+ }
+
+ if (flags & WRDE_DOOFFS)
+ {
+ offs = pwordexp->we_offs;
+
+ if(!(pwordexp->we_wordv = (char **)realloc(pwordexp->we_wordv, (pwordexp->we_wordc + offs + 1) * sizeof(char *))))
+ return WRDE_NOSPACE;
+
+ for (i = 0; i < offs; i++)
+ pwordexp->we_wordv[i] = NULL;
+ }
+
+ pipe(fd);
+ pipe(fd_err);
+ pid = fork();
+
+ if (pid > 0)
+ {
+ /* In parent process. */
+
+ /* Close write end of parent's pipe. */
+ close(fd[1]);
+ close(fd_err[1]);
+
+ /* f_err is the standard error from the shell command. */
+ f_err = fdopen(fd_err[0], "r");
+
+ /* Check for errors. */
+ if (fgets(tmp, MAXLINELEN, f_err))
+ {
+ if (strstr(tmp, "EOF"))
+ err = WRDE_SYNTAX;
+ else if (strstr(tmp, "`\n'") || strstr(tmp, "`|'")
+ || strstr(tmp, "`&'") || strstr(tmp, "`;'")
+ || strstr(tmp, "`<'") || strstr(tmp, "`>'")
+ || strstr(tmp, "`('") || strstr(tmp, "`)'")
+ || strstr(tmp, "`{'") || strstr(tmp, "`}'"))
+ err = WRDE_BADCHAR;
+ else if (strstr(tmp, "command substitution"))
+ err = WRDE_CMDSUB;
+ else
+ err = WRDE_SYNTAX;
+
+ if (flags & WRDE_SHOWERR)
+ {
+ fprintf(stderr, tmp);
+ while(fgets(tmp, MAXLINELEN, f_err))
+ fprintf(stderr, tmp);
+ }
+
+ return err;
+ }
+
+ /* f is the standard output from the shell command. */
+ f = fdopen(fd[0], "r");
+
+ /* Get number of words expanded by shell. */
+ fgets(tmp, MAXLINELEN, f);
+
+ if((iter = strchr(tmp, '\n')))
+ *iter = '\0';
+
+ num_words = atoi(tmp);
+
+ if(!(pwordexp->we_wordv = (char **)realloc(pwordexp->we_wordv,
+ (pwordexp->we_wordc + num_words + offs + 1) * sizeof(char *))))
+ return WRDE_NOSPACE;
+
+ /* Get number of bytes required for storage of num_words words. */
+ fgets(tmp, MAXLINELEN, f);
+
+ if((iter = strchr(tmp, '\n')))
+ *iter = '\0';
+
+ num_bytes = atoi(tmp) + pwordexp->we_wordc;
+
+ /* Get each expansion from the shell output, and store each in
+ pwordexp's we_wordv vector. */
+ for(i = 0; i < num_words; i++)
+ {
+ fgets(tmp, MAXLINELEN, f);
+
+ if((iter = strchr(tmp, '\n')))
+ *iter = '\0';
+
+ pwordexp->we_wordv[pwordexp->we_wordc + offs + i] = strdup(tmp);
+ }
+
+ pwordexp->we_wordv[pwordexp->we_wordc + offs + i] = NULL;
+ pwordexp->we_wordc += num_words;
+
+ close(fd[0]);
+ close(fd_err[0]);
+
+ /* Wait for child to finish. */
+ waitpid (pid, NULL, 0);
+
+ return WRDE_SUCCESS;
+ }
+ else
+ {
+ /* In child process. */
+
+ /* Close read end of child's pipe. */
+ close(fd[0]);
+ close(fd_err[0]);
+
+ /* Pipe standard output to parent process via fd. */
+ if (fd[1] != STDOUT_FILENO)
+ {
+ dup2(fd[1], STDOUT_FILENO);
+ /* fd[1] no longer required. */
+ close(fd[1]);
+ }
+
+ /* Pipe standard error to parent process via fd_err. */
+ if (fd_err[1] != STDERR_FILENO)
+ {
+ dup2(fd_err[1], STDERR_FILENO);
+ /* fd_err[1] no longer required. */
+ close(fd_err[1]);
+ }
+
+ if (flags & WRDE_NOCMD)
+ execl("/bin/bash", "bash", "--protected", "--wordexp", words, (char *)0);
+ else
+ execl("/bin/bash", "bash", "--wordexp", words, (char *)0);
+ }
+ return WRDE_SUCCESS;
+}
diff --git a/newlib/libc/sys/linux/stdlib/wordfree.c b/newlib/libc/sys/linux/stdlib/wordfree.c
new file mode 100644
index 000000000..1b6ee1e28
--- /dev/null
+++ b/newlib/libc/sys/linux/stdlib/wordfree.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software
+ * is freely granted, provided that this notice is preserved.
+ */
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <glob.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <wordexp.h>
+
+void
+wordfree(wordexp_t *pwordexp)
+{
+ int i;
+
+ if (pwordexp == NULL)
+ return;
+
+ if (pwordexp->we_wordv == NULL)
+ return;
+
+ for(i = 0; i < pwordexp->we_wordc; i++)
+ free(pwordexp->we_wordv[i]);
+
+ free(pwordexp->we_wordv);
+ pwordexp->we_wordv = NULL;
+}
diff --git a/newlib/libc/sys/linux/sys/ioctl.h b/newlib/libc/sys/linux/sys/ioctl.h
index f0e2741e9..12e0cd22d 100644
--- a/newlib/libc/sys/linux/sys/ioctl.h
+++ b/newlib/libc/sys/linux/sys/ioctl.h
@@ -6,8 +6,6 @@
#ifndef _SYS_IOCTL_H
#define _SYS_IOCTL_H
-#include <bits/ioctls.h>
-
int ioctl(int fd,int request,...);
#endif
diff --git a/newlib/libc/sys/linux/sys/socket.h b/newlib/libc/sys/linux/sys/socket.h
index 33097a5e8..b7a3dd1f1 100644
--- a/newlib/libc/sys/linux/sys/socket.h
+++ b/newlib/libc/sys/linux/sys/socket.h
@@ -120,69 +120,50 @@ struct accept_filter_arg {
*/
#define SOL_SOCKET 0xffff /* options for socket level */
-/* Protocol families. */
-#define PF_UNSPEC 0 /* Unspecified. */
-#define PF_LOCAL 1 /* Local to host (pipes and file-domain). */
-#define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */
-#define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */
-#define PF_INET 2 /* IP protocol family. */
-#define PF_AX25 3 /* Amateur Radio AX.25. */
-#define PF_IPX 4 /* Novell Internet Protocol. */
-#define PF_APPLETALK 5 /* Appletalk DDP. */
-#define PF_NETROM 6 /* Amateur radio NetROM. */
-#define PF_BRIDGE 7 /* Multiprotocol bridge. */
-#define PF_ATMPVC 8 /* ATM PVCs. */
-#define PF_X25 9 /* Reserved for X.25 project. */
-#define PF_INET6 10 /* IP version 6. */
-#define PF_ROSE 11 /* Amateur Radio X.25 PLP. */
-#define PF_DECnet 12 /* Reserved for DECnet project. */
-#define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */
-#define PF_SECURITY 14 /* Security callback pseudo AF. */
-#define PF_KEY 15 /* PF_KEY key management API. */
-#define PF_NETLINK 16
-#define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */
-#define PF_PACKET 17 /* Packet family. */
-#define PF_ASH 18 /* Ash. */
-#define PF_ECONET 19 /* Acorn Econet. */
-#define PF_ATMSVC 20 /* ATM SVCs. */
-#define PF_SNA 22 /* Linux SNA Project */
-#define PF_IRDA 23 /* IRDA sockets. */
-#define PF_PPPOX 24 /* PPPoX sockets. */
-#define PF_WANPIPE 25 /* Wanpipe API sockets. */
-#define PF_BLUETOOTH 31 /* Bluetooth sockets. */
-#define PF_MAX 32 /* For now.. */
-
-/* Address families. */
-#define AF_UNSPEC PF_UNSPEC
-#define AF_LOCAL PF_LOCAL
-#define AF_UNIX PF_UNIX
-#define AF_FILE PF_FILE
-#define AF_INET PF_INET
-#define AF_AX25 PF_AX25
-#define AF_IPX PF_IPX
-#define AF_APPLETALK PF_APPLETALK
-#define AF_NETROM PF_NETROM
-#define AF_BRIDGE PF_BRIDGE
-#define AF_ATMPVC PF_ATMPVC
-#define AF_X25 PF_X25
-#define AF_INET6 PF_INET6
-#define AF_ROSE PF_ROSE
-#define AF_DECnet PF_DECnet
-#define AF_NETBEUI PF_NETBEUI
-#define AF_SECURITY PF_SECURITY
-#define AF_KEY PF_KEY
-#define AF_NETLINK PF_NETLINK
-#define AF_ROUTE PF_ROUTE
-#define AF_PACKET PF_PACKET
-#define AF_ASH PF_ASH
-#define AF_ECONET PF_ECONET
-#define AF_ATMSVC PF_ATMSVC
-#define AF_SNA PF_SNA
-#define AF_IRDA PF_IRDA
-#define AF_PPPOX PF_PPPOX
-#define AF_WANPIPE PF_WANPIPE
-#define AF_BLUETOOTH PF_BLUETOOTH
-#define AF_MAX PF_MAX
+/*
+ * Address families.
+ */
+#define AF_UNSPEC 0 /* unspecified */
+#define AF_LOCAL 1 /* local to host (pipes, portals) */
+#define AF_UNIX AF_LOCAL /* backward compatibility */
+#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
+#define AF_IMPLINK 3 /* arpanet imp addresses */
+#define AF_PUP 4 /* pup protocols: e.g. BSP */
+#define AF_CHAOS 5 /* mit CHAOS protocols */
+#define AF_NS 6 /* XEROX NS protocols */
+#define AF_ISO 7 /* ISO protocols */
+#define AF_OSI AF_ISO
+#define AF_ECMA 8 /* European computer manufacturers */
+#define AF_DATAKIT 9 /* datakit protocols */
+#define AF_CCITT 10 /* CCITT protocols, X.25 etc */
+#define AF_SNA 11 /* IBM SNA */
+#define AF_DECnet 12 /* DECnet */
+#define AF_DLI 13 /* DEC Direct data link interface */
+#define AF_LAT 14 /* LAT */
+#define AF_HYLINK 15 /* NSC Hyperchannel */
+#define AF_APPLETALK 16 /* Apple Talk */
+#define AF_ROUTE 17 /* Internal Routing Protocol */
+#define AF_LINK 18 /* Link layer interface */
+#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */
+#define AF_COIP 20 /* connection-oriented IP, aka ST II */
+#define AF_CNT 21 /* Computer Network Technology */
+#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */
+#define AF_IPX 23 /* Novell Internet Protocol */
+#define AF_SIP 24 /* Simple Internet Protocol */
+#define pseudo_AF_PIP 25 /* Help Identify PIP packets */
+#define AF_ISDN 26 /* Integrated Services Digital Network*/
+#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */
+#define pseudo_AF_KEY 27 /* Internal key-management function */
+#define AF_INET6 28 /* IPv6 */
+#define AF_NATM 29 /* native ATM access */
+#define AF_ATM 30 /* ATM */
+#define pseudo_AF_HDRCMPLT 31 /* Used by BPF to not rewrite headers
+ * in interface output routine
+ */
+#define AF_NETGRAPH 32 /* Netgraph sockets */
+#define AF_SLOW 33 /* 802.3ad slow protocol */
+#define AF_SCLUSTER 34 /* Sitara cluster protocol */
+#define AF_MAX 35
/*
* Structure used by kernel to store most
@@ -221,6 +202,48 @@ struct sockaddr_storage {
};
/*
+ * Protocol families, same as address families for now.
+ */
+#define PF_UNSPEC AF_UNSPEC
+#define PF_LOCAL AF_LOCAL
+#define PF_UNIX PF_LOCAL /* backward compatibility */
+#define PF_INET AF_INET
+#define PF_IMPLINK AF_IMPLINK
+#define PF_PUP AF_PUP
+#define PF_CHAOS AF_CHAOS
+#define PF_NS AF_NS
+#define PF_ISO AF_ISO
+#define PF_OSI AF_ISO
+#define PF_ECMA AF_ECMA
+#define PF_DATAKIT AF_DATAKIT
+#define PF_CCITT AF_CCITT
+#define PF_SNA AF_SNA
+#define PF_DECnet AF_DECnet
+#define PF_DLI AF_DLI
+#define PF_LAT AF_LAT
+#define PF_HYLINK AF_HYLINK
+#define PF_APPLETALK AF_APPLETALK
+#define PF_ROUTE AF_ROUTE
+#define PF_LINK AF_LINK
+#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */
+#define PF_COIP AF_COIP
+#define PF_CNT AF_CNT
+#define PF_SIP AF_SIP
+#define PF_IPX AF_IPX /* same format as AF_NS */
+#define PF_RTIP pseudo_AF_RTIP /* same format as AF_INET */
+#define PF_PIP pseudo_AF_PIP
+#define PF_ISDN AF_ISDN
+#define PF_KEY pseudo_AF_KEY
+#define PF_INET6 AF_INET6
+#define PF_NATM AF_NATM
+#define PF_ATM AF_ATM
+#define PF_NETGRAPH AF_NETGRAPH
+#define PF_SLOW AF_SLOW
+#define PF_SCLUSTER AF_SCLUSTER
+
+#define PF_MAX AF_MAX
+
+/*
* Definitions for network related sysctl, CTL_NET.
*
* Second level is protocol family.
diff --git a/newlib/libc/sys/linux/sys/types.h b/newlib/libc/sys/linux/sys/types.h
index 8e674eff6..ba191f072 100644
--- a/newlib/libc/sys/linux/sys/types.h
+++ b/newlib/libc/sys/linux/sys/types.h
@@ -50,8 +50,6 @@
* libc/include/sys/types.h. Repeat those here and
* skip the kernel's definitions. */
-#define __need_size_t
-#include <stddef.h>
#include <sys/config.h>
#include <features.h>
#include <machine/types.h>
diff --git a/newlib/libc/sys/linux/sys/unistd.h b/newlib/libc/sys/linux/sys/unistd.h
index 18c70dd52..502fb473a 100644
--- a/newlib/libc/sys/linux/sys/unistd.h
+++ b/newlib/libc/sys/linux/sys/unistd.h
@@ -48,7 +48,6 @@ gid_t _EXFUN(getegid, (void ));
uid_t _EXFUN(geteuid, (void ));
gid_t _EXFUN(getgid, (void ));
int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] ));
-int _EXFUN(__gethostname, (char *__name, size_t __len));
char _EXFUN(*getlogin, (void ));
#if defined(_POSIX_THREAD_SAFE_FUNCTIONS)
int _EXFUN(getlogin_r, (char *name, size_t namesize) );
diff --git a/newlib/libc/sys/mmixware/isatty.c b/newlib/libc/sys/mmixware/isatty.c
index 1e1db6491..86729aa56 100644
--- a/newlib/libc/sys/mmixware/isatty.c
+++ b/newlib/libc/sys/mmixware/isatty.c
@@ -1,6 +1,6 @@
/* isatty for MMIXware.
- Copyright (C) 2001, 2008 Hans-Peter Nilsson
+ Copyright (C) 2001 Hans-Peter Nilsson
Permission to use, copy, modify, and distribute this software is
freely granted, provided that the above copyright notice, this notice
@@ -16,8 +16,8 @@
#include <sys/stat.h>
#include "sys/syscall.h"
-int
-_isatty (int fd)
+isatty (fd)
+ int fd;
{
return fd == 0 || fd == 1 || fd == 2;
}
diff --git a/newlib/libc/sys/sh/syscalls.c b/newlib/libc/sys/sh/syscalls.c
index 614b67e9e..f8ed7365f 100644
--- a/newlib/libc/sys/sh/syscalls.c
+++ b/newlib/libc/sys/sh/syscalls.c
@@ -99,13 +99,6 @@ isatty (fd)
return 1;
}
-_isatty (fd)
- int fd;
-{
- return 1;
-}
-
-
_exit (n)
{
return __trap34 (SYS_exit, n, 0, 0);
diff --git a/newlib/libc/sys/sysnecv850/crt0.S b/newlib/libc/sys/sysnecv850/crt0.S
index b319d30b7..e006871b3 100644
--- a/newlib/libc/sys/sysnecv850/crt0.S
+++ b/newlib/libc/sys/sysnecv850/crt0.S
@@ -60,13 +60,8 @@ _start:
jarl _main, r31
mov r10, r6
jarl _exit, r31
+
# endif
.section .stack
_stack: .long 1
-
- .section .data
- .global ___dso_handle
- .weak ___dso_handle
-___dso_handle:
- .long 0
diff --git a/newlib/libc/sys/sysnecv850/isatty.c b/newlib/libc/sys/sysnecv850/isatty.c
index 95d2c0e84..e5361559f 100644
--- a/newlib/libc/sys/sysnecv850/isatty.c
+++ b/newlib/libc/sys/sysnecv850/isatty.c
@@ -9,7 +9,7 @@ int __trap0 (int function, int p1, int p2, int p3);
#define TRAP0(f, p1, p2, p3) __trap0(f, (int)(p1), (int)(p2), (int)(p3))
-_isatty (fd)
+isatty (fd)
int fd;
{
return 1;
diff --git a/newlib/libc/syscalls/Makefile.am b/newlib/libc/syscalls/Makefile.am
index 7af406482..f6a6eda92 100644
--- a/newlib/libc/syscalls/Makefile.am
+++ b/newlib/libc/syscalls/Makefile.am
@@ -10,7 +10,6 @@ GENERAL_SOURCES = \
sysfstat.c \
sysgetpid.c \
sysgettod.c \
- sysisatty.c \
syskill.c \
syslink.c \
syslseek.c \
diff --git a/newlib/libc/syscalls/Makefile.in b/newlib/libc/syscalls/Makefile.in
index 5cc81bb10..31d153a79 100644
--- a/newlib/libc/syscalls/Makefile.in
+++ b/newlib/libc/syscalls/Makefile.in
@@ -46,7 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.m4 $(top_srcdir)/../acinclude.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/../confsubdir.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
@@ -57,12 +57,12 @@ lib_a_AR = $(AR) $(ARFLAGS)
lib_a_LIBADD =
am__objects_1 = lib_a-sysclose.$(OBJEXT) lib_a-sysfcntl.$(OBJEXT) \
lib_a-sysfstat.$(OBJEXT) lib_a-sysgetpid.$(OBJEXT) \
- lib_a-sysgettod.$(OBJEXT) lib_a-sysisatty.$(OBJEXT) \
- lib_a-syskill.$(OBJEXT) lib_a-syslink.$(OBJEXT) \
- lib_a-syslseek.$(OBJEXT) lib_a-sysopen.$(OBJEXT) \
- lib_a-sysread.$(OBJEXT) lib_a-syssbrk.$(OBJEXT) \
- lib_a-sysstat.$(OBJEXT) lib_a-systimes.$(OBJEXT) \
- lib_a-sysunlink.$(OBJEXT) lib_a-syswrite.$(OBJEXT)
+ lib_a-sysgettod.$(OBJEXT) lib_a-syskill.$(OBJEXT) \
+ lib_a-syslink.$(OBJEXT) lib_a-syslseek.$(OBJEXT) \
+ lib_a-sysopen.$(OBJEXT) lib_a-sysread.$(OBJEXT) \
+ lib_a-syssbrk.$(OBJEXT) lib_a-sysstat.$(OBJEXT) \
+ lib_a-systimes.$(OBJEXT) lib_a-sysunlink.$(OBJEXT) \
+ lib_a-syswrite.$(OBJEXT)
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@am__objects_2 = lib_a-sysexecve.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@ lib_a-sysfork.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@ lib_a-syswait.$(OBJEXT)
@@ -72,9 +72,9 @@ lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libsyscalls_la_LIBADD =
am__objects_3 = sysclose.lo sysfcntl.lo sysfstat.lo sysgetpid.lo \
- sysgettod.lo sysisatty.lo syskill.lo syslink.lo syslseek.lo \
- sysopen.lo sysread.lo syssbrk.lo sysstat.lo systimes.lo \
- sysunlink.lo syswrite.lo
+ sysgettod.lo syskill.lo syslink.lo syslseek.lo sysopen.lo \
+ sysread.lo syssbrk.lo sysstat.lo systimes.lo sysunlink.lo \
+ syswrite.lo
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@am__objects_4 = sysexecve.lo \
@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@ sysfork.lo syswait.lo
@USE_LIBTOOL_TRUE@am_libsyscalls_la_OBJECTS = $(am__objects_3) \
@@ -200,8 +200,15 @@ STRIP = @STRIP@
USE_LIBTOOL_FALSE = @USE_LIBTOOL_FALSE@
USE_LIBTOOL_TRUE = @USE_LIBTOOL_TRUE@
VERSION = @VERSION@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_AS = @ac_ct_AS@
ac_ct_CC = @ac_ct_CC@
+ac_ct_DLLTOOL = @ac_ct_DLLTOOL@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_ct_OBJDUMP = @ac_ct_OBJDUMP@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_READELF = @ac_ct_READELF@
+ac_ct_STRIP = @ac_ct_STRIP@
aext = @aext@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
@@ -217,9 +224,6 @@ build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
exec_prefix = @exec_prefix@
extra_dir = @extra_dir@
host = @host@
@@ -227,14 +231,12 @@ host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
-htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
libm_machine_dir = @libm_machine_dir@
-localedir = @localedir@
localstatedir = @localstatedir@
lpfx = @lpfx@
lt_ECHO = @lt_ECHO@
@@ -244,10 +246,8 @@ mkdir_p = @mkdir_p@
newlib_basedir = @newlib_basedir@
oext = @oext@
oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
-psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
subdirs = @subdirs@
@@ -262,7 +262,6 @@ GENERAL_SOURCES = \
sysfstat.c \
sysgetpid.c \
sysgettod.c \
- sysisatty.c \
syskill.c \
syslink.c \
syslseek.c \
@@ -391,12 +390,6 @@ lib_a-sysgettod.o: sysgettod.c
lib_a-sysgettod.obj: sysgettod.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sysgettod.obj `if test -f 'sysgettod.c'; then $(CYGPATH_W) 'sysgettod.c'; else $(CYGPATH_W) '$(srcdir)/sysgettod.c'; fi`
-lib_a-sysisatty.o: sysisatty.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sysisatty.o `test -f 'sysisatty.c' || echo '$(srcdir)/'`sysisatty.c
-
-lib_a-sysisatty.obj: sysisatty.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sysisatty.obj `if test -f 'sysisatty.c'; then $(CYGPATH_W) 'sysisatty.c'; else $(CYGPATH_W) '$(srcdir)/sysisatty.c'; fi`
-
lib_a-syskill.o: syskill.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-syskill.o `test -f 'syskill.c' || echo '$(srcdir)/'`syskill.c
diff --git a/newlib/libc/syscalls/sysclose.c b/newlib/libc/syscalls/sysclose.c
index d05d2866c..90f321fc0 100644
--- a/newlib/libc/syscalls/sysclose.c
+++ b/newlib/libc/syscalls/sysclose.c
@@ -6,5 +6,9 @@ int
_DEFUN (close, (fd),
int fd)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _close_r (_REENT, fd);
+#else
+ return _close (fd);
+#endif
}
diff --git a/newlib/libc/syscalls/sysexecve.c b/newlib/libc/syscalls/sysexecve.c
index 4917446a9..a43b47a0b 100644
--- a/newlib/libc/syscalls/sysexecve.c
+++ b/newlib/libc/syscalls/sysexecve.c
@@ -8,5 +8,9 @@ _DEFUN (execve, (name, argv, env),
char **argv _AND
char **env)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _execve_r (_REENT, name, argv, env);
+#else
+ return _execve (name, argv, env);
+#endif
}
diff --git a/newlib/libc/syscalls/sysfcntl.c b/newlib/libc/syscalls/sysfcntl.c
index 12d09a8af..5e6de7e77 100644
--- a/newlib/libc/syscalls/sysfcntl.c
+++ b/newlib/libc/syscalls/sysfcntl.c
@@ -11,7 +11,11 @@ _DEFUN (fcntl, (fd, flag, arg),
int arg)
{
#ifdef HAVE_FCNTL
+# ifdef REENTRANT_SYSCALLS_PROVIDED
return _fcntl_r (_REENT, fd, flag, arg);
+# else
+ return _fcntl (fd, flag, arg);
+# endif
#else /* !HAVE_FCNTL */
errno = ENOSYS;
return -1;
diff --git a/newlib/libc/syscalls/sysfork.c b/newlib/libc/syscalls/sysfork.c
index fd2839148..96d23c7dd 100644
--- a/newlib/libc/syscalls/sysfork.c
+++ b/newlib/libc/syscalls/sysfork.c
@@ -9,7 +9,11 @@
int
_DEFUN_VOID (fork)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _fork_r (_REENT);
+#else
+ return _fork ();
+#endif
}
#endif
diff --git a/newlib/libc/syscalls/sysfstat.c b/newlib/libc/syscalls/sysfstat.c
index 864c0ab9c..7d446e825 100644
--- a/newlib/libc/syscalls/sysfstat.c
+++ b/newlib/libc/syscalls/sysfstat.c
@@ -8,5 +8,9 @@ _DEFUN (fstat, (fd, pstat),
int fd _AND
struct stat *pstat)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _fstat_r (_REENT, fd, pstat);
+#else
+ return _fstat (fd, pstat);
+#endif
}
diff --git a/newlib/libc/syscalls/sysgetpid.c b/newlib/libc/syscalls/sysgetpid.c
index a7048acc7..794f5194b 100644
--- a/newlib/libc/syscalls/sysgetpid.c
+++ b/newlib/libc/syscalls/sysgetpid.c
@@ -5,5 +5,9 @@
int
_DEFUN_VOID (getpid)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _getpid_r (_REENT);
+#else
+ return _getpid ();
+#endif
}
diff --git a/newlib/libc/syscalls/sysgettod.c b/newlib/libc/syscalls/sysgettod.c
index 273d19e59..9208a30b9 100644
--- a/newlib/libc/syscalls/sysgettod.c
+++ b/newlib/libc/syscalls/sysgettod.c
@@ -12,5 +12,9 @@ _DEFUN (gettimeofday, (ptimeval, ptimezone),
struct timeval *ptimeval _AND
struct timezone *ptimezone)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _gettimeofday_r (_REENT, ptimeval, ptimezone);
+#else
+ return _gettimeofday (ptimeval, ptimezone);
+#endif
}
diff --git a/newlib/libc/syscalls/sysisatty.c b/newlib/libc/syscalls/sysisatty.c
deleted file mode 100644
index 5a6b8d455..000000000
--- a/newlib/libc/syscalls/sysisatty.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* connector for isatty */
-
-#include <reent.h>
-#include <unistd.h>
-
-int
-_DEFUN (isatty, (fd),
- int fd)
-{
-#ifdef REENTRANT_SYSCALLS_PROVIDED
- return _isatty_r (_REENT, fd);
-#else
- return _isatty (fd);
-#endif
-}
diff --git a/newlib/libc/syscalls/syskill.c b/newlib/libc/syscalls/syskill.c
index fb364f511..15cfecba8 100644
--- a/newlib/libc/syscalls/syskill.c
+++ b/newlib/libc/syscalls/syskill.c
@@ -7,5 +7,9 @@ _DEFUN (kill, (pid, sig),
int pid _AND
int sig)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _kill_r (_REENT, pid, sig);
+#else
+ return _kill (pid, sig);
+#endif
}
diff --git a/newlib/libc/syscalls/syslink.c b/newlib/libc/syscalls/syslink.c
index 841684f46..df235eeaa 100644
--- a/newlib/libc/syscalls/syslink.c
+++ b/newlib/libc/syscalls/syslink.c
@@ -7,5 +7,9 @@ _DEFUN (link, (old, new),
char *old _AND
char *new)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _link_r (_REENT, old, new);
+#else
+ return _link (old, new);
+#endif
}
diff --git a/newlib/libc/syscalls/syslseek.c b/newlib/libc/syscalls/syslseek.c
index 275d67ce4..a1722471c 100644
--- a/newlib/libc/syscalls/syslseek.c
+++ b/newlib/libc/syscalls/syslseek.c
@@ -9,5 +9,9 @@ _DEFUN (lseek, (fd, pos, whence),
off_t pos _AND
int whence)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _lseek_r (_REENT, fd, pos, whence);
+#else
+ return _lseek (fd, pos, whence);
+#endif
}
diff --git a/newlib/libc/syscalls/sysopen.c b/newlib/libc/syscalls/sysopen.c
index ed0cb604a..7e7df995f 100644
--- a/newlib/libc/syscalls/sysopen.c
+++ b/newlib/libc/syscalls/sysopen.c
@@ -18,7 +18,11 @@ _DEFUN (open, (file, flags, ...),
int ret;
va_start (ap, flags);
+#ifdef REENTRANT_SYSCALLS_PROVIDED
ret = _open_r (_REENT, file, flags, va_arg (ap, int));
+#else
+ ret = _open (file, flags, va_arg (ap, int));
+#endif
va_end (ap);
return ret;
}
@@ -31,7 +35,11 @@ open (file, flags, mode)
int flags;
int mode;
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _open_r (_REENT, file, flags, mode);
+#else
+ return _open (file, flags, mode);
+#endif
}
#endif /* ! _HAVE_STDC */
diff --git a/newlib/libc/syscalls/sysread.c b/newlib/libc/syscalls/sysread.c
index bcf002d9d..ae19f5b46 100644
--- a/newlib/libc/syscalls/sysread.c
+++ b/newlib/libc/syscalls/sysread.c
@@ -9,5 +9,9 @@ _DEFUN (read, (fd, buf, cnt),
void *buf _AND
size_t cnt)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _read_r (_REENT, fd, buf, cnt);
+#else
+ return _read (fd, buf, cnt);
+#endif
}
diff --git a/newlib/libc/syscalls/syssbrk.c b/newlib/libc/syscalls/syssbrk.c
index a3e550579..de368678e 100644
--- a/newlib/libc/syscalls/syssbrk.c
+++ b/newlib/libc/syscalls/syssbrk.c
@@ -10,5 +10,9 @@ void *
_DEFUN (sbrk, (incr),
ptrdiff_t incr)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _sbrk_r (_REENT, incr);
+#else
+ return _sbrk (incr);
+#endif
}
diff --git a/newlib/libc/syscalls/sysstat.c b/newlib/libc/syscalls/sysstat.c
index e93f61919..e2247dcf0 100644
--- a/newlib/libc/syscalls/sysstat.c
+++ b/newlib/libc/syscalls/sysstat.c
@@ -8,5 +8,9 @@ _DEFUN (stat, (file, pstat),
char *file _AND
struct stat *pstat)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _stat_r (_REENT, file, pstat);
+#else
+ return _stat (file, pstat);
+#endif
}
diff --git a/newlib/libc/syscalls/systimes.c b/newlib/libc/syscalls/systimes.c
index cc30a3e38..353553be7 100644
--- a/newlib/libc/syscalls/systimes.c
+++ b/newlib/libc/syscalls/systimes.c
@@ -7,5 +7,9 @@ clock_t
_DEFUN (times, (buf),
struct tms *buf)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _times_r (_REENT, buf);
+#else
+ return _times (buf);
+#endif
}
diff --git a/newlib/libc/syscalls/sysunlink.c b/newlib/libc/syscalls/sysunlink.c
index 1c5a69cfe..ac04184f2 100644
--- a/newlib/libc/syscalls/sysunlink.c
+++ b/newlib/libc/syscalls/sysunlink.c
@@ -6,5 +6,9 @@ int
_DEFUN (unlink, (file),
char *file)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _unlink_r (_REENT, file);
+#else
+ return _unlink (file);
+#endif
}
diff --git a/newlib/libc/syscalls/syswait.c b/newlib/libc/syscalls/syswait.c
index ec38a321f..355906c37 100644
--- a/newlib/libc/syscalls/syswait.c
+++ b/newlib/libc/syscalls/syswait.c
@@ -6,5 +6,9 @@ int
_DEFUN (wait, (status),
int *status)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _wait_r (_REENT, status);
+#else
+ return _wait (status);
+#endif
}
diff --git a/newlib/libc/syscalls/syswrite.c b/newlib/libc/syscalls/syswrite.c
index 0f080fb4d..089975958 100644
--- a/newlib/libc/syscalls/syswrite.c
+++ b/newlib/libc/syscalls/syswrite.c
@@ -9,5 +9,9 @@ _DEFUN (write, (fd, buf, cnt),
const void *buf _AND
size_t cnt)
{
+#ifdef REENTRANT_SYSCALLS_PROVIDED
return _write_r (_REENT, fd, buf, cnt);
+#else
+ return _write (fd, buf, cnt);
+#endif
}
diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c
index 938513233..0ee055cd0 100644
--- a/newlib/libc/time/mktime.c
+++ b/newlib/libc/time/mktime.c
@@ -9,8 +9,6 @@
* the fields of the structure are set to represent the specified calendar
* time. Returns the specified calendar time. If the calendar time can not be
* represented, returns the value (time_t) -1.
- *
- * Modifications: Fixed tm_isdst usage - 27 August 2008 Craig Howland.
*/
/*
@@ -159,7 +157,7 @@ mktime (tim_p)
{
time_t tim = 0;
long days = 0;
- int year, isdst, tm_isdst;
+ int year, isdst;
__tzinfo_type *tz = __gettzinfo ();
/* validate structure */
@@ -204,9 +202,7 @@ mktime (tim_p)
/* compute total seconds */
tim += (days * _SEC_IN_DAY);
- /* Convert user positive into 1 */
- tm_isdst = tim_p->tm_isdst > 0 ? 1 : tim_p->tm_isdst;
- isdst = tm_isdst;
+ isdst = tim_p->tm_isdst;
if (_daylight)
{
@@ -229,10 +225,8 @@ mktime (tim_p)
isdst = (tz->__tznorth
? (tim >= startdst_dst && tim < startstd_std)
: (tim >= startdst_dst || tim < startstd_std));
- /* if user committed and was wrong, perform correction, but not
- * if the user has given a negative value (which
- * asks mktime() to determine if DST is in effect or not) */
- if (tm_isdst >= 0 && (isdst ^ tm_isdst) == 1)
+ /* if user committed and was wrong, perform correction */
+ if ((isdst ^ tim_p->tm_isdst) == 1)
{
/* we either subtract or add the difference between
time zone offsets, depending on which way the user got it