Merge branch 'master' of /home/aggelos/devel/dfly/dfly.git/
authorAggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Mon, 8 Jun 2009 14:54:38 +0000 (17:54 +0300)
committerAggelos Economopoulos <aoiko@cc.ece.ntua.gr>
Mon, 8 Jun 2009 14:54:38 +0000 (17:54 +0300)
709 files changed:
Makefile.inc1
Makefile_upgrade.inc
contrib/ipfilter/ip_lfil.c
contrib/ipfilter/ipmon.c
contrib/ipfilter/ipsd/ipsdr.c
contrib/ipfilter/ipsd/sbpf.c
contrib/ipfilter/ipsd/slinux.c
contrib/ipfilter/ipsd/snit.c
contrib/ipfilter/ipsend/lsock.c
contrib/ipfilter/ipsend/sbpf.c
contrib/ipfilter/ipsend/slinux.c
contrib/ipfilter/ipsend/snit.c
contrib/ipfilter/ipsend/sock.c
contrib/tcp_wrappers/fix_options.c
etc/defaults/rc.conf
etc/rc.d/Makefile
etc/rc.d/atm2 [moved from etc/rc.d/atm2.sh with 97% similarity]
etc/rc.d/atm3 [moved from etc/rc.d/atm3.sh with 100% similarity]
etc/rc.d/diskless
etc/rc.d/rcconf [moved from etc/rc.d/rcconf.sh with 100% similarity]
etc/rc.d/sendmail
gnu/lib/gcc41/libstdc++/Makefile
gnu/usr.bin/cc34/cc_prep/config/dragonfly-spec.h
include/pthread.h
include/stdint.h
lib/libc/gen/Makefile.inc
lib/libc/gen/_pthread_stubs.c
lib/libc/gen/getobjformat.3
lib/libc/gen/pthread_fake.c [deleted file]
lib/libc/stdlib/malloc.3
lib/libc/stdlib/nmalloc.c
lib/libc/stdtime/localtime.c
lib/libc_r/uthread/uthread_init.c
lib/libfetch/Makefile
lib/libfetch/common.c
lib/libfetch/common.h
lib/libfetch/fetch.3
lib/libfetch/fetch.c
lib/libfetch/fetch.h
lib/libfetch/file.c
lib/libfetch/ftp.c
lib/libfetch/http.c
lib/libkvm/Makefile
lib/libkvm/kvm.c
lib/libkvm/kvm_amd64.c
lib/libkvm/kvm_i386.c
lib/libkvm/kvm_open.3
lib/libthread_xu/Makefile
libexec/rpc.rquotad/rquotad.c
nrelease/Makefile
sbin/camcontrol/camcontrol.c
sbin/camcontrol/modeedit.c
sbin/hammer/cmd_stats.c
sbin/hammer/hammer.8
share/examples/etc/README.examples
share/man/man4/aac.4
share/man/man4/acpi.4
share/man/man4/ath_hal.4
share/man/man4/smp.4
share/man/man5/Makefile
share/man/man5/host.conf.5 [deleted file]
share/man/man7/pkgsrc.7
share/man/man8/rc.sendmail.8
share/man/man9/Makefile
share/man/man9/nlookup.9
share/man/man9/syscall.9 [new file with mode: 0644]
share/misc/bsd-family-tree
share/zoneinfo/README
share/zoneinfo/Theory
share/zoneinfo/africa
share/zoneinfo/antarctica
share/zoneinfo/asia
share/zoneinfo/australasia
share/zoneinfo/backward
share/zoneinfo/etcetera
share/zoneinfo/europe
share/zoneinfo/factory
share/zoneinfo/iso3166.tab
share/zoneinfo/leapseconds
share/zoneinfo/northamerica
share/zoneinfo/southamerica
share/zoneinfo/systemv
share/zoneinfo/zone.tab
sys/boot/common/loader.8
sys/bus/cam/cam_ccb.h
sys/bus/cam/cam_periph.h
sys/bus/cam/cam_queue.c
sys/bus/cam/cam_xpt.c
sys/bus/cam/scsi/scsi_all.c
sys/bus/cam/scsi/scsi_all.h
sys/bus/cam/scsi/scsi_da.c
sys/bus/pci/pcidevs
sys/bus/pci/pcidevs.h
sys/bus/pci/pcidevs_data.h
sys/bus/pci/pcireg.h
sys/conf/files
sys/conf/kern.post.mk
sys/conf/kern.pre.mk
sys/conf/newvers.sh
sys/conf/options
sys/conf/subvers-DEVELOPMENT_2_1 [deleted file]
sys/conf/subvers-DEVELOPMENT_2_3
sys/config/LINT
sys/contrib/dev/ath/COPYRIGHT [deleted file]
sys/contrib/dev/ath/README [deleted file]
sys/contrib/dev/ath/ah_desc.h [deleted file]
sys/contrib/dev/ath/ah_soc.h [deleted file]
sys/contrib/dev/ath/public/amd64-elf.hal.o.uu [deleted file]
sys/contrib/dev/ath/public/amd64-elf.inc [deleted file]
sys/contrib/dev/ath/public/amd64-elf.opt_ah.h [deleted file]
sys/contrib/dev/ath/public/i386-elf.hal.o.uu [deleted file]
sys/contrib/dev/ath/public/i386-elf.inc [deleted file]
sys/contrib/dev/ath/public/i386-elf.opt_ah.h [deleted file]
sys/contrib/dev/ath/version.h [deleted file]
sys/cpu/amd64/include/int_const.h [new file with mode: 0644]
sys/cpu/amd64/include/int_limits.h [copied from sys/cpu/amd64/include/stdint.h with 58% similarity]
sys/cpu/amd64/include/stdint.h
sys/cpu/i386/include/int_const.h [new file with mode: 0644]
sys/cpu/i386/include/int_limits.h [copied from sys/cpu/i386/include/stdint.h with 57% similarity]
sys/cpu/i386/include/stdint.h
sys/dev/acpica5/Makefile
sys/dev/acpica5/acpi.c
sys/dev/acpica5/acpi_cpu.c
sys/dev/acpica5/acpi_cpu.h [copied from usr.bin/window/wwdata.c with 52% similarity]
sys/dev/acpica5/acpi_cpu_cstate.c [copied from sys/dev/acpica5/acpi_cpu.c with 86% similarity]
sys/dev/acpica5/acpi_cpu_pstate.c [new file with mode: 0644]
sys/dev/acpica5/acpi_cpu_pstate.h [copied from sys/platform/vkernel/include/cothread.h with 64% similarity]
sys/dev/acpica5/acpivar.h
sys/dev/disk/Makefile
sys/dev/disk/ahci/Makefile [new file with mode: 0644]
sys/dev/disk/ahci/TODO [new file with mode: 0644]
sys/dev/disk/ahci/ahci.c [new file with mode: 0644]
sys/dev/disk/ahci/ahci.h [new file with mode: 0644]
sys/dev/disk/ahci/ahci_attach.c [new file with mode: 0644]
sys/dev/disk/ahci/ahci_cam.c [new file with mode: 0644]
sys/dev/disk/ahci/ahci_dragonfly.c [new file with mode: 0644]
sys/dev/disk/ahci/ahci_dragonfly.h [copied from sys/platform/vkernel/include/cothread.h with 66% similarity]
sys/dev/disk/ahci/atascsi.h [new file with mode: 0644]
sys/dev/disk/nata/ata-queue.c
sys/dev/disk/nata/atapi-fd.c
sys/dev/drm/drmP.h
sys/dev/drm/drm_drv.c
sys/dev/drm/drm_pciids.h
sys/dev/drm/i915_drv.h
sys/dev/netif/ath/Makefile.inc
sys/dev/netif/ath/ath/Makefile
sys/dev/netif/ath/ath/if_ath.c
sys/dev/netif/ath/ath/if_ath_pci.c
sys/dev/netif/ath/ath/if_athvar.h
sys/dev/netif/ath/hal/Makefile
sys/dev/netif/ath/hal/ah_osdep.c
sys/dev/netif/ath/hal/ah_osdep.h
sys/dev/netif/ath/hal/ath_hal/ah.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah.h [moved from sys/contrib/dev/ath/ah.h with 69% similarity]
sys/dev/netif/ath/hal/ath_hal/ah_debug.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_decode.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_desc.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_devid.h [moved from sys/contrib/dev/ath/ah_devid.h with 53% similarity]
sys/dev/netif/ath/hal/ath_hal/ah_eeprom.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_eeprom_v1.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_eeprom_v1.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_eeprom_v14.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_eeprom_v14.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_eeprom_v3.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_eeprom_v3.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_internal.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_regdomain.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ah_soc.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_attach.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_beacon.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_interrupts.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_keycache.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_misc.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_phy.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_power.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_recv.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_reset.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210_xmit.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210desc.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210phy.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5210reg.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5210/ar5k_0007.ini [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_attach.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_beacon.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_interrupts.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_keycache.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_misc.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_phy.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_power.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_recv.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_reset.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211_xmit.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211desc.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211phy.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/ar5211reg.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5211/boss.ini [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar2316.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar2317.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar2413.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar2425.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5111.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5112.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212.ini [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_ani.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_attach.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_beacon.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_eeprom.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_gpio.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_interrupts.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_keycache.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_misc.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_phy.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_power.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_recv.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_reset.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_rfgain.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212_xmit.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212desc.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212phy.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5212reg.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5311reg.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5212/ar5413.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312_attach.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312_eeprom.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312_gpio.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312_interrupts.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312_misc.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312_power.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312_reset.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312phy.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5312reg.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5312/ar5315_gpio.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar2133.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416.ini [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_ani.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_attach.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_beacon.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal_adcdc.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal_adcgain.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal_iq.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_eeprom.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_gpio.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_interrupts.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_keycache.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_misc.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_phy.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_power.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_recv.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_reset.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_xmit.c [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416desc.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416phy.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416reg.h [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar9160.ini [new file with mode: 0644]
sys/dev/netif/ath/hal/ath_hal/ar5416/ar9160_attach.c [new file with mode: 0644]
sys/dev/netif/ath/rate_amrr/amrr.c
sys/dev/netif/ath/rate_onoe/onoe.c
sys/dev/netif/ath/rate_sample/Makefile
sys/dev/netif/ath/rate_sample/sample.c
sys/dev/raid/aac/aac.c
sys/dev/raid/aac/aacvar.h
sys/dev/usbmisc/ugensa/ugensa.c
sys/dev/usbmisc/umass/umass.c
sys/dev/video/fb/vga.c
sys/dev/virtual/cdrom/vcd.c
sys/dev/virtual/disk/vdisk.c
sys/dev/virtual/net/if_vke.c
sys/emulation/linux/linux_misc.c
sys/kern/kern_cputimer.c
sys/kern/kern_descrip.c
sys/kern/kern_exit.c
sys/kern/kern_intr.c
sys/kern/kern_kinfo.c
sys/kern/kern_usched.c
sys/kern/vfs_helper.c
sys/kern/vfs_nlookup.c
sys/kern/vfs_syscalls.c
sys/kern/vfs_vnops.c
sys/net/if_poll.c
sys/net/route.c
sys/net/rtsock.c
sys/net/tap/if_tap.c
sys/net/tap/if_tapvar.h
sys/netinet/ip_icmp.c
sys/netinet/tcp_subr.c
sys/netinet/tcp_syncache.c
sys/netinet/tcp_timer.c
sys/netinet/tcp_timer.h
sys/netinet/tcp_usrreq.c
sys/netproto/ipx/spx_debug.h
sys/platform/pc32/acpica5/acpi_pstate_machdep.c [new file with mode: 0644]
sys/platform/pc32/apic/apic_vector.s
sys/platform/pc32/apic/apicreg.h
sys/platform/pc32/apic/mpapic.c
sys/platform/pc32/conf/files
sys/platform/pc32/i386/busdma_machdep.c
sys/platform/pc32/i386/cpufreq_machdep.c [new file with mode: 0644]
sys/platform/pc32/i386/genassym.c
sys/platform/pc32/include/cpufreq.h [new file with mode: 0644]
sys/platform/pc32/isa/clock.c
sys/platform/pc64/amd64/busdma_machdep.c
sys/platform/pc64/amd64/exception.S
sys/platform/pc64/amd64/genassym.c
sys/platform/pc64/amd64/global.s
sys/platform/pc64/amd64/locore.s
sys/platform/pc64/amd64/machdep.c
sys/platform/pc64/amd64/pmap.c
sys/platform/pc64/amd64/support.s
sys/platform/pc64/amd64/swtch.s
sys/platform/pc64/amd64/vm_machdep.c
sys/platform/pc64/conf/files
sys/platform/pc64/conf/kern.mk
sys/platform/pc64/include/pmap.h
sys/platform/pc64/include/vmparam.h
sys/platform/pc64/isa/clock.c
sys/platform/vkernel/i386/cpu_regs.c
sys/platform/vkernel/i386/exception.c
sys/platform/vkernel/include/cothread.h
sys/platform/vkernel/platform/console.c
sys/platform/vkernel/platform/cothread.c
sys/platform/vkernel/platform/init.c
sys/platform/vkernel/platform/pmap.c
sys/platform/vkernel/platform/systimer.c
sys/sys/_pthreadtypes.h [new file with mode: 0644]
sys/sys/bus_dma.h
sys/sys/fcntl.h
sys/sys/nata.h
sys/sys/nlookup.h
sys/sys/spinlock2.h
sys/sys/systimer.h
sys/sys/systm.h
sys/sys/types.h
sys/sys/varsym.h
sys/sys/vmmeter.h
sys/sys/vnode.h
sys/vfs/gnu/ext2fs/ext2_vnops.c
sys/vfs/hammer/hammer.h
sys/vfs/hammer/hammer_blockmap.c
sys/vfs/hammer/hammer_btree.c
sys/vfs/hammer/hammer_cursor.h
sys/vfs/hammer/hammer_inode.c
sys/vfs/hammer/hammer_io.c
sys/vfs/hammer/hammer_object.c
sys/vfs/hammer/hammer_vnops.c
sys/vfs/hpfs/hpfs_vnops.c
sys/vfs/msdosfs/msdosfs_vnops.c
sys/vfs/nfs/nfs_serv.c
sys/vfs/nfs/nfs_subs.c
sys/vfs/nfs/nfs_vnops.c
sys/vfs/ntfs/ntfs_vnops.c
sys/vfs/nwfs/nwfs_vnops.c
sys/vfs/smbfs/smbfs_vnops.c
sys/vfs/udf/udf_vnops.c
sys/vfs/ufs/ufs_vnops.c
sys/vm/vm_contig.c
sys/vm/vm_meter.c
test/amd64/Makefile
test/vkernel/Makefile [new file with mode: 0644]
usr.bin/Makefile
usr.bin/crunch/COPYRIGHT [moved from usr.sbin/crunch/COPYRIGHT with 100% similarity]
usr.bin/crunch/Makefile [moved from usr.sbin/crunch/Makefile with 100% similarity]
usr.bin/crunch/Makefile.inc [new file with mode: 0644]
usr.bin/crunch/README [moved from usr.sbin/crunch/README with 100% similarity]
usr.bin/crunch/crunchgen/Makefile [moved from usr.sbin/crunch/crunchgen/Makefile with 100% similarity]
usr.bin/crunch/crunchgen/crunched_main.c [moved from usr.sbin/crunch/crunchgen/crunched_main.c with 99% similarity]
usr.bin/crunch/crunchgen/crunchgen.1 [moved from usr.sbin/crunch/crunchgen/crunchgen.1 with 100% similarity]
usr.bin/crunch/crunchgen/crunchgen.c [moved from usr.sbin/crunch/crunchgen/crunchgen.c with 99% similarity]
usr.bin/crunch/crunchgen/mkskel.sh [moved from usr.sbin/crunch/crunchgen/mkskel.sh with 100% similarity]
usr.bin/crunch/crunchide/Makefile [moved from usr.sbin/crunch/crunchide/Makefile with 100% similarity]
usr.bin/crunch/crunchide/crunchide.1 [moved from usr.sbin/crunch/crunchide/crunchide.1 with 100% similarity]
usr.bin/crunch/crunchide/crunchide.c [moved from usr.sbin/crunch/crunchide/crunchide.c with 100% similarity]
usr.bin/crunch/crunchide/exec_aout.c [moved from usr.sbin/crunch/crunchide/exec_aout.c with 99% similarity]
usr.bin/crunch/crunchide/exec_elf32.c [moved from usr.sbin/crunch/crunchide/exec_elf32.c with 99% similarity]
usr.bin/crunch/crunchide/exec_elf64.c [moved from usr.sbin/crunch/crunchide/exec_elf64.c with 99% similarity]
usr.bin/crunch/crunchide/extern.h [moved from usr.sbin/crunch/crunchide/extern.h with 100% similarity]
usr.bin/crunch/examples/Makefile [moved from usr.sbin/crunch/examples/Makefile with 100% similarity]
usr.bin/crunch/examples/filesystem.conf [moved from usr.sbin/crunch/examples/filesystem.conf with 100% similarity]
usr.bin/crunch/examples/fixit.conf [moved from usr.sbin/crunch/examples/fixit.conf with 98% similarity]
usr.bin/crunch/examples/kcopy.conf [moved from usr.sbin/crunch/examples/kcopy.conf with 100% similarity]
usr.bin/crunch/examples/really-big.conf [moved from usr.sbin/crunch/examples/really-big.conf with 98% similarity]
usr.bin/doscmd/Makefile
usr.bin/fetch/fetch.1
usr.bin/fetch/fetch.c
usr.bin/gzip/zuncompress.c
usr.bin/kdump/kdump.c
usr.bin/kenv/kenv.c
usr.bin/lex/Makefile
usr.bin/lex/Makefile.inc [new file with mode: 0644]
usr.bin/locate/Makefile.inc
usr.bin/locate/bigram/Makefile
usr.bin/locate/code/Makefile
usr.bin/locate/locate/Makefile
usr.bin/ncal/Makefile
usr.bin/ncal/ncal.1
usr.bin/ncal/ncal.c
usr.bin/netstat/Makefile
usr.bin/netstat/atalk.c
usr.bin/netstat/if.c
usr.bin/netstat/inet.c
usr.bin/netstat/inet6.c
usr.bin/netstat/ipsec.c
usr.bin/netstat/ipx.c
usr.bin/netstat/iso.c
usr.bin/netstat/main.c
usr.bin/netstat/mbuf.c
usr.bin/netstat/mroute.c
usr.bin/netstat/netgraph.c
usr.bin/netstat/netstat.h
usr.bin/netstat/route.c
usr.bin/objformat/objformat.1
usr.bin/objformat/objformat.c
usr.bin/pkg_radd/pkg_radd.sh
usr.bin/pkg_search/pkg_search.sh
usr.bin/pkill/pkill.c
usr.bin/systat/Makefile
usr.bin/systat/cmdtab.c
usr.bin/systat/extern.h
usr.bin/systat/vmmeter.c [new file with mode: 0644]
usr.bin/systat/vmstat.c
usr.bin/tip/Makefile.inc [new file with mode: 0644]
usr.bin/tip/libacu/Makefile
usr.bin/tip/libacu/v3451.c
usr.bin/tip/tip/Makefile
usr.bin/top/machine.c
usr.bin/undo/undo.c
usr.bin/vmstat/vmstat.c
usr.bin/window/Makefile
usr.bin/window/README
usr.bin/window/alias.h
usr.bin/window/char.c
usr.bin/window/char.h
usr.bin/window/cmd.c
usr.bin/window/cmd1.c
usr.bin/window/cmd2.c
usr.bin/window/cmd3.c
usr.bin/window/cmd4.c
usr.bin/window/cmd5.c
usr.bin/window/cmd6.c
usr.bin/window/cmd7.c
usr.bin/window/compress.c
usr.bin/window/context.c
usr.bin/window/context.h
usr.bin/window/defs.h
usr.bin/window/error.c
usr.bin/window/lcmd.c
usr.bin/window/lcmd.h
usr.bin/window/lcmd1.c
usr.bin/window/lcmd2.c
usr.bin/window/local.h
usr.bin/window/main.c
usr.bin/window/mloop.c
usr.bin/window/parser.h
usr.bin/window/parser1.c
usr.bin/window/parser2.c
usr.bin/window/parser3.c
usr.bin/window/parser4.c
usr.bin/window/parser5.c
usr.bin/window/scanner.c
usr.bin/window/startup.c
usr.bin/window/string.c
usr.bin/window/token.h
usr.bin/window/tt.h
usr.bin/window/ttf100.c
usr.bin/window/ttgeneric.c
usr.bin/window/tth19.c
usr.bin/window/tth29.c
usr.bin/window/ttinit.c
usr.bin/window/ttoutput.c
usr.bin/window/tttermcap.c
usr.bin/window/tttvi925.c
usr.bin/window/ttwyse60.c
usr.bin/window/ttwyse75.c
usr.bin/window/ttzapple.c
usr.bin/window/ttzentec.c
usr.bin/window/value.h
usr.bin/window/var.c
usr.bin/window/var.h
usr.bin/window/win.c
usr.bin/window/window.1
usr.bin/window/window_string.h [copied from usr.bin/window/wwend.c with 64% similarity]
usr.bin/window/windowrc
usr.bin/window/ww.h
usr.bin/window/wwadd.c
usr.bin/window/wwalloc.c
usr.bin/window/wwbox.c
usr.bin/window/wwchild.c
usr.bin/window/wwclose.c
usr.bin/window/wwclreol.c
usr.bin/window/wwclreos.c
usr.bin/window/wwcursor.c
usr.bin/window/wwdata.c
usr.bin/window/wwdelchar.c
usr.bin/window/wwdelete.c
usr.bin/window/wwdelline.c
usr.bin/window/wwdump.c
usr.bin/window/wwend.c
usr.bin/window/wwenviron.c
usr.bin/window/wwerror.c
usr.bin/window/wwflush.c
usr.bin/window/wwframe.c
usr.bin/window/wwgets.c
usr.bin/window/wwinit.c
usr.bin/window/wwinschar.c
usr.bin/window/wwinsline.c
usr.bin/window/wwiomux.c
usr.bin/window/wwlabel.c
usr.bin/window/wwmisc.c
usr.bin/window/wwmove.c
usr.bin/window/wwopen.c
usr.bin/window/wwprintf.c
usr.bin/window/wwpty.c
usr.bin/window/wwputc.c
usr.bin/window/wwputs.c
usr.bin/window/wwredraw.c
usr.bin/window/wwredrawwin.c
usr.bin/window/wwrint.c
usr.bin/window/wwscroll.c
usr.bin/window/wwsize.c
usr.bin/window/wwspawn.c
usr.bin/window/wwsuspend.c
usr.bin/window/wwterminfo.c
usr.bin/window/wwtty.c
usr.bin/window/wwunframe.c
usr.bin/window/wwupdate.c
usr.bin/window/wwwrite.c
usr.bin/window/xx.c
usr.bin/window/xx.h
usr.bin/window/xxflush.c
usr.bin/xlint/Makefile.inc [new file with mode: 0644]
usr.bin/xlint/lint1/Makefile
usr.bin/xlint/lint2/Makefile
usr.bin/xlint/xlint/Makefile
usr.sbin/802_11/Makefile.inc
usr.sbin/IPXrouted/Makefile
usr.sbin/Makefile
usr.sbin/Makefile.inc
usr.sbin/ac/Makefile
usr.sbin/accton/Makefile
usr.sbin/acpi/Makefile.inc
usr.sbin/acpi/acpidump/Makefile
usr.sbin/amd/Makefile.inc
usr.sbin/ancontrol/Makefile
usr.sbin/apm/Makefile
usr.sbin/apmd/Makefile
usr.sbin/arp/Makefile
usr.sbin/asf/asf.c
usr.sbin/atm/Makefile.inc
usr.sbin/atm/atmarpd/atmarpd.c
usr.sbin/atm/scspd/scspd.c
usr.sbin/authpf/Makefile
usr.sbin/battd/Makefile
usr.sbin/boot0cfg/Makefile
usr.sbin/bootparamd/Makefile.inc
usr.sbin/btconfig/Makefile
usr.sbin/bthcid/Makefile
usr.sbin/burncd/Makefile
usr.sbin/cdcontrol/Makefile
usr.sbin/chkgrp/Makefile
usr.sbin/chown/Makefile
usr.sbin/chroot/Makefile
usr.sbin/ckdist/Makefile
usr.sbin/clog/Makefile
usr.sbin/config/Makefile
usr.sbin/cron/Makefile.inc
usr.sbin/crunch/Makefile.inc [deleted file]
usr.sbin/daemon/Makefile
usr.sbin/dconschat/Makefile
usr.sbin/dev_mkdb/Makefile
usr.sbin/devinfo/Makefile
usr.sbin/dntpd/Makefile
usr.sbin/editmap/Makefile
usr.sbin/fdcontrol/Makefile
usr.sbin/fdformat/Makefile
usr.sbin/fdwrite/Makefile
usr.sbin/fwcontrol/Makefile
usr.sbin/gifconfig/Makefile
usr.sbin/i4b/Makefile.inc
usr.sbin/i4b/isdnd/log.c
usr.sbin/i4b/isdnmonitor/main.c
usr.sbin/ifmcstat/Makefile
usr.sbin/inetd/Makefile
usr.sbin/installer/Makefile.inc [new file with mode: 0644]
usr.sbin/installer/dfuibe_installer/Makefile
usr.sbin/installer/dfuibe_installer/flow.h
usr.sbin/installer/dfuibe_installer/fn_subpart_hammer.c
usr.sbin/installer/dfuibe_installer/fn_subpart_ufs.c [moved from usr.sbin/installer/dfuibe_installer/fn_subpart.c with 99% similarity]
usr.sbin/installer/dfuife_curses/Makefile
usr.sbin/installer/libdfui/encode.c
usr.sbin/iostat/Makefile
usr.sbin/ipftest/Makefile
usr.sbin/ipresend/Makefile
usr.sbin/ipsend/Makefile
usr.sbin/iptest/Makefile
usr.sbin/jail/Makefile
usr.sbin/jexec/Makefile
usr.sbin/jls/Makefile
usr.sbin/kbdcontrol/Makefile
usr.sbin/kbdmap/Makefile
usr.sbin/kernbb/Makefile
usr.sbin/kgmon/Makefile
usr.sbin/kgzip/Makefile
usr.sbin/lastlogin/Makefile
usr.sbin/lpr/filters.ru/Makefile.inc
usr.sbin/lpr/filters.ru/koi2855/koi2855.c
usr.sbin/lpr/filters.ru/koi2alt/koi2alt.c
usr.sbin/lptcontrol/Makefile
usr.sbin/mailstats/Makefile
usr.sbin/mailwrapper/Makefile
usr.sbin/makemap/Makefile
usr.sbin/makewhatis/Makefile
usr.sbin/makewhatis/makewhatis.c
usr.sbin/memcontrol/Makefile
usr.sbin/mixer/Makefile
usr.sbin/mld6query/Makefile
usr.sbin/mlxcontrol/Makefile
usr.sbin/moused/Makefile
usr.sbin/mptable/Makefile
usr.sbin/mrouted/Makefile.inc
usr.sbin/mrouted/kern.c
usr.sbin/mrouted/main.c
usr.sbin/mtest/Makefile
usr.sbin/mtree/Makefile
usr.sbin/named/Makefile
usr.sbin/ndiscvt/Makefile
usr.sbin/ndp/Makefile
usr.sbin/newsyslog/Makefile
usr.sbin/ngctl/Makefile
usr.sbin/nghook/Makefile
usr.sbin/nscd/Makefile
usr.sbin/nslookup/Makefile
usr.sbin/pciconf/Makefile
usr.sbin/pfctl/Makefile
usr.sbin/pnpinfo/Makefile
usr.sbin/pppd/Makefile
usr.sbin/pppstats/Makefile
usr.sbin/praliases/Makefile
usr.sbin/procctl/Makefile
usr.sbin/pwd_mkdb/Makefile
usr.sbin/quot/Makefile
usr.sbin/quotaon/Makefile
usr.sbin/rarpd/Makefile
usr.sbin/rdate/Makefile
usr.sbin/repquota/Makefile
usr.sbin/resident/Makefile
usr.sbin/resident/resident.c
usr.sbin/rip6query/Makefile
usr.sbin/rmt/Makefile
usr.sbin/rndc-confgen/Makefile
usr.sbin/rndc/Makefile
usr.sbin/rndcontrol/Makefile
usr.sbin/route6d/Makefile
usr.sbin/rpc.statd/Makefile
usr.sbin/rpc.umntall/Makefile
usr.sbin/rpc.ypupdated/Makefile
usr.sbin/rpc.ypxfrd/Makefile
usr.sbin/rpcbind/Makefile
usr.sbin/rrenumd/Makefile
usr.sbin/rtadvd/Makefile
usr.sbin/rtprio/Makefile
usr.sbin/rtsold/Makefile
usr.sbin/rwhod/Makefile
usr.sbin/sa/Makefile
usr.sbin/sdpd/Makefile
usr.sbin/sendmail/Makefile
usr.sbin/sensorsd/Makefile
usr.sbin/setkey/Makefile
usr.sbin/sgsc/Makefile
usr.sbin/sicontrol/Makefile
usr.sbin/sliplogin/Makefile
usr.sbin/slstat/Makefile
usr.sbin/spray/Makefile
usr.sbin/stallion/Makefile.inc
usr.sbin/tcpdchk/Makefile
usr.sbin/tcpdmatch/Makefile
usr.sbin/tcpdump/Makefile.inc
usr.sbin/timed/Makefile.inc [new file with mode: 0644]
usr.sbin/timed/timed/Makefile
usr.sbin/timed/timedc/Makefile
usr.sbin/traceroute/Makefile
usr.sbin/traceroute6/Makefile
usr.sbin/trpt/Makefile
usr.sbin/tzsetup/Makefile
usr.sbin/tzsetup/tzsetup.c
usr.sbin/usbd/Makefile
usr.sbin/usbdevs/Makefile
usr.sbin/vidcontrol/Makefile
usr.sbin/vipw/Makefile
usr.sbin/vknetd/Makefile
usr.sbin/vknetd/filter.c
usr.sbin/vknetd/vknetd.8
usr.sbin/vknetd/vknetd.c
usr.sbin/vnconfig/Makefile
usr.sbin/watch/Makefile
usr.sbin/xten/Makefile
usr.sbin/yp_mkdb/Makefile
usr.sbin/ypbind/Makefile
usr.sbin/yppoll/Makefile
usr.sbin/yppush/Makefile
usr.sbin/ypserv/Makefile
usr.sbin/ypset/Makefile
usr.sbin/zic/Makefile.inc
usr.sbin/zic/zdump.c

index 9b1bdac..ab4343e 100644 (file)
@@ -825,7 +825,7 @@ _btxld=     usr.sbin/btxld
 
 cross-tools:
 .for _tool in ${_btxld} ${_binutils} \
-             usr.bin/objformat usr.sbin/crunch/crunchide \
+             usr.bin/objformat usr.bin/crunch/crunchide \
              ${_gcc34_cross} ${_gcc41_cross}
        ${ECHODIR} "===> ${_tool} (cross-tools)"; \
                cd ${.CURDIR}/${_tool}; \
index 140754e..74af46a 100644 (file)
@@ -1107,3 +1107,10 @@ TO_REMOVE+=/usr/lib/gcc41/gcrt1.o
 TO_REMOVE+=/usr/lib/gcc41/crt1.o
 TO_REMOVE+=/usr/lib/gcc41/crti.o
 TO_REMOVE+=/usr/lib/gcc41/crtn.o
+TO_REMOVE+=/etc/rc.d/atm2.sh
+TO_REMOVE+=/etc/rc.d/atm3.sh
+TO_REMOVE+=/etc/rc.d/rcconf.sh
+TO_REMOVE+=/usr/share/man/cat9/namei.9.gz
+TO_REMOVE+=/usr/share/man/man9/namei.9.gz
+TO_REMOVE+=/usr/share/man/cat5/host.conf.5.gz
+TO_REMOVE+=/usr/share/man/man5/host.conf.5.gz
index 196d64e..a1fad99 100644 (file)
@@ -16,7 +16,7 @@ static const char rcsid[] = "@(#)$Id: ip_lfil.c,v 2.6.2.5 2002/10/03 13:47:19 da
 #include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <sys/socket.h>
 #ifndef        _KERNEL
 # include <stdio.h>
index f7e2865..aa5cf67 100644 (file)
@@ -29,7 +29,7 @@
 # if (__FreeBSD_version >= 300000)
 #  include <sys/dirent.h>
 # else
-#  include <sys/dir.h>
+#  include <sys/dirent.h>
 # endif
 #else
 # include <sys/filio.h>
index 298f655..6a6b6ee 100644 (file)
@@ -13,7 +13,7 @@
 #include <malloc.h>
 #include <netdb.h>
 #include <string.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <sys/socket.h>
index 97bb4ce..465ed6c 100644 (file)
@@ -20,7 +20,7 @@
 #if BSD < 199103
 #include <sys/fcntlcom.h>
 #endif
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <net/bpf.h>
 
 #include <net/if.h>
index 2c5aa97..af6cf5b 100644 (file)
@@ -19,7 +19,7 @@
 #include <sys/socket.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <linux/netdevice.h>
 #include <net/if.h>
 #include <netinet/in.h>
index ec7178f..eb7e65e 100644 (file)
@@ -21,7 +21,7 @@
 #include <sys/ioctl.h>
 #include <net/nit.h>
 #include <sys/fcntlcom.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <net/nit_if.h>
 #include <net/nit_pf.h>
 #include <net/nit_buf.h>
index 23a7621..1f2162c 100644 (file)
@@ -21,7 +21,7 @@ static const char rcsid[] = "@(#)$Id: lsock.c,v 2.1.4.3 2002/12/06 11:40:36 darr
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #define        __KERNEL__
 #if LINUX >= 0200
 # undef UINT_MAX
index 276ca07..7e4c911 100644 (file)
@@ -27,7 +27,7 @@
 #if (__FreeBSD_version >= 300000)
 # include <sys/dirent.h>
 #else
-# include <sys/dir.h>
+# include <sys/dirent.h>
 #endif
 #include <net/bpf.h>
 
index 7438d1c..e4308aa 100644 (file)
@@ -16,7 +16,7 @@
 #include <sys/socket.h>
 #include <sys/file.h>
 #include <sys/ioctl.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <linux/netdevice.h>
 #include <net/if.h>
 #include <netinet/in.h>
index 6f2c662..5e60522 100644 (file)
@@ -17,7 +17,7 @@
 #include <sys/ioctl.h>
 #include <net/nit.h>
 #include <sys/fcntlcom.h>
-#include <sys/dir.h>
+#include <sys/dirent.h>
 #include <net/nit_if.h>
 #include <net/nit_pf.h>
 #include <net/nit_buf.h>
index 4d72d87..313f36a 100644 (file)
@@ -24,7 +24,7 @@
 #if (__FreeBSD_version >= 300000)
 # include <sys/dirent.h>
 #else
-# include <sys/dir.h>
+# include <sys/dirent.h>
 #endif
 #define _KERNEL
 #define        KERNEL
index 9e6769b..7a5de68 100644 (file)
@@ -35,6 +35,7 @@ static char sccsid[] = "@(#) fix_options.c 1.6 97/04/08 02:29:19";
 
 /* fix_options - get rid of IP-level socket options */
 
+void
 fix_options(request)
 struct request_info *request;
 {
index 0f7895b..625ef42 100644 (file)
@@ -391,6 +391,7 @@ sendmail_outbound_flags="-L sm-queue -q30m" # Flags to sendmail (outbound only)
 sendmail_msp_queue_enable="YES"        # Dequeue stuck clientmqueue mail (YES/NO).
 sendmail_msp_queue_flags="-L sm-msp-queue -Ac -q30m"
                                # Flags for sendmail_msp_queue daemon.
+sendmail_rebuild_aliases="YES" # Run newaliases if necessary (YES/NO).
 
 
 ##############################################################
index 7a0f6d4..91e70f5 100644 (file)
@@ -7,7 +7,7 @@
 # note: bgfsk, devfs, and lomac left out (from 5.0)
 #
 FILES= DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz \
-       amd apm apmd atm1 atm2.sh atm3.sh \
+       amd apm apmd atm1 atm2 atm3 \
        battd bootconf bootparams btconfig bthcid ccd cleanvar \
        cleartmp cron devd dhclient diskless dmesg dumpon \
        fsck ftpd hostapd hostname \
@@ -20,7 +20,7 @@ FILES=        DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz \
        named netif netoptions newsyslog \
        network_ipv6 nfsclient nfsd nfsserver nisdomain nscd nsswitch \
        dntpd othermta pf pflog ppp ppp-user pppoed pwcheck \
-       quota random rarpd rcconf.sh resident rndcontrol root route6d routed \
+       quota random rarpd rcconf resident rndcontrol root route6d routed \
        routing rpcbind rtadvd rtsold rwho sysdb savecore sdpd securelevel \
        sendmail sensorsd serial sppp sshd statd swap1 syscons sysctl syslogd \
        timed ttys usbd varsym vinum virecover watchdogd wpa_supplicant \
similarity index 97%
rename from etc/rc.d/atm2.sh
rename to etc/rc.d/atm2
index 124e85d..c9e7448 100644 (file)
@@ -88,7 +88,7 @@ atm2_start()
                done
        fi
 
-       # XXX - required by atm3.sh. I don't like having one script depend
+       # XXX - required by atm3. I don't like having one script depend
        #       on variables in another script (especially in a dynamic
        #       ordered system like this), but it's necessary for the moment.
        #
similarity index 100%
rename from etc/rc.d/atm3.sh
rename to etc/rc.d/atm3
index 9406e79..9ea8804 100644 (file)
@@ -107,11 +107,6 @@ fi
 echo "+++ create lastlog"
 /usr/bin/touch /var/log/lastlog
 
-# Make sure our aliases database is uptodate, the aliases may have
-# been overridden in /conf.
-#
-/usr/bin/newaliases
-
 # XXX make sure to create one dir for each printer as requested by lpd
 #
 # If we do not have a writable /tmp, create a memory
similarity index 100%
rename from etc/rc.d/rcconf.sh
rename to etc/rc.d/rcconf
index 492e1f9..4f492ee 100644 (file)
@@ -18,6 +18,7 @@
 name="sendmail"
 rcvar=`set_rcvar`
 required_files="/etc/mail/${name}.cf"
+start_precmd="sendmail_precmd"
 command=${sendmail_program:-/usr/sbin/sendmail}
 pidfile=${sendmail_pidfile:-/var/run/sendmail.pid}
 load_rc_config $name
@@ -44,16 +45,18 @@ sendmail_precmd()
        fi
 
        # check modifications on /etc/mail/aliases
-       if [ -f "/etc/mail/aliases.db" ]; then
-               if [ "/etc/mail/aliases" -nt "/etc/mail/aliases.db" ]; then
-                       echo \
+       if checkyesno sendmail_rebuild_aliases; then
+               if [ -f "/etc/mail/aliases.db" ]; then
+                       if [ "/etc/mail/aliases" -nt "/etc/mail/aliases.db" ]; then
+                               echo \
            "${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating"
-                       /usr/bin/newaliases
-               fi
-       else
-               echo \
+                               /usr/bin/newaliases
+                       fi
+               else
+                       echo \
            "${name}: /etc/mail/aliases.db not present, generating"
-                       /usr/bin/newaliases
+                               /usr/bin/newaliases
+               fi
        fi
 
        # check couple of common db files, too
index d54f5b8..bafe045 100644 (file)
@@ -456,25 +456,29 @@ THRHDRS=  gthr.h gthr-single.h gthr-posix.h gthr-default.h
 THRHDRSDIR=    ${INCLUDEDIR}/c++/4.1/bits
 
 gthr.h: ${GCCDIR}/gcc/gthr.h
-       sed -e '/^#/s/\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*\)/_GLIBCPP_\1/g' \
+       sed -e '/^#pragma/b' \
+           -e '/^#/s/\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*\)/_GLIBCXX_\1/g' \
+           -e 's/_GLIBCXX_SUPPORTS_WEAK/__GXX_WEAK__/g' \
            -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
            < ${GCCDIR}/gcc/gthr.h > gthr.h
 
 gthr-single.h: ${GCCDIR}/gcc/gthr-single.h
-       sed -e 's/\(UNUSED\)/_GLIBCPP_\1/g' \
-           -e 's/\(GCC[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*_H\)/_GLIBCPP_\1/g' \
+       sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+           -e 's/\(GCC[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*_H\)/_GLIBCXX_\1/g' \
            < ${GCCDIR}/gcc/gthr-single.h > gthr-single.h
 
 gthr-posix.h: ${GCCDIR}/gcc/gthr-posix.h
-       sed -e 's/\(UNUSED\)/_GLIBCPP_\1/g' \
-           -e 's/\(GCC[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*_H\)/_GLIBCPP_\1/g' \
-           -e 's/\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*WEAK\)/_GLIBCPP_\1/g' \
+       sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+           -e 's/\(GCC[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*_H\)/_GLIBCXX_\1/g' \
+           -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+           -e 's/\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*USE_WEAK\)/_GLIBCXX_\1/g' \
            < ${GCCDIR}/gcc/gthr-posix.h > gthr-posix.h
 
 gthr-default.h: ${GCCDIR}/gcc/gthr-posix.h
-       sed -e 's/\(UNUSED\)/_GLIBCPP_\1/g' \
-           -e 's/\(GCC[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*_H\)/_GLIBCPP_\1/g' \
-           -e 's/\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*WEAK\)/_GLIBCPP_\1/g' \
+       sed -e 's/\(UNUSED\)/_GLIBCXX_\1/g' \
+           -e 's/\(GCC[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*_H\)/_GLIBCXX_\1/g' \
+           -e 's/SUPPORTS_WEAK/__GXX_WEAK__/g' \
+           -e 's/\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]*USE_WEAK\)/_GLIBCXX_\1/g' \
            -e 's,^#include "\(.*\)",#include <bits/\1>,g' \
            < ${GCCDIR}/gcc/gthr-posix.h > gthr-default.h
 
index 0b0b208..c2cfe6a 100644 (file)
@@ -116,7 +116,7 @@ Boston, MA 02111-1307, USA.  */
 
 /* Provide a LIB_SPEC appropriate for DragonFly.  Just select the appropriate
    libc, depending on whether we're doing profiling or need threads support.
-   (simular to the default, except no -lg, and no -p).  */
+   (similar to the default, except no -lg, and no -p).  */
 
 #ifdef DFBSD_NO_THREADS
 #define DFBSD_LIB_SPEC "                                               \
index b623804..9d0f06e 100644 (file)
 #define PTHREAD_CANCELED               ((void *) 1)
 
 /*
- * Forward structure definitions.
- *
- * These are mostly opaque to the user.
- */
-struct pthread;
-struct pthread_attr;
-struct pthread_cond;
-struct pthread_cond_attr;
-struct pthread_mutex;
-struct pthread_mutex_attr;
-struct pthread_once;
-struct pthread_rwlock;
-struct pthread_rwlockattr;
-struct pthread_barrier;
-struct pthread_barrier_attr;
-
-/*
- * Primitive system data type definitions required by P1003.1c.
- *
- * Note that P1003.1c specifies that there are no defined comparison
- * or assignment operators for the types pthread_attr_t, pthread_cond_t,
- * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
- */
-typedef struct pthread                 *pthread_t;
-typedef struct pthread_attr            *pthread_attr_t;
-typedef struct pthread_mutex           *pthread_mutex_t;
-typedef struct pthread_mutex_attr      *pthread_mutexattr_t;
-typedef struct pthread_cond            *pthread_cond_t;
-typedef struct pthread_cond_attr       *pthread_condattr_t;
-typedef int                            pthread_key_t;
-typedef struct pthread_once            pthread_once_t;
-typedef struct pthread_rwlock          *pthread_rwlock_t;
-typedef struct pthread_rwlockattr      *pthread_rwlockattr_t;
-typedef struct pthread_barrier         *pthread_barrier_t;
-typedef struct pthread_barrierattr     *pthread_barrierattr_t;
-
-/*
- * Additional type definitions:
- *
- * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
- * use in header symbols.
- */
-typedef void   *pthread_addr_t;
-typedef void   *(*pthread_startroutine_t) (void *);
-
-/*
- * Once definitions.
- */
-struct pthread_once {
-       int             state;
-       pthread_mutex_t mutex;
-};
-
-/*
  * Flags for once initialization.
  */
 #define PTHREAD_NEEDS_INIT  0
index 7965785..d489f9f 100644 (file)
@@ -69,5 +69,13 @@ typedef __uint_least16_t     uint_least16_t;
 typedef __uint_least32_t       uint_least32_t;
 typedef __uint_least64_t       uint_least64_t;
 
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
+#include <machine/int_const.h>
+#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#include <machine/int_limits.h>
+#endif
+
 #endif
 
index 2d7f76b..ec0a7fe 100644 (file)
@@ -24,7 +24,7 @@ SRCS+=  _pthread_stubs.c _rand48.c _spinlock_stub.c _thread_init.c \
        msgget.c msgrcv.c msgsnd.c nftw.c nice.c \
        nlist.c nrand48.c ntp_gettime.c opendir.c \
        pause.c pmadvise.c popen.c posix_spawn.c posixshm.c \
-       psignal.c pthread_fake.c pw_scan.c pwcache.c \
+       psignal.c pw_scan.c pwcache.c \
        raise.c readdir.c readpassphrase.c rewinddir.c \
        scandir.c seed48.c seekdir.c semconfig.c semctl.c semget.c semop.c \
        setdomainname.c sethostname.c setjmperr.c setmode.c setprogname.c \
index 5c6ae7b..6a191a6 100644 (file)
  * $DragonFly: src/lib/libc/gen/_pthread_stubs.c,v 1.4 2005/05/09 12:43:40 davidxu Exp $
  */
 
-#include <signal.h>
-#include <pthread.h>
-#include <pthread_np.h>
-
-int    _pthread_cond_init_stub(pthread_cond_t *, const pthread_condattr_t *);
-int    _pthread_cond_signal_stub(pthread_cond_t *);
-int    _pthread_cond_wait_stub(pthread_cond_t *, pthread_mutex_t *);
-void   *_pthread_getspecific_stub(pthread_key_t);
-int    _pthread_key_create_stub(pthread_key_t *, void (*)(void *));
-int    _pthread_key_delete_stub(pthread_key_t);
-int    _pthread_main_np_stub(void);
-int    _pthread_mutex_destroy_stub(pthread_mutex_t *);
-int    _pthread_mutex_init_stub(pthread_mutex_t *,
-                                const pthread_mutexattr_t *);
-int    _pthread_mutex_lock_stub(pthread_mutex_t *);
-int    _pthread_mutex_trylock_stub(pthread_mutex_t *);
-int    _pthread_mutex_unlock_stub(pthread_mutex_t *);
-int    _pthread_mutexattr_init_stub(pthread_mutexattr_t *);
-int    _pthread_mutexattr_destroy_stub(pthread_mutexattr_t *);
-int    _pthread_mutexattr_settype_stub(pthread_mutexattr_t *, int);
-int    _pthread_once_stub(pthread_once_t *, void (*)(void));
-int    _pthread_rwlock_init_stub(pthread_rwlock_t *,
-                                 const pthread_rwlockattr_t *);
-int    _pthread_rwlock_destroy_stub(pthread_rwlock_t *);
-int    _pthread_rwlock_rdlock_stub(pthread_rwlock_t *);
-int    _pthread_rwlock_tryrdlock_stub(pthread_rwlock_t *);
-int    _pthread_rwlock_trywrlock_stub(pthread_rwlock_t *);
-int    _pthread_rwlock_unlock_stub(pthread_rwlock_t *);
-int    _pthread_rwlock_wrlock_stub(pthread_rwlock_t *);
-int    _pthread_setspecific_stub(pthread_key_t, const void *);
-int    _pthread_sigmask_stub(int, const sigset_t *, sigset_t *);
-
-/* define a null pthread structure just to satisfy _pthread_self */
-struct pthread {
-};
-
-static struct pthread main_thread;
+#include <sys/cdefs.h>
+#include <stdlib.h>
 
 /*
  * Weak symbols: All libc internal usage of these functions should
@@ -74,192 +39,152 @@ static struct pthread main_thread;
  * between application locks and libc locks (threads holding the
  * latter can't be allowed to exit/terminate).
  */
-__weak_reference(_pthread_cond_init_stub,      _pthread_cond_init);
-__weak_reference(_pthread_cond_signal_stub,    _pthread_cond_signal);
-__weak_reference(_pthread_cond_wait_stub,      _pthread_cond_wait);
-__weak_reference(_pthread_getspecific_stub,    _pthread_getspecific);
-__weak_reference(_pthread_key_create_stub,     _pthread_key_create);
-__weak_reference(_pthread_key_delete_stub,     _pthread_key_delete);
-__weak_reference(_pthread_main_np_stub,                _pthread_main_np);
-__weak_reference(_pthread_mutex_destroy_stub,  _pthread_mutex_destroy);
-__weak_reference(_pthread_mutex_init_stub,     _pthread_mutex_init);
-__weak_reference(_pthread_mutex_lock_stub,     _pthread_mutex_lock);
-__weak_reference(_pthread_mutex_trylock_stub,  _pthread_mutex_trylock);
-__weak_reference(_pthread_mutex_unlock_stub,   _pthread_mutex_unlock);
-__weak_reference(_pthread_mutexattr_init_stub, _pthread_mutexattr_init);
-__weak_reference(_pthread_mutexattr_destroy_stub, _pthread_mutexattr_destroy);
-__weak_reference(_pthread_mutexattr_settype_stub, _pthread_mutexattr_settype);
-__weak_reference(_pthread_once_stub,           _pthread_once);
-__weak_reference(_pthread_self_stub,           _pthread_self);
-__weak_reference(_pthread_rwlock_init_stub,    _pthread_rwlock_init);
-__weak_reference(_pthread_rwlock_rdlock_stub,  _pthread_rwlock_rdlock);
-__weak_reference(_pthread_rwlock_tryrdlock_stub, _pthread_rwlock_tryrdlock);
-__weak_reference(_pthread_rwlock_trywrlock_stub, _pthread_rwlock_trywrlock);
-__weak_reference(_pthread_rwlock_unlock_stub,  _pthread_rwlock_unlock);
-__weak_reference(_pthread_rwlock_wrlock_stub,  _pthread_rwlock_wrlock);
-__weak_reference(_pthread_setspecific_stub,    _pthread_setspecific);
-__weak_reference(_pthread_sigmask_stub,                _pthread_sigmask);
-
-int
-_pthread_cond_init_stub(pthread_cond_t *cond __unused,
-                       const pthread_condattr_t *cond_attr __unused)
-{
-       return (0);
-}
-
-int
-_pthread_cond_signal_stub(pthread_cond_t *cond __unused)
-{
-       return (0);
-}
 
-int
-_pthread_cond_wait_stub(pthread_cond_t *cond __unused,
-                       pthread_mutex_t *mutex __unused)
-{
-       return (0);
-}
-
-void *
-_pthread_getspecific_stub(pthread_key_t key __unused)
+#define WR(f, n)                       \
+    __weak_reference(f, _ ## n);       \
+    __weak_reference(f, n)
+
+
+WR(stub_zero, pthread_atfork);
+WR(stub_zero, pthread_attr_destroy);
+WR(stub_zero, pthread_attr_get_np);
+WR(stub_zero, pthread_attr_getdetachstate);
+WR(stub_zero, pthread_attr_getinheritsched);
+WR(stub_zero, pthread_attr_getschedparam);
+WR(stub_zero, pthread_attr_getschedpolicy);
+WR(stub_zero, pthread_attr_getscope);
+WR(stub_zero, pthread_attr_getstack);
+WR(stub_zero, pthread_attr_getstackaddr);
+WR(stub_zero, pthread_attr_getstacksize);
+WR(stub_zero, pthread_attr_init);
+WR(stub_zero, pthread_attr_setcreatesuspend_np);
+WR(stub_zero, pthread_attr_setdetachstate);
+WR(stub_zero, pthread_attr_setinheritsched);
+WR(stub_zero, pthread_attr_setschedparam);
+WR(stub_zero, pthread_attr_setschedpolicy);
+WR(stub_zero, pthread_attr_setscope);
+WR(stub_zero, pthread_attr_setstack);
+WR(stub_zero, pthread_attr_setstackaddr);
+WR(stub_zero, pthread_attr_setstacksize);
+WR(stub_zero, pthread_cancel);
+WR(stub_zero, pthread_cleanup_pop);
+WR(stub_zero, pthread_cleanup_push);
+WR(stub_zero, pthread_cond_broadcast);
+WR(stub_zero, pthread_cond_destroy);
+WR(stub_zero, pthread_cond_init);
+WR(stub_zero, pthread_cond_signal);
+WR(stub_zero, pthread_cond_timedwait);
+WR(stub_zero, pthread_cond_wait);
+WR(stub_zero, pthread_condattr_destroy);
+WR(stub_zero, pthread_condattr_init);
+WR(stub_zero, pthread_detach);
+WR(stub_true, pthread_equal);
+WR(stub_exit, pthread_exit);
+WR(stub_zero, pthread_getconcurrency);
+WR(stub_zero, pthread_getprio);
+WR(stub_zero, pthread_getschedparam);
+WR(stub_null, pthread_getspecific);
+WR(stub_zero, pthread_join);
+WR(stub_zero, pthread_key_create);
+WR(stub_zero, pthread_key_delete);
+WR(stub_zero, pthread_kill);
+WR(stub_main, pthread_main_np);
+WR(stub_zero, pthread_multi_np);
+WR(stub_zero, pthread_mutex_destroy);
+WR(stub_zero, pthread_mutex_getprioceiling);
+WR(stub_zero, pthread_mutex_init);
+WR(stub_zero, pthread_mutex_lock);
+WR(stub_zero, pthread_mutex_setprioceiling);
+WR(stub_zero, pthread_mutex_trylock);
+WR(stub_zero, pthread_mutex_unlock);
+WR(stub_zero, pthread_mutexattr_destroy);
+WR(stub_zero, pthread_mutexattr_getkind_np);
+WR(stub_zero, pthread_mutexattr_getprioceiling);
+WR(stub_zero, pthread_mutexattr_getprotocol);
+WR(stub_zero, pthread_mutexattr_getpshared);
+WR(stub_zero, pthread_mutexattr_gettype);
+WR(stub_zero, pthread_mutexattr_init);
+WR(stub_zero, pthread_mutexattr_setkind_np);
+WR(stub_zero, pthread_mutexattr_setprioceiling);
+WR(stub_zero, pthread_mutexattr_setprotocol);
+WR(stub_zero, pthread_mutexattr_setpshared);
+WR(stub_zero, pthread_mutexattr_settype);
+WR(stub_zero, pthread_once);
+WR(stub_zero, pthread_resume_all_np);
+WR(stub_zero, pthread_resume_np);
+WR(stub_zero, pthread_rwlock_destroy);
+WR(stub_zero, pthread_rwlock_init);
+WR(stub_zero, pthread_rwlock_rdlock);
+WR(stub_zero, pthread_rwlock_tryrdlock);
+WR(stub_zero, pthread_rwlock_trywrlock);
+WR(stub_zero, pthread_rwlock_unlock);
+WR(stub_zero, pthread_rwlock_wrlock);
+WR(stub_zero, pthread_rwlockattr_destroy);
+WR(stub_zero, pthread_rwlockattr_getpshared);
+WR(stub_zero, pthread_rwlockattr_init);
+WR(stub_zero, pthread_rwlockattr_setpshared);
+WR(stub_self, pthread_self);
+WR(stub_zero, pthread_set_name_np);
+WR(stub_zero, pthread_setcancelstate);
+WR(stub_zero, pthread_setcanceltype);
+WR(stub_zero, pthread_setconcurrency);
+WR(stub_zero, pthread_setprio);
+WR(stub_zero, pthread_setschedparam);
+WR(stub_zero, pthread_setspecific);
+WR(stub_zero, pthread_sigmask);
+WR(stub_zero, pthread_single_np);
+WR(stub_zero, pthread_suspend_all_np);
+WR(stub_zero, pthread_suspend_np);
+WR(stub_zero, pthread_switch_add_np);
+WR(stub_zero, pthread_switch_delete_np);
+WR(stub_zero, pthread_testcancel);
+WR(stub_zero, pthread_yield);
+WR(stub_zero, sched_yield);
+WR(stub_zero, sem_close);
+WR(stub_zero, sem_destroy);
+WR(stub_zero, sem_getvalue);
+WR(stub_zero, sem_init);
+WR(stub_zero, sem_open);
+WR(stub_zero, sem_post);
+WR(stub_zero, sem_trywait);
+WR(stub_zero, sem_unlink);
+WR(stub_zero, sem_wait);
+
+
+static int __used
+stub_zero(void)
+{
+       return (0);
+}
+
+static void * __used
+stub_null(void)
 {
        return (NULL);
 }
 
-int
-_pthread_key_create_stub(pthread_key_t *key __unused,
-                        void (*destructor) (void *) __unused)
+static void * __used
+stub_self(void)
 {
-       return (0);
-}
+       static struct {} main_thread;
 
-int
-_pthread_key_delete_stub(pthread_key_t key __unused)
-{
-       return (0);
+       return (&main_thread);
 }
 
-int
-_pthread_main_np_stub(void)
+static int __used
+stub_main(void)
 {
        return (-1);
 }
 
-int
-_pthread_mutex_destroy_stub(pthread_mutex_t *mattr __unused)
+static int __used
+stub_true(void)
 {
-       return (0);
-}
-
-int
-_pthread_mutex_init_stub(pthread_mutex_t *mutex __unused,
-                        const pthread_mutexattr_t *mattr __unused)
-{
-       return (0);
-}
-
-int
-_pthread_mutex_lock_stub(pthread_mutex_t *mutex __unused)
-{
-       return (0);
-}
-
-int
-_pthread_mutex_trylock_stub(pthread_mutex_t *mutex __unused)
-{
-       return (0);
-}
-
-int
-_pthread_mutex_unlock_stub(pthread_mutex_t *mutex __unused)
-{
-       return (0);
-}
-
-int
-_pthread_mutexattr_init_stub(pthread_mutexattr_t *mattr __unused)
-{
-       return (0);
-}
-
-int
-_pthread_mutexattr_destroy_stub(pthread_mutexattr_t *mattr __unused)
-{
-       return (0);
+       return (1);
 }
 
-int
-_pthread_mutexattr_settype_stub(pthread_mutexattr_t *mattr __unused,
-                               int type __unused)
+static void __used
+stub_exit(void)
 {
-       return (0);
-}
-
-int
-_pthread_once_stub(pthread_once_t *once_control __unused,
-                  void (*init_routine) (void) __unused)
-{
-       return (0);
-}
-
-int
-_pthread_rwlock_init_stub(pthread_rwlock_t *rwlock __unused,
-                         const pthread_rwlockattr_t *attr __unused)
-{
-       return (0);
-}
-
-int
-_pthread_rwlock_destroy_stub(pthread_rwlock_t *rwlock __unused)
-{
-       return (0);
-}
-
-int
-_pthread_rwlock_rdlock_stub(pthread_rwlock_t *rwlock __unused)
-{
-       return (0);
-}
-
-int
-_pthread_rwlock_tryrdlock_stub(pthread_rwlock_t *rwlock __unused)
-{
-       return (0);
-}
-
-int
-_pthread_rwlock_trywrlock_stub(pthread_rwlock_t *rwlock __unused)
-{
-       return (0);
-}
-
-int
-_pthread_rwlock_unlock_stub(pthread_rwlock_t *rwlock __unused)
-{
-       return (0);
-}
-
-int
-_pthread_rwlock_wrlock_stub(pthread_rwlock_t *rwlock __unused)
-{
-       return (0);
-}
-
-pthread_t
-_pthread_self_stub(void)
-{
-       return (&main_thread);
-}
-int
-_pthread_setspecific_stub(pthread_key_t key __unused,
-                         const void *value __unused)
-{
-       return (0);
-}
-
-int
-_pthread_sigmask_stub(int how __unused, const sigset_t *set __unused,
-                     sigset_t *oset __unused)
-{
-       return (0);
+       exit(0);
 }
index d3d29c4..187897d 100644 (file)
@@ -25,7 +25,7 @@
 .\" $FreeBSD: src/lib/libc/gen/getobjformat.3,v 1.3.2.6 2003/03/13 18:05:37 trhodes Exp $
 .\" $DragonFly: src/lib/libc/gen/getobjformat.3,v 1.2 2003/06/17 04:26:42 dillon Exp $
 .\"
-.Dd September 7, 1998
+.Dd May 23, 2009
 .Dt GETOBJFORMAT 3
 .Os
 .Sh NAME
 .Sh SYNOPSIS
 .In objformat.h
 .Ft int
-.Fn getobjformat "char *buf" "size_t bufsize" "int *argcp" "char **argv"
+.Fn getobjformat "char *buf" "size_t bufsize" "int *argcp __unused" "char **argv __unused"
 .Sh DESCRIPTION
 The
 .Fn getobjformat
-function
-queries several sources to determine the preferred object file
-format, and copies its name into a buffer provided by the caller.
-.Pp
-The object file format is determined as follows.  If
-.Va argv
-is
-.No non- Ns Ev NULL
-and an explicit command line argument such as
-.Fl aout
-or
-.Fl elf
-is present, then that determines the object file format.
-.Pp
-Otherwise, if the variable
-.Ev OBJFORMAT
-is set in the environment, the object file format is taken from its
-value.
-.Pp
-Otherwise, if the file
-.Pa /etc/objformat
-is readable and contains a line of the form
-.Ql OBJFORMAT=xxx ,
-the object file format is taken from there.
-.Pp
-Otherwise, a built-in system default object file format is returned.
+function copies the name of the preferred object file format
+.Dq ( elf )
+into a buffer provided by the caller.
+The function is currently provided only for backward compatibility.
 .Pp
 .Va buf
 points to a user-supplied buffer into which the name of the object
 file format is copied.
 .Va bufsize
-gives the size of the buffer in bytes.  The string placed in
+gives the size of the buffer in bytes.
+The string placed in
 .Va buf
-is always null-terminated.  It is an error if the buffer is too
-small to hold the null-terminated name.
+is always null-terminated.
+It is an error if the buffer is too small to hold the null-terminated name.
 .Pp
 .Va argv
-points to a
-.Dv NULL Ns -terminated
-argument vector to be scanned for object
-format options.
-.Va argv
-may be
-.Dv NULL ,
-in which case the argument vector is not scanned.
-.Pp
-If
-.Va argcp
-is non-NULL, any object format options are deleted from the
-argument vector, and the updated argument count is stored into
-the integer referenced by
-.Va argcp .
-If
+and
 .Va argcp
-is
-.Dv NULL ,
-the argument vector is left unchanged.
+are unused and new applications should set them to
+.Dv NULL .
 .Sh RETURN VALUES
 On success,
 .Fn getobjformat
@@ -105,23 +68,9 @@ null terminator.
 If the supplied buffer is too small to hold the object file format
 and its null terminator,
 .Fn getobjformat
-returns -1.  In that case, the contents of the buffer and argument
+returns -1.
+In that case, the contents of the buffer and argument
 vector supplied by the caller are indeterminate.
-.Sh ENVIRONMENT
-.Bl -tag -width OBJFORMAT
-.It Ev OBJFORMAT
-If the environment variable
-.Ev OBJFORMAT
-is set, it overrides the default object file format.
-.Ev OBJFORMAT takes precedence over
-.Pa /etc/objformat .
-.El
-.Sh FILES
-.Bl -tag -width /etc/objformat -compact
-.It Pa /etc/objformat
-If present, specifies the object file format to use.  Syntax is
-.Ql OBJFORMAT=xxx .
-.El
 .Sh SEE ALSO
 .Xr objformat 1
 .Sh HISTORY
diff --git a/lib/libc/gen/pthread_fake.c b/lib/libc/gen/pthread_fake.c
deleted file mode 100644 (file)
index 7b28929..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (c) 2004 The DragonFly Project.  All rights reserved.
- * 
- * This code is derived from software contributed to The DragonFly Project
- * by Simon Schubert <corecode@fs.ei.tum.de>
- * 
- * 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 DragonFly 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 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 HOLDERS 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.
- * 
- * $DragonFly: src/lib/libc/gen/pthread_fake.c,v 1.3 2008/05/25 21:34:49 hasso Exp $
- */
-
-#ifndef _THREAD_SAFE
-/*
- * Provide the functions for non-threaded programs using
- * thread-aware dynamic modules.
- *
- * This list explicitly lakes pthread_create, since an application
- * using this function clearly should be linked against -lc_r.
- * Leaving this function out allows the linker to catch this.
- * Same reason applies for thread-aware modules.
- */
-
-#include <sys/cdefs.h>
-
-#include <errno.h>
-#include <stddef.h>
-
-int     _pthread_fake_inval(void);
-void   *_pthread_fake_null(void);
-
-__weak_reference(_pthread_fake_inval, pthread_atfork);
-__weak_reference(_pthread_fake_inval, pthread_attr_destroy);
-__weak_reference(_pthread_fake_inval, pthread_attr_get_np);
-__weak_reference(_pthread_fake_inval, pthread_attr_getdetachstate);
-__weak_reference(_pthread_fake_inval, pthread_attr_getinheritsched);
-__weak_reference(_pthread_fake_inval, pthread_attr_getschedparam);
-__weak_reference(_pthread_fake_inval, pthread_attr_getschedpolicy);
-__weak_reference(_pthread_fake_inval, pthread_attr_getscope);
-__weak_reference(_pthread_fake_inval, pthread_attr_getstack);
-__weak_reference(_pthread_fake_inval, pthread_attr_getstackaddr);
-__weak_reference(_pthread_fake_inval, pthread_attr_getstacksize);
-__weak_reference(_pthread_fake_inval, pthread_attr_init);
-__weak_reference(_pthread_fake_inval, pthread_attr_setcreatesuspend_np);
-__weak_reference(_pthread_fake_inval, pthread_attr_setdetachstate);
-__weak_reference(_pthread_fake_inval, pthread_attr_setinheritsched);
-__weak_reference(_pthread_fake_inval, pthread_attr_setschedparam);
-__weak_reference(_pthread_fake_inval, pthread_attr_setschedpolicy);
-__weak_reference(_pthread_fake_inval, pthread_attr_setscope);
-__weak_reference(_pthread_fake_inval, pthread_attr_setstack);
-__weak_reference(_pthread_fake_inval, pthread_attr_setstackaddr);
-__weak_reference(_pthread_fake_inval, pthread_attr_setstacksize);
-__weak_reference(_pthread_fake_inval, pthread_cancel);
-__weak_reference(_pthread_fake_inval, pthread_setcancelstate);
-__weak_reference(_pthread_fake_inval, pthread_setcanceltype);
-__weak_reference(_pthread_fake_inval, pthread_testcancel);/*XXX void */
-__weak_reference(_pthread_fake_inval, pthread_cleanup_push);/*XXX void */
-__weak_reference(_pthread_fake_inval, pthread_cleanup_pop);/*XXX void */
-__weak_reference(_pthread_fake_inval, pthread_getconcurrency);
-__weak_reference(_pthread_fake_inval, pthread_setconcurrency);
-__weak_reference(_pthread_fake_inval, pthread_cond_init);
-__weak_reference(_pthread_fake_inval, pthread_cond_destroy);
-__weak_reference(_pthread_fake_inval, pthread_cond_wait);
-__weak_reference(_pthread_fake_inval, pthread_cond_timedwait);
-__weak_reference(_pthread_fake_inval, pthread_cond_signal);
-__weak_reference(_pthread_fake_inval, pthread_cond_broadcast);
-__weak_reference(_pthread_fake_inval, pthread_condattr_destroy);
-__weak_reference(_pthread_fake_inval, pthread_condattr_init);
-__weak_reference(_pthread_fake_inval, pthread_detach);
-__weak_reference(_pthread_fake_inval, pthread_equal);/*XXX*/
-__weak_reference(_pthread_fake_inval, pthread_exit);/*XXX void*/
-__weak_reference(_pthread_fake_inval, pthread_getprio);
-__weak_reference(_pthread_fake_inval, pthread_getschedparam);
-__weak_reference(_pthread_fake_inval, pthread_set_name_np);/*XXX void*/
-__weak_reference(_pthread_fake_inval, pthread_join);
-__weak_reference(_pthread_fake_inval, pthread_kill);
-__weak_reference(_pthread_fake_inval, pthread_main_np);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_init);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_setkind_np);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_getkind_np);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_gettype);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_settype);
-__weak_reference(_pthread_fake_inval, pthread_multi_np);
-__weak_reference(_pthread_fake_inval, pthread_mutex_init);
-__weak_reference(_pthread_fake_inval, pthread_mutex_destroy);
-__weak_reference(_pthread_fake_inval, pthread_mutex_trylock);
-__weak_reference(_pthread_fake_inval, pthread_mutex_lock);
-__weak_reference(_pthread_fake_inval, pthread_mutex_unlock);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_getprioceiling);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_setprioceiling);
-__weak_reference(_pthread_fake_inval, pthread_mutex_getprioceiling);
-__weak_reference(_pthread_fake_inval, pthread_mutex_setprioceiling);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_getprotocol);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_setprotocol);
-__weak_reference(_pthread_fake_inval, pthread_mutexattr_destroy);
-__weak_reference(_pthread_fake_inval, pthread_once);
-__weak_reference(_pthread_fake_inval, pthread_resume_np);
-__weak_reference(_pthread_fake_inval, pthread_resume_all_np);/*XXX void*/
-__weak_reference(_pthread_fake_inval, pthread_rwlock_destroy);
-__weak_reference(_pthread_fake_inval, pthread_rwlock_init);
-__weak_reference(_pthread_fake_inval, pthread_rwlock_rdlock);
-__weak_reference(_pthread_fake_inval, pthread_rwlock_tryrdlock);
-__weak_reference(_pthread_fake_inval, pthread_rwlock_trywrlock);
-__weak_reference(_pthread_fake_inval, pthread_rwlock_unlock);
-__weak_reference(_pthread_fake_inval, pthread_rwlock_wrlock);
-__weak_reference(_pthread_fake_inval, pthread_rwlockattr_destroy);
-__weak_reference(_pthread_fake_inval, pthread_rwlockattr_getpshared);
-__weak_reference(_pthread_fake_inval, pthread_rwlockattr_init);
-__weak_reference(_pthread_fake_inval, pthread_rwlockattr_setpshared);
-__weak_reference(_pthread_fake_null, pthread_self);/*XXX pthread_t */
-__weak_reference(_pthread_fake_inval, sem_init);
-__weak_reference(_pthread_fake_inval, sem_destroy);
-__weak_reference(_pthread_fake_inval, sem_open);
-__weak_reference(_pthread_fake_inval, sem_close);
-__weak_reference(_pthread_fake_inval, sem_unlink);
-__weak_reference(_pthread_fake_inval, sem_wait);
-__weak_reference(_pthread_fake_inval, sem_trywait);
-__weak_reference(_pthread_fake_inval, sem_post);
-__weak_reference(_pthread_fake_inval, sem_getvalue);
-__weak_reference(_pthread_fake_inval, pthread_setprio);
-__weak_reference(_pthread_fake_inval, pthread_setschedparam);
-__weak_reference(_pthread_fake_inval, pthread_sigmask);
-__weak_reference(_pthread_fake_inval, pthread_single_np);
-__weak_reference(_pthread_fake_inval, pthread_key_create);
-__weak_reference(_pthread_fake_inval, pthread_key_delete);
-__weak_reference(_pthread_fake_inval, pthread_getspecific);
-__weak_reference(_pthread_fake_inval, pthread_setspecific);
-__weak_reference(_pthread_fake_inval, pthread_suspend_np);
-__weak_reference(_pthread_fake_inval, pthread_suspend_all_np);/*XXX void*/
-__weak_reference(_pthread_fake_inval, pthread_switch_add_np);
-__weak_reference(_pthread_fake_inval, pthread_switch_delete_np);
-__weak_reference(_pthread_fake_inval, sched_yield);
-__weak_reference(_pthread_fake_inval, pthread_yield);/*XXX void*/
-
-int
-_pthread_fake_inval(void)
-{
-       return EINVAL;
-}
-
-void *
-_pthread_fake_null(void)
-{
-       return NULL;
-}
-
-#endif /* _THREAD_SAFE */
index e4011d9..d30cc55 100644 (file)
@@ -265,7 +265,7 @@ and the process will dump core.
 .Xr alloca 3 ,
 .Xr getpagesize 3 ,
 .Xr memory 3 ,
-.Xr posix_memalign
+.Xr posix_memalign 3
 .Sh STANDARDS
 The
 .Fn malloc ,
index 2fb05f9..faa1e5c 100644 (file)
@@ -284,7 +284,8 @@ _bigalloc_hash(void *ptr)
 {
        int hv;
 
-       hv = ((int)ptr >> PAGE_SHIFT) ^ ((int)ptr >> (PAGE_SHIFT + BIGHSHIFT));
+       hv = ((int)(intptr_t)ptr >> PAGE_SHIFT) ^
+             ((int)(intptr_t)ptr >> (PAGE_SHIFT + BIGHSHIFT));
 
        return(hv);
 }
@@ -458,7 +459,7 @@ posix_memalign(void **memptr, size_t alignment, size_t size)
 {
        bigalloc_t *bigp;
        bigalloc_t big;
-       int chunking;
+       size_t chunking;
        int zi;
 
        /*
@@ -573,7 +574,7 @@ _slaballoc(size_t size, int flags)
        slzone_t z;
        slchunk_t chunk;
        slglobaldata_t slgd;
-       int chunking;
+       size_t chunking;
        int zi;
 #ifdef INVARIANTS
        int i;
index 88cfa54..85efeec 100644 (file)
@@ -308,10 +308,13 @@ settzname(void)
 static int
 differ_by_repeat(const time_t t1, const time_t t0)
 {
+       int_fast64_t _t0 = t0;
+       int_fast64_t _t1 = t1;
+
        if (TYPE_INTEGRAL(time_t) &&
                TYPE_BIT(time_t) - TYPE_SIGNED(time_t) < SECSPERREPEAT_BITS)
                        return 0;
-       return t1 - t0 == SECSPERREPEAT;
+       return _t1 - _t0 == SECSPERREPEAT;
 }
 
 static int
index 7b6bcea..562014a 100644 (file)
@@ -225,8 +225,8 @@ _thread_init(void)
                 * thread stack that is just beyond.
                 */
                if (mmap(_usrstack - PTHREAD_STACK_INITIAL -
-                   PTHREAD_STACK_GUARD, PTHREAD_STACK_GUARD, 0, MAP_ANON,
-                   -1, 0) == MAP_FAILED)
+                   PTHREAD_STACK_GUARD, PTHREAD_STACK_GUARD, 0,
+                   MAP_ANON | MAP_TRYFIXED, -1, 0) == MAP_FAILED)
                        PANIC("Cannot allocate red zone for initial thread");
 
                _thread_initial->tcb = tls_get_tcb();
index 6358e62..ebb99ea 100644 (file)
@@ -1,4 +1,4 @@
-# $FreeBSD: src/lib/libfetch/Makefile,v 1.14.2.5 2003/01/09 11:50:32 des Exp $
+# $FreeBSD: src/lib/libfetch/Makefile,v 1.51 2007/12/19 05:10:07 ru Exp $
 # $DragonFly: src/lib/libfetch/Makefile,v 1.9 2007/08/05 21:48:12 swildner Exp $
 
 LIB=           fetch
@@ -19,9 +19,9 @@ LDADD=                -lssl -lcrypto
 
 SHLIB_MAJOR=    4
 
-ftperr.h: ftp.errors
-       @echo "static struct fetcherr _ftp_errlist[] = {" > ${.TARGET}
-       @cat ${.ALLSRC} \
+ftperr.h: ftp.errors ${.CURDIR}/Makefile
+       @echo "static struct fetcherr ftp_errlist[] = {" > ${.TARGET}
+       @cat ${.CURDIR}/ftp.errors \
          | grep -v ^# \
          | sort \
          | while read NUM CAT STRING; do \
@@ -30,9 +30,9 @@ ftperr.h: ftp.errors
        @echo "    { -1, FETCH_UNKNOWN, \"Unknown FTP error\" }" >> ${.TARGET}
        @echo "};" >> ${.TARGET}
 
-httperr.h: http.errors
-       @echo "static struct fetcherr _http_errlist[] = {" > ${.TARGET}
-       @cat ${.ALLSRC} \
+httperr.h: http.errors ${.CURDIR}/Makefile
+       @echo "static struct fetcherr http_errlist[] = {" > ${.TARGET}
+       @cat ${.CURDIR}/http.errors \
          | grep -v ^# \
          | sort \
          | while read NUM CAT STRING; do \
index bdd393a..9c8c990 100644 (file)
@@ -25,7 +25,7 @@
  * (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/libfetch/common.c,v 1.50 2005/02/16 12:46:46 des Exp $
+ * $FreeBSD: src/lib/libfetch/common.c,v 1.56 2008/04/15 23:29:51 cperciva Exp $
  * $DragonFly: src/lib/libfetch/common.c,v 1.5 2008/04/02 14:46:37 joerg Exp $
  */
 
 #include <sys/socket.h>
 #include <sys/time.h>
 #include <sys/uio.h>
+
 #include <netinet/in.h>
 
+#include <ctype.h>
 #include <errno.h>
 #include <netdb.h>
 #include <pwd.h>
@@ -53,7 +55,7 @@
 /*
  * Error messages for resolver errors
  */
-static struct fetcherr _netdb_errlist[] = {
+static struct fetcherr netdb_errlist[] = {
 #ifdef EAI_NODATA
        { EAI_NODATA,   FETCH_RESOLV,   "Host not found" },
 #endif
@@ -73,7 +75,7 @@ static const char ENDL[2] = "\r\n";
  * Map error code to string
  */
 static struct fetcherr *
-_fetch_finderr(struct fetcherr *p, int e)
+fetch_finderr(struct fetcherr *p, int e)
 {
        while (p->num != -1 && p->num != e)
                p++;
@@ -84,9 +86,9 @@ _fetch_finderr(struct fetcherr *p, int e)
  * Set error code
  */
 void
-_fetch_seterr(struct fetcherr *p, int e)
+fetch_seterr(struct fetcherr *p, int e)
 {
-       p = _fetch_finderr(p, e);
+       p = fetch_finderr(p, e);
        fetchLastErrCode = p->cat;
        snprintf(fetchLastErrString, MAXERRSTRING, "%s", p->string);
 }
@@ -95,7 +97,7 @@ _fetch_seterr(struct fetcherr *p, int e)
  * Set error code according to errno
  */
 void
-_fetch_syserr(void)
+fetch_syserr(void)
 {
        switch (errno) {
        case 0:
@@ -155,7 +157,7 @@ default:
  * Emit status message
  */
 void
-_fetch_info(const char *fmt, ...)
+fetch_info(const char *fmt, ...)
 {
        va_list ap;
 
@@ -172,7 +174,7 @@ _fetch_info(const char *fmt, ...)
  * Return the default port for a scheme
  */
 int
-_fetch_default_port(const char *scheme)
+fetch_default_port(const char *scheme)
 {
        struct servent *se;
 
@@ -189,7 +191,7 @@ _fetch_default_port(const char *scheme)
  * Return the default proxy port for a scheme
  */
 int
-_fetch_default_proxy_port(const char *scheme)
+fetch_default_proxy_port(const char *scheme)
 {
        if (strcasecmp(scheme, SCHEME_FTP) == 0)
                return (FTP_DEFAULT_PROXY_PORT);
@@ -203,7 +205,7 @@ _fetch_default_proxy_port(const char *scheme)
  * Create a connection for an existing descriptor.
  */
 conn_t *
-_fetch_reopen(int sd)
+fetch_reopen(int sd)
 {
        conn_t *conn;
 
@@ -220,7 +222,7 @@ _fetch_reopen(int sd)
  * Bump a connection's reference count.
  */
 conn_t *
-_fetch_ref(conn_t *conn)
+fetch_ref(conn_t *conn)
 {
 
        ++conn->ref;
@@ -232,7 +234,7 @@ _fetch_ref(conn_t *conn)
  * Bind a socket to a specific local address
  */
 int
-_fetch_bind(int sd, int af, const char *addr)
+fetch_bind(int sd, int af, const char *addr)
 {
        struct addrinfo hints, *res, *res0;
        int err;
@@ -254,7 +256,7 @@ _fetch_bind(int sd, int af, const char *addr)
  * Establish a TCP connection to the specified port on the specified host.
  */
 conn_t *
-_fetch_connect(const char *host, int port, int af, int verbose)
+fetch_connect(const char *host, int port, int af, int verbose)
 {
        conn_t *conn;
        char pbuf[10];
@@ -265,7 +267,7 @@ _fetch_connect(const char *host, int port, int af, int verbose)
        DEBUG(fprintf(stderr, "---> %s:%d\n", host, port));
 
        if (verbose)
-               _fetch_info("looking up %s", host);
+               fetch_info("looking up %s", host);
 
        /* look up host name and set up socket address structure */
        snprintf(pbuf, sizeof(pbuf), "%d", port);
@@ -274,13 +276,13 @@ _fetch_connect(const char *host, int port, int af, int verbose)
        hints.ai_socktype = SOCK_STREAM;
        hints.ai_protocol = 0;
        if ((err = getaddrinfo(host, pbuf, &hints, &res0)) != 0) {
-               _netdb_seterr(err);
+               netdb_seterr(err);
                return (NULL);
        }
        bindaddr = getenv("FETCH_BIND_ADDRESS");
 
        if (verbose)
-               _fetch_info("connecting to %s:%d", host, port);
+               fetch_info("connecting to %s:%d", host, port);
 
        /* try to connect */
        for (sd = -1, res = res0; res; sd = -1, res = res->ai_next) {
@@ -288,8 +290,8 @@ _fetch_connect(const char *host, int port, int af, int verbose)
                         res->ai_protocol)) == -1)
                        continue;
                if (bindaddr != NULL && *bindaddr != '\0' &&
-                   _fetch_bind(sd, res->ai_family, bindaddr) != 0) {
-                       _fetch_info("failed to bind to '%s'", bindaddr);
+                   fetch_bind(sd, res->ai_family, bindaddr) != 0) {
+                       fetch_info("failed to bind to '%s'", bindaddr);
                        close(sd);
                        continue;
                }
@@ -299,12 +301,12 @@ _fetch_connect(const char *host, int port, int af, int verbose)
        }
        freeaddrinfo(res0);
        if (sd == -1) {
-               _fetch_syserr();
+               fetch_syserr();
                return (NULL);
        }
 
-       if ((conn = _fetch_reopen(sd)) == NULL) {
-               _fetch_syserr();
+       if ((conn = fetch_reopen(sd)) == NULL) {
+               fetch_syserr();
                close(sd);
        }
        return (conn);
@@ -315,7 +317,7 @@ _fetch_connect(const char *host, int port, int af, int verbose)
  * Enable SSL on a connection.
  */
 int
-_fetch_ssl(conn_t *conn, int verbose)
+fetch_ssl(conn_t *conn, int verbose)
 {
 
 #ifdef WITH_SSL
@@ -373,9 +375,9 @@ _fetch_ssl(conn_t *conn, int verbose)
  * Read a character from a connection w/ timeout
  */
 ssize_t
-_fetch_read(conn_t *conn, char *buf, size_t len)
+fetch_read(conn_t *conn, char *buf, size_t len)
 {
-       struct timeval now, timeout, wait;
+       struct timeval now, timeout, delta;
        fd_set readfds;
        ssize_t rlen, total;
        int r;
@@ -391,23 +393,23 @@ _fetch_read(conn_t *conn, char *buf, size_t len)
                while (fetchTimeout && !FD_ISSET(conn->sd, &readfds)) {
                        FD_SET(conn->sd, &readfds);
                        gettimeofday(&now, NULL);
-                       wait.tv_sec = timeout.tv_sec - now.tv_sec;
-                       wait.tv_usec = timeout.tv_usec - now.tv_usec;
-                       if (wait.tv_usec < 0) {
-                               wait.tv_usec += 1000000;
-                               wait.tv_sec--;
+                       delta.tv_sec = timeout.tv_sec - now.tv_sec;
+                       delta.tv_usec = timeout.tv_usec - now.tv_usec;
+                       if (delta.tv_usec < 0) {
+                               delta.tv_usec += 1000000;
+                               delta.tv_sec--;
                        }
-                       if (wait.tv_sec < 0) {
+                       if (delta.tv_sec < 0) {
                                errno = ETIMEDOUT;
-                               _fetch_syserr();
+                               fetch_syserr();
                                return (-1);
                        }
                        errno = 0;
-                       r = select(conn->sd + 1, &readfds, NULL, NULL, &wait);
+                       r = select(conn->sd + 1, &readfds, NULL, NULL, &delta);
                        if (r == -1) {
                                if (errno == EINTR && fetchRestartCalls)
                                        continue;
-                               _fetch_syserr();
+                               fetch_syserr();
                                return (-1);
                        }
                }
@@ -438,7 +440,7 @@ _fetch_read(conn_t *conn, char *buf, size_t len)
 #define MIN_BUF_SIZE 1024
 
 int
-_fetch_getln(conn_t *conn)
+fetch_getln(conn_t *conn)
 {
        char *tmp;
        size_t tmpsize;
@@ -457,7 +459,7 @@ _fetch_getln(conn_t *conn)
        conn->buflen = 0;
 
        do {
-               len = _fetch_read(conn, &c, 1);
+               len = fetch_read(conn, &c, 1);
                if (len == -1)
                        return (-1);
                if (len == 0)
@@ -485,13 +487,13 @@ _fetch_getln(conn_t *conn)
  * Write to a connection w/ timeout
  */
 ssize_t
-_fetch_write(conn_t *conn, const char *buf, size_t len)
+fetch_write(conn_t *conn, const char *buf, size_t len)
 {
        struct iovec iov;
 
        iov.iov_base = __DECONST(char *, buf);
        iov.iov_len = len;
-       return _fetch_writev(conn, &iov, 1);
+       return fetch_writev(conn, &iov, 1);
 }
 
 /*
@@ -499,9 +501,9 @@ _fetch_write(conn_t *conn, const char *buf, size_t len)
  * Note: can modify the iovec.
  */
 ssize_t
-_fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt)
+fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt)
 {
-       struct timeval now, timeout, wait;
+       struct timeval now, timeout, delta;
        fd_set writefds;
        ssize_t wlen, total;
        int r;
@@ -517,19 +519,19 @@ _fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt)
                while (fetchTimeout && !FD_ISSET(conn->sd, &writefds)) {
                        FD_SET(conn->sd, &writefds);
                        gettimeofday(&now, NULL);
-                       wait.tv_sec = timeout.tv_sec - now.tv_sec;
-                       wait.tv_usec = timeout.tv_usec - now.tv_usec;
-                       if (wait.tv_usec < 0) {
-                               wait.tv_usec += 1000000;
-                               wait.tv_sec--;
+                       delta.tv_sec = timeout.tv_sec - now.tv_sec;
+                       delta.tv_usec = timeout.tv_usec - now.tv_usec;
+                       if (delta.tv_usec < 0) {
+                               delta.tv_usec += 1000000;
+                               delta.tv_sec--;
                        }
-                       if (wait.tv_sec < 0) {
+                       if (delta.tv_sec < 0) {
                                errno = ETIMEDOUT;
-                               _fetch_syserr();
+                               fetch_syserr();
                                return (-1);
                        }
                        errno = 0;
-                       r = select(conn->sd + 1, NULL, &writefds, NULL, &wait);
+                       r = select(conn->sd + 1, NULL, &writefds, NULL, &delta);
                        if (r == -1) {
                                if (errno == EINTR && fetchRestartCalls)
                                        continue;
@@ -547,7 +549,7 @@ _fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt)
                if (wlen == 0) {
                        /* we consider a short write a failure */
                        errno = EPIPE;
-                       _fetch_syserr();
+                       fetch_syserr();
                        return (-1);
                }
                if (wlen < 0) {
@@ -574,7 +576,7 @@ _fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt)
  * Write a line of text to a connection w/ timeout
  */
 int
-_fetch_putln(conn_t *conn, const char *str, size_t len)
+fetch_putln(conn_t *conn, const char *str, size_t len)
 {
        struct iovec iov[2];
        int ret;
@@ -585,9 +587,9 @@ _fetch_putln(conn_t *conn, const char *str, size_t len)
        iov[1].iov_base = __DECONST(char *, ENDL);
        iov[1].iov_len = sizeof(ENDL);
        if (len == 0)
-               ret = _fetch_writev(conn, &iov[1], 1);
+               ret = fetch_writev(conn, &iov[1], 1);
        else
-               ret = _fetch_writev(conn, iov, 2);
+               ret = fetch_writev(conn, iov, 2);
        if (ret == -1)
                return (-1);
        return (0);
@@ -598,7 +600,7 @@ _fetch_putln(conn_t *conn, const char *str, size_t len)
  * Close connection
  */
 int
-_fetch_close(conn_t *conn)
+fetch_close(conn_t *conn)
 {
        int ret;
 
@@ -614,7 +616,7 @@ _fetch_close(conn_t *conn)
 /*** Directory-related utility functions *************************************/
 
 int
-_fetch_add_entry(struct url_ent **p, int *size, int *len,
+fetch_add_entry(struct url_ent **p, int *size, int *len,
     const char *name, struct url_stat *us)
 {
        struct url_ent *tmp;
@@ -628,7 +630,7 @@ _fetch_add_entry(struct url_ent **p, int *size, int *len,
                tmp = realloc(*p, (*size * 2 + 1) * sizeof(**p));
                if (tmp == NULL) {
                        errno = ENOMEM;
-                       _fetch_syserr();
+                       fetch_syserr();
                        return (-1);
                }
                *size = (*size * 2 + 1);
@@ -637,7 +639,7 @@ _fetch_add_entry(struct url_ent **p, int *size, int *len,
 
        tmp = *p + *len;
        snprintf(tmp->name, PATH_MAX, "%s", name);
-       bcopy(us, &tmp->stat, sizeof(*us));
+       memcpy(&tmp->stat, us, sizeof(*us));
 
        (*len)++;
        (++tmp)->name[0] = 0;
@@ -649,7 +651,7 @@ _fetch_add_entry(struct url_ent **p, int *size, int *len,
 /*** Authentication-related utility functions ********************************/
 
 static const char *
-_fetch_read_word(FILE *f)
+fetch_read_word(FILE *f)
 {
        static char word[1024];
 
@@ -662,7 +664,7 @@ _fetch_read_word(FILE *f)
  * Get authentication data for a URL from .netrc
  */
 int
-_fetch_netrc_auth(struct url *url)
+fetch_netrc_auth(struct url *url)
 {
        char fn[PATH_MAX];
        const char *word;
@@ -671,7 +673,7 @@ _fetch_netrc_auth(struct url *url)
 
        if ((p = getenv("NETRC")) != NULL) {
                if (snprintf(fn, sizeof(fn), "%s", p) >= (int)sizeof(fn)) {
-                       _fetch_info("$NETRC specifies a file name "
+                       fetch_info("$NETRC specifies a file name "
                            "longer than PATH_MAX");
                        return (-1);
                }
@@ -689,39 +691,39 @@ _fetch_netrc_auth(struct url *url)
 
        if ((f = fopen(fn, "r")) == NULL)
                return (-1);
-       while ((word = _fetch_read_word(f)) != NULL) {
+       while ((word = fetch_read_word(f)) != NULL) {
                if (strcmp(word, "default") == 0) {
-                       DEBUG(_fetch_info("Using default .netrc settings"));
+                       DEBUG(fetch_info("Using default .netrc settings"));
                        break;
                }
                if (strcmp(word, "machine") == 0 &&
-                   (word = _fetch_read_word(f)) != NULL &&
+                   (word = fetch_read_word(f)) != NULL &&
                    strcasecmp(word, url->host) == 0) {
-                       DEBUG(_fetch_info("Using .netrc settings for %s", word));
+                       DEBUG(fetch_info("Using .netrc settings for %s", word));
                        break;
                }
        }
        if (word == NULL)
                goto ferr;
-       while ((word = _fetch_read_word(f)) != NULL) {
+       while ((word = fetch_read_word(f)) != NULL) {
                if (strcmp(word, "login") == 0) {
-                       if ((word = _fetch_read_word(f)) == NULL)
+                       if ((word = fetch_read_word(f)) == NULL)
                                goto ferr;
                        if (snprintf(url->user, sizeof(url->user),
                                "%s", word) > (int)sizeof(url->user)) {
-                               _fetch_info("login name in .netrc is too long");
+                               fetch_info("login name in .netrc is too long");
                                url->user[0] = '\0';
                        }
                } else if (strcmp(word, "password") == 0) {
-                       if ((word = _fetch_read_word(f)) == NULL)
+                       if ((word = fetch_read_word(f)) == NULL)
                                goto ferr;
                        if (snprintf(url->pwd, sizeof(url->pwd),
                                "%s", word) > (int)sizeof(url->pwd)) {
-                               _fetch_info("password in .netrc is too long");
+                               fetch_info("password in .netrc is too long");
                                url->pwd[0] = '\0';
                        }
                } else if (strcmp(word, "account") == 0) {
-                       if ((word = _fetch_read_word(f)) == NULL)
+                       if ((word = fetch_read_word(f)) == NULL)
                                goto ferr;
                        /* XXX not supported! */
                } else {
@@ -734,3 +736,51 @@ _fetch_netrc_auth(struct url *url)
        fclose(f);
        return (-1);
 }
+
+/*
+ * The no_proxy environment variable specifies a set of domains for
+ * which the proxy should not be consulted; the contents is a comma-,
+ * or space-separated list of domain names.  A single asterisk will
+ * override all proxy variables and no transactions will be proxied
+ * (for compatability with lynx and curl, see the discussion at
+ * <http://curl.haxx.se/mail/archive_pre_oct_99/0009.html>).
+ */
+int
+fetch_no_proxy_match(const char *host)
+{
+       const char *no_proxy, *p, *q;
+       size_t h_len, d_len;
+
+       if ((no_proxy = getenv("NO_PROXY")) == NULL &&
+           (no_proxy = getenv("no_proxy")) == NULL)
+               return (0);
+
+       /* asterisk matches any hostname */
+       if (strcmp(no_proxy, "*") == 0)
+               return (1);
+
+       h_len = strlen(host);
+       p = no_proxy;
+       do {
+               /* position p at the beginning of a domain suffix */
+               while (*p == ',' || isspace((unsigned char)*p))
+                       p++;
+
+               /* position q at the first separator character */
+               for (q = p; *q; ++q)
+                       if (*q == ',' || isspace((unsigned char)*q))
+                               break;
+
+               d_len = q - p;
+               if (d_len > 0 && h_len > d_len &&
+                   strncasecmp(host + h_len - d_len,
+                       p, d_len) == 0) {
+                       /* domain name matches */
+                       return (1);
+               }
+
+               p = q + 1;
+       } while (*q);
+
+       return (0);
+}
index 4561a86..21032a7 100644 (file)
@@ -25,7 +25,7 @@
  * (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/libfetch/common.h,v 1.28 2004/09/21 18:35:20 des Exp $
+ * $FreeBSD: src/lib/libfetch/common.h,v 1.30 2007/12/18 11:03:07 des Exp $
  * $DragonFly: src/lib/libfetch/common.h,v 1.3 2007/08/05 21:48:12 swildner Exp $
  */
 
@@ -69,33 +69,34 @@ struct fetcherr {
        const char      *string;
 };
 
-/* for _fetch_writev */
+/* for fetch_writev */
 struct iovec;
 
-void            _fetch_seterr(struct fetcherr *, int);
-void            _fetch_syserr(void);
-void            _fetch_info(const char *, ...);
-int             _fetch_default_port(const char *);
-int             _fetch_default_proxy_port(const char *);
-int             _fetch_bind(int, int, const char *);
-conn_t         *_fetch_connect(const char *, int, int, int);
-conn_t         *_fetch_reopen(int);
-conn_t         *_fetch_ref(conn_t *);
-int             _fetch_ssl(conn_t *, int);
-ssize_t                 _fetch_read(conn_t *, char *, size_t);
-int             _fetch_getln(conn_t *);
-ssize_t                 _fetch_write(conn_t *, const char *, size_t);
-ssize_t                 _fetch_writev(conn_t *, struct iovec *, int);
-int             _fetch_putln(conn_t *, const char *, size_t);
-int             _fetch_close(conn_t *);
-int             _fetch_add_entry(struct url_ent **, int *, int *,
+void            fetch_seterr(struct fetcherr *, int);
+void            fetch_syserr(void);
+void            fetch_info(const char *, ...);
+int             fetch_default_port(const char *);
+int             fetch_default_proxy_port(const char *);
+int             fetch_bind(int, int, const char *);
+conn_t         *fetch_connect(const char *, int, int, int);
+conn_t         *fetch_reopen(int);
+conn_t         *fetch_ref(conn_t *);
+int             fetch_ssl(conn_t *, int);
+ssize_t                 fetch_read(conn_t *, char *, size_t);
+int             fetch_getln(conn_t *);
+ssize_t                 fetch_write(conn_t *, const char *, size_t);
+ssize_t                 fetch_writev(conn_t *, struct iovec *, int);
+int             fetch_putln(conn_t *, const char *, size_t);
+int             fetch_close(conn_t *);
+int             fetch_add_entry(struct url_ent **, int *, int *,
                     const char *, struct url_stat *);
-int             _fetch_netrc_auth(struct url *url);
+int             fetch_netrc_auth(struct url *url);
+int             fetch_no_proxy_match(const char *);
 
-#define _ftp_seterr(n)  _fetch_seterr(_ftp_errlist, n)
-#define _http_seterr(n)         _fetch_seterr(_http_errlist, n)
-#define _netdb_seterr(n) _fetch_seterr(_netdb_errlist, n)
-#define _url_seterr(n)  _fetch_seterr(_url_errlist, n)
+#define ftp_seterr(n)   fetch_seterr(ftp_errlist, n)
+#define http_seterr(n)  fetch_seterr(http_errlist, n)
+#define netdb_seterr(n)         fetch_seterr(netdb_errlist, n)
+#define url_seterr(n)   fetch_seterr(url_errlist, n)
 
 #ifndef NDEBUG
 #define DEBUG(x) do { if (fetchDebug) { x; } } while (0)
@@ -104,7 +105,7 @@ int          _fetch_netrc_auth(struct url *url);
 #endif
 
 /*
- * I don't really like exporting _http_request() and _ftp_request(),
+ * I don't really like exporting http_request() and ftp_request(),
  * but the HTTP and FTP code occasionally needs to cross-call
  * eachother, and this saves me from adding a lot of special-case code
  * to handle those cases.
@@ -112,9 +113,9 @@ int          _fetch_netrc_auth(struct url *url);
  * Note that _*_request() free purl, which is way ugly but saves us a
  * whole lot of trouble.
  */
-FILE           *_http_request(struct url *, const char *,
+FILE           *http_request(struct url *, const char *,
                     struct url_stat *, struct url *, const char *);
-FILE           *_ftp_request(struct url *, const char *,
+FILE           *ftp_request(struct url *, const char *,
                     struct url_stat *, struct url *, const char *);
 
 /*
index 35813d7..6d412b5 100644 (file)
@@ -1,4 +1,5 @@
-.\" Copyright (c) 1998 Dag-Erling Coïdan Smørgrav
+.\"-
+.\" Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/lib/libfetch/fetch.3,v 1.63 2007/05/24 20:28:14 des Exp $
+.\" $FreeBSD: src/lib/libfetch/fetch.3,v 1.66 2008/12/15 08:27:44 murray Exp $
 .\" $DragonFly: src/lib/libfetch/fetch.3,v 1.5 2007/11/23 23:16:36 swildner Exp $
 .\"
-.Dd July 1, 1998
+.Dd May 10, 2009
 .Dt FETCH 3
 .Os
 .Sh NAME
@@ -165,9 +166,16 @@ struct url {
     char       *doc;
     off_t       offset;
     size_t      length;
+    time_t      ims_time;
 };
 .Ed
 .Pp
+The
+.Va ims_time
+field stores the time value for
+.Li If-Modified-Since
+HTTP requests.
+.Pp
 The pointer returned by
 .Fn fetchMakeURL
 or
@@ -236,7 +244,7 @@ structure is defined as follows in
 .In fetch.h :
 .Bd -literal
 struct url_ent {
-    char         name[MAXPATHLEN];
+    char         name[PATH_MAX];
     struct url_stat stat;
 };
 .Ed
@@ -353,6 +361,22 @@ and
 .Fn fetchPutHTTP
 will use a direct connection even if a proxy server is defined.
 .Pp
+If the
+.Ql i
+(if-modified-since) flag is specified, and
+the
+.Va ims_time
+field is set in
+.Vt "struct url" ,
+then
+.Fn fetchXGetHTTP
+and
+.Fn fetchGetHTTP
+will send a conditional
+.Li If-Modified-Since
+HTTP header to only fetch the content if it is newer than
+.Va ims_time .
+.Pp
 Since there seems to be no good way of implementing the HTTP PUT
 method in a manner consistent with the rest of the
 .Nm fetch
@@ -532,6 +556,14 @@ See
 .Xr ftp 1
 for a description of the file format.
 This feature is experimental.
+.It Ev NO_PROXY
+Either a single asterisk, which disables the use of proxies
+altogether, or a comma- or whitespace-separated list of hosts for
+which proxies should not be used.
+.It Ev no_proxy
+Same as
+.Ev NO_PROXY ,
+for compatibility.
 .El
 .Sh EXAMPLES
 To access a proxy server on
@@ -555,6 +587,14 @@ environment variable:
 HTTP_PROXY=http://proxy.example.com:8080
 HTTP_PROXY_AUTH=basic:*:<user>:<pwd>
 .Ed
+.Pp
+To disable the use of a proxy for an HTTP server running on the local
+host, define
+.Ev NO_PROXY
+as follows:
+.Bd -literal -offset indent
+NO_PROXY=localhost,127.0.0.1
+.Ed
 .Sh SEE ALSO
 .Xr fetch 1 ,
 .Xr ftpio 3 ,
@@ -631,7 +671,7 @@ and
 .An Jordan K. Hubbard Aq jkh@FreeBSD.org .
 .Pp
 This manual page was written by
-.An Dag-Erling Co\(:idan Sm\(/orgrav Aq des@FreeBSD.org .
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
 .Sh BUGS
 Some parts of the library are not yet implemented.
 The most notable
index 1b5754d..3f06c7e 100644 (file)
@@ -25,7 +25,7 @@
  * (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/libfetch/fetch.c,v 1.38 2004/09/21 18:35:20 des Exp $
+ * $FreeBSD: src/lib/libfetch/fetch.c,v 1.42 2008/12/17 18:00:18 murray Exp $
  * $DragonFly: src/lib/libfetch/fetch.c,v 1.3 2007/08/05 21:48:12 swildner Exp $
  */
 
@@ -56,7 +56,7 @@ int    fetchDebug;
 #define URL_MALFORMED          1
 #define URL_BAD_SCHEME         2
 #define URL_BAD_PORT           3
-static struct fetcherr _url_errlist[] = {
+static struct fetcherr url_errlist[] = {
        { URL_MALFORMED,        FETCH_URL,      "Malformed URL" },
        { URL_BAD_SCHEME,       FETCH_URL,      "Invalid URL scheme" },
        { URL_BAD_PORT,         FETCH_URL,      "Invalid server port" },
@@ -74,9 +74,7 @@ static struct fetcherr _url_errlist[] = {
 FILE *
 fetchXGet(struct url *URL, struct url_stat *us, const char *flags)
 {
-       int direct;
 
-       direct = CHECK_FLAG('d');
        if (us != NULL) {
                us->size = -1;
                us->atime = us->mtime = 0;
@@ -89,7 +87,7 @@ fetchXGet(struct url *URL, struct url_stat *us, const char *flags)
                return (fetchXGetHTTP(URL, us, flags));
        else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
                return (fetchXGetHTTP(URL, us, flags));
-       _url_seterr(URL_BAD_SCHEME);
+       url_seterr(URL_BAD_SCHEME);
        return (NULL);
 }
 
@@ -110,9 +108,7 @@ fetchGet(struct url *URL, const char *flags)
 FILE *
 fetchPut(struct url *URL, const char *flags)
 {
-       int direct;
 
-       direct = CHECK_FLAG('d');
        if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
                return (fetchPutFile(URL, flags));
        else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
@@ -121,7 +117,7 @@ fetchPut(struct url *URL, const char *flags)
                return (fetchPutHTTP(URL, flags));
        else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
                return (fetchPutHTTP(URL, flags));
-       _url_seterr(URL_BAD_SCHEME);
+       url_seterr(URL_BAD_SCHEME);
        return (NULL);
 }
 
@@ -132,9 +128,7 @@ fetchPut(struct url *URL, const char *flags)
 int
 fetchStat(struct url *URL, struct url_stat *us, const char *flags)
 {
-       int direct;
 
-       direct = CHECK_FLAG('d');
        if (us != NULL) {
                us->size = -1;
                us->atime = us->mtime = 0;
@@ -147,7 +141,7 @@ fetchStat(struct url *URL, struct url_stat *us, const char *flags)
                return (fetchStatHTTP(URL, us, flags));
        else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
                return (fetchStatHTTP(URL, us, flags));
-       _url_seterr(URL_BAD_SCHEME);
+       url_seterr(URL_BAD_SCHEME);
        return (-1);
 }
 
@@ -158,9 +152,7 @@ fetchStat(struct url *URL, struct url_stat *us, const char *flags)
 struct url_ent *
 fetchList(struct url *URL, const char *flags)
 {
-       int direct;
 
-       direct = CHECK_FLAG('d');
        if (strcasecmp(URL->scheme, SCHEME_FILE) == 0)
                return (fetchListFile(URL, flags));
        else if (strcasecmp(URL->scheme, SCHEME_FTP) == 0)
@@ -169,7 +161,7 @@ fetchList(struct url *URL, const char *flags)
                return (fetchListHTTP(URL, flags));
        else if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0)
                return (fetchListHTTP(URL, flags));
-       _url_seterr(URL_BAD_SCHEME);
+       url_seterr(URL_BAD_SCHEME);
        return (NULL);
 }
 
@@ -264,23 +256,23 @@ fetchMakeURL(const char *scheme, const char *host, int port, const char *doc,
        struct url *u;
 
        if (!scheme || (!host && !doc)) {
-               _url_seterr(URL_MALFORMED);
+               url_seterr(URL_MALFORMED);
                return (NULL);
        }
 
        if (port < 0 || port > 65535) {
-               _url_seterr(URL_BAD_PORT);
+               url_seterr(URL_BAD_PORT);
                return (NULL);
        }
 
        /* allocate struct url */
        if ((u = calloc(1, sizeof(*u))) == NULL) {
-               _fetch_syserr();
+               fetch_syserr();
                return (NULL);
        }
 
        if ((u->doc = strdup(doc ? doc : "/")) == NULL) {
-               _fetch_syserr();
+               fetch_syserr();
                free(u);
                return (NULL);
        }
@@ -311,7 +303,7 @@ fetchParseURL(const char *URL)
 
        /* allocate struct url */
        if ((u = calloc(1, sizeof(*u))) == NULL) {
-               _fetch_syserr();
+               fetch_syserr();
                return (NULL);
        }
 
@@ -369,11 +361,11 @@ fetchParseURL(const char *URL)
        /* port */
        if (*p == ':') {
                for (q = ++p; *q && (*q != '/'); q++)
-                       if (isdigit(*q))
+                       if (isdigit((unsigned char)*q))
                                u->port = u->port * 10 + (*q - '0');
                        else {
                                /* invalid port */
-                               _url_seterr(URL_BAD_PORT);
+                               url_seterr(URL_BAD_PORT);
                                goto ouch;
                        }
                p = q;
@@ -390,12 +382,12 @@ nohost:
 
                /* percent-escape whitespace. */
                if ((doc = malloc(strlen(p) * 3 + 1)) == NULL) {
-                       _fetch_syserr();
+                       fetch_syserr();
                        goto ouch;
                }
                u->doc = doc;
                while (*p != '\0') {
-                       if (!isspace(*p)) {
+                       if (!isspace((unsigned char)*p)) {
                                *doc++ = *p++;
                        } else {
                                *doc++ = '%';
@@ -406,7 +398,7 @@ nohost:
                }
                *doc = '\0';
        } else if ((u->doc = strdup(p)) == NULL) {
-               _fetch_syserr();
+               fetch_syserr();
                goto ouch;
        }
 
index 6fc5af2..193922c 100644 (file)
@@ -25,7 +25,7 @@
  * (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/libfetch/fetch.h,v 1.26 2004/09/21 18:35:20 des Exp $
+ * $FreeBSD: src/lib/libfetch/fetch.h,v 1.27 2008/12/15 08:27:44 murray Exp $
  * $DragonFly: src/lib/libfetch/fetch.h,v 1.3 2007/08/05 21:48:12 swildner Exp $
  */
 
@@ -47,6 +47,7 @@ struct url {
        char            *doc;
        off_t            offset;
        size_t           length;
+       time_t           ims_time;
 };
 
 struct url_stat {
index ed955ad..35b111e 100644 (file)
@@ -25,7 +25,7 @@
  * (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/libfetch/file.c,v 1.17 2004/09/21 18:35:20 des Exp $
+ * $FreeBSD: src/lib/libfetch/file.c,v 1.18 2007/12/14 10:26:58 des Exp $
  * $DragonFly: src/lib/libfetch/file.c,v 1.3 2007/08/05 21:48:12 swildner Exp $
  */
 
@@ -50,11 +50,11 @@ fetchXGetFile(struct url *u, struct url_stat *us, const char *flags)
        f = fopen(u->doc, "r");
 
        if (f == NULL)
-               _fetch_syserr();
+               fetch_syserr();
 
        if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) {
                fclose(f);
-               _fetch_syserr();
+               fetch_syserr();
        }
 
        return (f);
@@ -77,25 +77,25 @@ fetchPutFile(struct url *u, const char *flags)
                f = fopen(u->doc, "w+");
 
        if (f == NULL)
-               _fetch_syserr();
+               fetch_syserr();
 
        if (u->offset && fseeko(f, u->offset, SEEK_SET) == -1) {
                fclose(f);
-               _fetch_syserr();
+               fetch_syserr();
        }
 
        return (f);
 }
 
 static int
-_fetch_stat_file(const char *fn, struct url_stat *us)
+fetch_stat_file(const char *fn, struct url_stat *us)
 {
        struct stat sb;
 
        us->size = -1;
        us->atime = us->mtime = 0;
        if (stat(fn, &sb) == -1) {
-               _fetch_syserr();
+               fetch_syserr();
                return (-1);
        }
        us->size = sb.st_size;
@@ -107,7 +107,7 @@ _fetch_stat_file(const char *fn, struct url_stat *us)
 int
 fetchStatFile(struct url *u, struct url_stat *us, const char *flags __unused)
 {
-       return (_fetch_stat_file(u->doc, us));
+       return (fetch_stat_file(u->doc, us));
 }
 
 struct url_ent *
@@ -122,7 +122,7 @@ fetchListFile(struct url *u, const char *flags __unused)
        int l;
 
        if ((dir = opendir(u->doc)) == NULL) {
-               _fetch_syserr();
+               fetch_syserr();
                return (NULL);
        }
 
@@ -136,10 +136,10 @@ fetchListFile(struct url *u, const char *flags __unused)
        while ((de = readdir(dir)) != NULL) {
                strncpy(p, de->d_name, l - 1);
                p[l - 1] = 0;
-               if (_fetch_stat_file(fn, &us) == -1)
+               if (fetch_stat_file(fn, &us) == -1)
                        /* should I return a partial result, or abort? */
                        break;
-               _fetch_add_entry(&ue, &size, &len, de->d_name, &us);
+               fetch_add_entry(&ue, &size, &len, de->d_name, &us);
        }
 
        return (ue);
index 0fa3b2d..bf439d0 100644 (file)
@@ -25,7 +25,7 @@
  * (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/libfetch/ftp.c,v 1.96 2007/04/22 22:33:29 njl Exp $
+ * $FreeBSD: src/lib/libfetch/ftp.c,v 1.102 2008/02/08 09:48:48 des Exp $
  * $DragonFly: src/lib/libfetch/ftp.c,v 1.4 2007/08/05 21:48:12 swildner Exp $
  */
 
 static struct url cached_host;
 static conn_t  *cached_connection;
 
-#define isftpreply(foo) (isdigit(foo[0]) && isdigit(foo[1]) \
-                        && isdigit(foo[2]) \
-                        && (foo[3] == ' ' || foo[3] == '\0'))
-#define isftpinfo(foo) (isdigit(foo[0]) && isdigit(foo[1]) \
-                       && isdigit(foo[2]) && foo[3] == '-')
+#define isftpreply(foo)                                \
+       (isdigit((unsigned char)foo[0]) &&      \
+           isdigit((unsigned char)foo[1]) &&   \
+           isdigit((unsigned char)foo[2]) &&   \
+           (foo[3] == ' ' || foo[3] == '\0'))
+#define isftpinfo(foo) \
+       (isdigit((unsigned char)foo[0]) &&      \
+           isdigit((unsigned char)foo[1]) &&   \
+           isdigit((unsigned char)foo[2]) &&   \
+           foo[3] == '-')
 
 /*
  * Translate IPv4 mapped IPv6 address to IPv4 address
@@ -135,27 +140,28 @@ unmappedaddr(struct sockaddr_in6 *sin6)
  * Get server response
  */
 static int
-_ftp_chkerr(conn_t *conn)
+ftp_chkerr(conn_t *conn)
 {
-       if (_fetch_getln(conn) == -1) {
-               _fetch_syserr();
+       if (fetch_getln(conn) == -1) {
+               fetch_syserr();
                return (-1);
        }
        if (isftpinfo(conn->buf)) {
                while (conn->buflen && !isftpreply(conn->buf)) {
-                       if (_fetch_getln(conn) == -1) {
-                               _fetch_syserr();
+                       if (fetch_getln(conn) == -1) {
+                               fetch_syserr();
                                return (-1);
                        }
                }
        }
 
-       while (conn->buflen && isspace(conn->buf[conn->buflen - 1]))
+       while (conn->buflen &&
+           isspace((unsigned char)conn->buf[conn->buflen - 1]))
                conn->buflen--;
        conn->buf[conn->buflen] = '\0';
 
        if (!isftpreply(conn->buf)) {
-               _ftp_seterr(FTP_PROTOCOL_ERROR);
+               ftp_seterr(FTP_PROTOCOL_ERROR);
                return (-1);
        }
 
@@ -170,7 +176,7 @@ _ftp_chkerr(conn_t *conn)
  * Send a command and check reply
  */
 static int
-_ftp_cmd(conn_t *conn, const char *fmt, ...)
+ftp_cmd(conn_t *conn, const char *fmt, ...)
 {
        va_list ap;
        size_t len;
@@ -183,26 +189,26 @@ _ftp_cmd(conn_t *conn, const char *fmt, ...)
 
        if (msg == NULL) {
                errno = ENOMEM;
-               _fetch_syserr();
+               fetch_syserr();
                return (-1);
        }
 
-       r = _fetch_putln(conn, msg, len);
+       r = fetch_putln(conn, msg, len);
        free(msg);
 
        if (r == -1) {
-               _fetch_syserr();
+               fetch_syserr();
                return (-1);
        }
 
-       return (_ftp_chkerr(conn));
+       return (ftp_chkerr(conn));
 }
 
 /*
  * Return a pointer to the filename part of a path
  */
 static const char *
-_ftp_filename(const char *file, int *len, int *type)
+ftp_filename(const char *file, int *len, int *type)
 {
        const char *s;
 
@@ -225,7 +231,7 @@ _ftp_filename(const char *file, int *len, int *type)
  * command.
  */
 static int
-_ftp_pwd(conn_t *conn, char *pwd, size_t pwdlen)
+ftp_pwd(conn_t *conn, char *pwd, size_t pwdlen)
 {
        char *src, *dst, *end;
        int q;
@@ -261,7 +267,7 @@ _ftp_pwd(conn_t *conn, char *pwd, size_t pwdlen)
  * file.
  */
 static int
-_ftp_cwd(conn_t *conn, const char *file)
+ftp_cwd(conn_t *conn, const char *file)
 {
        const char *beg, *end;
        char pwd[PATH_MAX];
@@ -270,9 +276,9 @@ _ftp_cwd(conn_t *conn, const char *file)
        /* If no slashes in name, no need to change dirs. */
        if ((end = strrchr(file, '/')) == NULL)
                return (0);
-       if ((e = _ftp_cmd(conn, "PWD")) != FTP_WORKING_DIRECTORY ||
-           (e = _ftp_pwd(conn, pwd, sizeof(pwd))) != FTP_OK) {
-               _ftp_seterr(e);
+       if ((e = ftp_cmd(conn, "PWD")) != FTP_WORKING_DIRECTORY ||
+           (e = ftp_pwd(conn, pwd, sizeof(pwd))) != FTP_OK) {
+               ftp_seterr(e);
                return (-1);
        }
        for (;;) {
@@ -289,10 +295,10 @@ _ftp_cwd(conn_t *conn, const char *file)
                /* Keep going up a dir until we have a matching prefix. */
                if (pwd[i] == '\0' && (file[i - 1] == '/' || file[i] == '/'))
                        break;
-               if ((e = _ftp_cmd(conn, "CDUP")) != FTP_FILE_ACTION_OK ||
-                   (e = _ftp_cmd(conn, "PWD")) != FTP_WORKING_DIRECTORY ||
-                   (e = _ftp_pwd(conn, pwd, sizeof(pwd))) != FTP_OK) {
-                       _ftp_seterr(e);
+               if ((e = ftp_cmd(conn, "CDUP")) != FTP_FILE_ACTION_OK ||
+                   (e = ftp_cmd(conn, "PWD")) != FTP_WORKING_DIRECTORY ||
+                   (e = ftp_pwd(conn, pwd, sizeof(pwd))) != FTP_OK) {
+                       ftp_seterr(e);
                        return (-1);
                }
        }
@@ -307,7 +313,7 @@ _ftp_cwd(conn_t *conn, const char *file)
                return (0);
 
        /* Change to the directory all in one chunk (e.g., foo/bar/baz). */
-       e = _ftp_cmd(conn, "CWD %.*s", (int)(end - beg), beg);
+       e = ftp_cmd(conn, "CWD %.*s", (int)(end - beg), beg);
        if (e == FTP_FILE_ACTION_OK)
                return (0);
 #endif /* FTP_COMBINE_CWDS */
@@ -318,9 +324,9 @@ _ftp_cwd(conn_t *conn, const char *file)
                        ++beg, ++i;
                for (++i; file + i < end && file[i] != '/'; ++i)
                        /* nothing */ ;
-               e = _ftp_cmd(conn, "CWD %.*s", file + i - beg, beg);
+               e = ftp_cmd(conn, "CWD %.*s", file + i - beg, beg);
                if (e != FTP_FILE_ACTION_OK) {
-                       _ftp_seterr(e);
+                       ftp_seterr(e);
                        return (-1);
                }
        }
@@ -331,7 +337,7 @@ _ftp_cwd(conn_t *conn, const char *file)
  * Set transfer mode and data type
  */
 static int
-_ftp_mode_type(conn_t *conn, int mode, int type)
+ftp_mode_type(conn_t *conn, int mode, int type)
 {
        int e;
 
@@ -344,7 +350,7 @@ _ftp_mode_type(conn_t *conn, int mode, int type)
        default:
                return (FTP_PROTOCOL_ERROR);
        }
-       if ((e = _ftp_cmd(conn, "MODE %c", mode)) != FTP_OK) {
+       if ((e = ftp_cmd(conn, "MODE %c", mode)) != FTP_OK) {
                if (mode == 'S') {
                        /*
                         * Stream mode is supposed to be the default - so
@@ -380,7 +386,7 @@ _ftp_mode_type(conn_t *conn, int mode, int type)
        default:
                return (FTP_PROTOCOL_ERROR);
        }
-       if ((e = _ftp_cmd(conn, "TYPE %c", type)) != FTP_OK)
+       if ((e = ftp_cmd(conn, "TYPE %c", type)) != FTP_OK)
                return (e);
 
        return (FTP_OK);
@@ -390,7 +396,7 @@ _ftp_mode_type(conn_t *conn, int mode, int type)
  * Request and parse file stats
  */
 static int
-_ftp_stat(conn_t *conn, const char *file, struct url_stat *us)
+ftp_stat(conn_t *conn, const char *file, struct url_stat *us)
 {
        char *ln;
        const char *filename;
@@ -402,24 +408,24 @@ _ftp_stat(conn_t *conn, const char *file, struct url_stat *us)
        us->size = -1;
        us->atime = us->mtime = 0;
 
-       filename = _ftp_filename(file, &filenamelen, &type);
+       filename = ftp_filename(file, &filenamelen, &type);
 
-       if ((e = _ftp_mode_type(conn, 0, type)) != FTP_OK) {
-               _ftp_seterr(e);
+       if ((e = ftp_mode_type(conn, 0, type)) != FTP_OK) {
+               ftp_seterr(e);
                return (-1);
        }
 
-       e = _ftp_cmd(conn, "SIZE %.*s", filenamelen, filename);
+       e = ftp_cmd(conn, "SIZE %.*s", filenamelen, filename);
        if (e != FTP_FILE_STATUS) {
-               _ftp_seterr(e);
+               ftp_seterr(e);
                return (-1);
        }
-       for (ln = conn->buf + 4; *ln && isspace(*ln); ln++)
+       for (ln = conn->buf + 4; *ln && isspace((unsigned char)*ln); ln++)
                /* nothing */ ;
-       for (us->size = 0; *ln && isdigit(*ln); ln++)
+       for (us->size = 0; *ln && isdigit((unsigned char)*ln); ln++)
                us->size = us->size * 10 + *ln - '0';
-       if (*ln && !isspace(*ln)) {
-               _ftp_seterr(FTP_PROTOCOL_ERROR);
+       if (*ln && !isspace((unsigned char)*ln)) {
+               ftp_seterr(FTP_PROTOCOL_ERROR);
                us->size = -1;
                return (-1);
        }
@@ -427,12 +433,12 @@ _ftp_stat(conn_t *conn, const char *file, struct url_stat *us)
                us->size = -1;
        DEBUG(fprintf(stderr, "size: [%lld]\n", (long long)us->size));
 
-       e = _ftp_cmd(conn, "MDTM %.*s", filenamelen, filename);
+       e = ftp_cmd(conn, "MDTM %.*s", filenamelen, filename);
        if (e != FTP_FILE_STATUS) {
-               _ftp_seterr(e);
+               ftp_seterr(e);
                return (-1);
        }
-       for (ln = conn->buf + 4; *ln && isspace(*ln); ln++)
+       for (ln = conn->buf + 4; *ln && isspace((unsigned char)*ln); ln++)
                /* nothing */ ;
        switch (strspn(ln, "0123456789")) {
        case 14:
@@ -443,13 +449,13 @@ _ftp_stat(conn_t *conn, const char *file, struct url_stat *us)
                ln[1] = '0';
                break;
        default:
-               _ftp_seterr(FTP_PROTOCOL_ERROR);
+               ftp_seterr(FTP_PROTOCOL_ERROR);
                return (-1);
        }
        if (sscanf(ln, "%04d%02d%02d%02d%02d%02d",
            &tm.tm_year, &tm.tm_mon, &tm.tm_mday,
            &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) {
-               _ftp_seterr(FTP_PROTOCOL_ERROR);
+               ftp_seterr(FTP_PROTOCOL_ERROR);
                return (-1);
        }
        tm.tm_mon--;
@@ -478,13 +484,13 @@ struct ftpio {
        int      err;           /* Error code */
 };
 
-static int      _ftp_readfn(void *, char *, int);
-static int      _ftp_writefn(void *, const char *, int);
-static fpos_t   _ftp_seekfn(void *, fpos_t, int);
-static int      _ftp_closefn(void *);
+static int      ftp_readfn(void *, char *, int);
+static int      ftp_writefn(void *, const char *, int);
+static fpos_t   ftp_seekfn(void *, fpos_t, int);
+static int      ftp_closefn(void *);
 
 static int
-_ftp_readfn(void *v, char *buf, int len)
+ftp_readfn(void *v, char *buf, int len)
 {
        struct ftpio *io;
        int r;
@@ -504,7 +510,7 @@ _ftp_readfn(void *v, char *buf, int len)
        }
        if (io->eof)
                return (0);
-       r = _fetch_read(io->dconn, buf, len);
+       r = fetch_read(io->dconn, buf, len);
        if (r > 0)
                return (r);
        if (r == 0) {
@@ -517,7 +523,7 @@ _ftp_readfn(void *v, char *buf, int len)
 }
 
 static int
-_ftp_writefn(void *v, const char *buf, int len)
+ftp_writefn(void *v, const char *buf, int len)
 {
        struct ftpio *io;
        int w;
@@ -535,7 +541,7 @@ _ftp_writefn(void *v, const char *buf, int len)
                errno = io->err;
                return (-1);
        }
-       w = _fetch_write(io->dconn, buf, len);
+       w = fetch_write(io->dconn, buf, len);
        if (w >= 0)
                return (w);
        if (errno != EINTR)
@@ -544,7 +550,7 @@ _ftp_writefn(void *v, const char *buf, int len)
 }
 
 static fpos_t
-_ftp_seekfn(void *v, fpos_t pos __unused, int whence __unused)
+ftp_seekfn(void *v, fpos_t pos __unused, int whence __unused)
 {
        struct ftpio *io;
 
@@ -558,7 +564,7 @@ _ftp_seekfn(void *v, fpos_t pos __unused, int whence __unused)
 }
 
 static int
-_ftp_closefn(void *v)
+ftp_closefn(void *v)
 {
        struct ftpio *io;
        int r;
@@ -574,20 +580,20 @@ _ftp_closefn(void *v)
                errno = EBADF;
                return (-1);
        }
-       _fetch_close(io->dconn);
+       fetch_close(io->dconn);
        io->dir = -1;
        io->dconn = NULL;
        DEBUG(fprintf(stderr, "Waiting for final status\n"));
-       r = _ftp_chkerr(io->cconn);
+       r = ftp_chkerr(io->cconn);
        if (io->cconn == cached_connection && io->cconn->ref == 1)
                cached_connection = NULL;
-       _fetch_close(io->cconn);
+       fetch_close(io->cconn);
        free(io);
        return (r == FTP_TRANSFER_COMPLETE) ? 0 : -1;
 }
 
 static FILE *
-_ftp_setup(conn_t *cconn, conn_t *dconn, int mode)
+ftp_setup(conn_t *cconn, conn_t *dconn, int mode)
 {
        struct ftpio *io;
        FILE *f;
@@ -600,7 +606,7 @@ _ftp_setup(conn_t *cconn, conn_t *dconn, int mode)
        io->dconn = dconn;
        io->dir = mode;
        io->eof = io->err = 0;
-       f = funopen(io, _ftp_readfn, _ftp_writefn, _ftp_seekfn, _ftp_closefn);
+       f = funopen(io, ftp_readfn, ftp_writefn, ftp_seekfn, ftp_closefn);
        if (f == NULL)
                free(io);
        return (f);
@@ -610,7 +616,7 @@ _ftp_setup(conn_t *cconn, conn_t *dconn, int mode)
  * Transfer file
  */
 static FILE *
-_ftp_transfer(conn_t *conn, const char *oper, const char *file,
+ftp_transfer(conn_t *conn, const char *oper, const char *file,
     int mode, off_t offset, const char *flags)
 {
        struct sockaddr_storage sa;
@@ -636,10 +642,10 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                    strncasecmp(s, "no", 2) != 0);
 
        /* isolate filename */
-       filename = _ftp_filename(file, &filenamelen, &type);
+       filename = ftp_filename(file, &filenamelen, &type);
 
        /* set transfer mode and data type */
-       if ((e = _ftp_mode_type(conn, 0, type)) != FTP_OK)
+       if ((e = ftp_mode_type(conn, 0, type)) != FTP_OK)
                goto ouch;
 
        /* find our own address, bind, and listen */
@@ -651,7 +657,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
 
        /* open data socket */
        if ((sd = socket(sa.ss_family, SOCK_STREAM, IPPROTO_TCP)) == -1) {
-               _fetch_syserr();
+               fetch_syserr();
                return (NULL);
        }
 
@@ -663,17 +669,17 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
 
                /* send PASV command */
                if (verbose)
-                       _fetch_info("setting passive mode");
+                       fetch_info("setting passive mode");
                switch (sa.ss_family) {
                case AF_INET:
-                       if ((e = _ftp_cmd(conn, "PASV")) != FTP_PASSIVE_MODE)
+                       if ((e = ftp_cmd(conn, "PASV")) != FTP_PASSIVE_MODE)
                                goto ouch;
                        break;
                case AF_INET6:
-                       if ((e = _ftp_cmd(conn, "EPSV")) != FTP_EPASSIVE_MODE) {
+                       if ((e = ftp_cmd(conn, "EPSV")) != FTP_EPASSIVE_MODE) {
                                if (e == -1)
                                        goto ouch;
-                               if ((e = _ftp_cmd(conn, "LPSV")) !=
+                               if ((e = ftp_cmd(conn, "LPSV")) !=
                                    FTP_LPASSIVE_MODE)
                                        goto ouch;
                        }
@@ -691,7 +697,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                switch (e) {
                case FTP_PASSIVE_MODE:
                case FTP_LPASSIVE_MODE:
-                       for (p = ln + 3; *p && !isdigit(*p); p++)
+                       for (p = ln + 3; *p && !isdigit((unsigned char)*p); p++)
                                /* nothing */ ;
                        if (!*p) {
                                e = FTP_PROTOCOL_ERROR;
@@ -725,7 +731,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
 
                /* seek to required offset */
                if (offset)
-                       if (_ftp_cmd(conn, "REST %lu", (u_long)offset) != FTP_FILE_OK)
+                       if (ftp_cmd(conn, "REST %lu", (u_long)offset) != FTP_FILE_OK)
                                goto sysouch;
 
                /* construct sockaddr for data socket */
@@ -740,8 +746,8 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                        if (e == FTP_EPASSIVE_MODE)
                                sin6->sin6_port = htons(port);
                        else {
-                               bcopy(addr + 2, (char *)&sin6->sin6_addr, 16);
-                               bcopy(addr + 19, (char *)&sin6->sin6_port, 2);
+                               memcpy(&sin6->sin6_addr, addr + 2, 16);
+                               memcpy(&sin6->sin6_port, addr + 19, 2);
                        }
                        break;
                case AF_INET:
@@ -749,8 +755,8 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                        if (e == FTP_EPASSIVE_MODE)
                                sin4->sin_port = htons(port);
                        else {
-                               bcopy(addr, (char *)&sin4->sin_addr, 4);
-                               bcopy(addr + 4, (char *)&sin4->sin_port, 2);
+                               memcpy(&sin4->sin_addr, addr, 4);
+                               memcpy(&sin4->sin_port, addr + 4, 2);
                        }
                        break;
                default:
@@ -760,18 +766,18 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
 
                /* connect to data port */
                if (verbose)
-                       _fetch_info("opening data connection");
+                       fetch_info("opening data connection");
                bindaddr = getenv("FETCH_BIND_ADDRESS");
                if (bindaddr != NULL && *bindaddr != '\0' &&
-                   _fetch_bind(sd, sa.ss_family, bindaddr) != 0)
+                   fetch_bind(sd, sa.ss_family, bindaddr) != 0)
                        goto sysouch;
                if (connect(sd, (struct sockaddr *)&sa, sa.ss_len) == -1)
                        goto sysouch;
 
                /* make the server initiate the transfer */
                if (verbose)
-                       _fetch_info("initiating transfer");
-               e = _ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
+                       fetch_info("initiating transfer");
+               e = ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
                if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
                        goto ouch;
 
@@ -801,7 +807,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                        break;
                }
                if (verbose)
-                       _fetch_info("binding data socket");
+                       fetch_info("binding data socket");
                if (bind(sd, (struct sockaddr *)&sa, sa.ss_len) == -1)
                        goto sysouch;
                if (listen(sd, 1) == -1)
@@ -815,7 +821,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                        sin4 = (struct sockaddr_in *)&sa;
                        a = ntohl(sin4->sin_addr.s_addr);
                        p = ntohs(sin4->sin_port);
-                       e = _ftp_cmd(conn, "PORT %d,%d,%d,%d,%d,%d",
+                       e = ftp_cmd(conn, "PORT %d,%d,%d,%d,%d,%d",
                            (a >> 24) & 0xff, (a >> 16) & 0xff,
                            (a >> 8) & 0xff, a & 0xff,
                            (p >> 8) & 0xff, p & 0xff);
@@ -828,14 +834,14 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                        if (getnameinfo((struct sockaddr *)&sa, sa.ss_len,
                                hname, sizeof(hname),
                                NULL, 0, NI_NUMERICHOST) == 0) {
-                               e = _ftp_cmd(conn, "EPRT |%d|%s|%d|", 2, hname,
+                               e = ftp_cmd(conn, "EPRT |%d|%s|%d|", 2, hname,
                                    htons(sin6->sin6_port));
                                if (e == -1)
                                        goto ouch;
                        }
                        if (e != FTP_OK) {
                                ap = (char *)&sin6->sin6_addr;
-                               e = _ftp_cmd(conn,
+                               e = ftp_cmd(conn,
                                    "LPRT %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
                                    6, 16,
                                    UC(ap[0]), UC(ap[1]), UC(ap[2]), UC(ap[3]),
@@ -856,13 +862,13 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
 
                /* seek to required offset */
                if (offset)
-                       if (_ftp_cmd(conn, "REST %ju", (uintmax_t)offset) != FTP_FILE_OK)
+                       if (ftp_cmd(conn, "REST %ju", (uintmax_t)offset) != FTP_FILE_OK)
                                goto sysouch;
 
                /* make the server initiate the transfer */
                if (verbose)
-                       _fetch_info("initiating transfer");
-               e = _ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
+                       fetch_info("initiating transfer");
+               e = ftp_cmd(conn, "%s %.*s", oper, filenamelen, filename);
                if (e != FTP_CONNECTION_ALREADY_OPEN && e != FTP_OPEN_DATA_CONNECTION)
                        goto ouch;
 
@@ -873,19 +879,19 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
                sd = d;
        }
 
-       if ((df = _ftp_setup(conn, _fetch_reopen(sd), mode)) == NULL)
+       if ((df = ftp_setup(conn, fetch_reopen(sd), mode)) == NULL)
                goto sysouch;
        return (df);
 
 sysouch:
-       _fetch_syserr();
+       fetch_syserr();
        if (sd >= 0)
                close(sd);
        return (NULL);
 
 ouch:
        if (e != -1)
-               _ftp_seterr(e);
+               ftp_seterr(e);
        if (sd >= 0)
                close(sd);
        return (NULL);
@@ -895,7 +901,7 @@ ouch:
  * Authenticate
  */
 static int
-_ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
+ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
 {
        const char *user, *pwd, *logname;
        char pbuf[MAXHOSTNAMELEN + MAXLOGNAME + 1];
@@ -905,18 +911,18 @@ _ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
 
        /* send user name and password */
        if (url->user[0] == '\0')
-               _fetch_netrc_auth(url);
+               fetch_netrc_auth(url);
        user = url->user;
        if (*user == '\0')
                user = getenv("FTP_LOGIN");
        if (user == NULL || *user == '\0')
                user = FTP_ANONYMOUS_USER;
-       if (purl && url->port == _fetch_default_port(url->scheme))
-               e = _ftp_cmd(conn, "USER %s@%s", user, url->host);
+       if (purl && url->port == fetch_default_port(url->scheme))
+               e = ftp_cmd(conn, "USER %s@%s", user, url->host);
        else if (purl)
-               e = _ftp_cmd(conn, "USER %s@%s@%d", user, url->host, url->port);
+               e = ftp_cmd(conn, "USER %s@%s@%d", user, url->host, url->port);
        else
-               e = _ftp_cmd(conn, "USER %s", user);
+               e = ftp_cmd(conn, "USER %s", user);
 
        /* did the server request a password? */
        if (e == FTP_NEED_PASSWORD) {
@@ -933,7 +939,7 @@ _ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
                        gethostname(pbuf + len, sizeof(pbuf) - len);
                        pwd = pbuf;
                }
-               e = _ftp_cmd(conn, "PASS %s", pwd);
+               e = ftp_cmd(conn, "PASS %s", pwd);
        }
 
        return (e);
@@ -943,7 +949,7 @@ _ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
  * Log on to FTP server
  */
 static conn_t *
-_ftp_connect(struct url *url, struct url *purl, const char *flags)
+ftp_connect(struct url *url, struct url *purl, const char *flags)
 {
        conn_t *conn;
        int e, direct, verbose;
@@ -966,24 +972,24 @@ _ftp_connect(struct url *url, struct url *purl, const char *flags)
        /* check for proxy */
        if (purl) {
                /* XXX proxy authentication! */
-               conn = _fetch_connect(purl->host, purl->port, af, verbose);
+               conn = fetch_connect(purl->host, purl->port, af, verbose);
        } else {
                /* no proxy, go straight to target */
-               conn = _fetch_connect(url->host, url->port, af, verbose);
+               conn = fetch_connect(url->host, url->port, af, verbose);
                purl = NULL;
        }
 
        /* check connection */
        if (conn == NULL)
-               /* _fetch_connect() has already set an error code */
+               /* fetch_connect() has already set an error code */
                return (NULL);
 
        /* expect welcome message */
-       if ((e = _ftp_chkerr(conn)) != FTP_SERVICE_READY)
+       if ((e = ftp_chkerr(conn)) != FTP_SERVICE_READY)
                goto fouch;
 
        /* authenticate */
-       if ((e = _ftp_authenticate(conn, url, purl)) != FTP_LOGGED_IN)
+       if ((e = ftp_authenticate(conn, url, purl)) != FTP_LOGGED_IN)
                goto fouch;
 
        /* TODO: Request extended features supported, if any (RFC 3659). */
@@ -993,8 +999,8 @@ _ftp_connect(struct url *url, struct url *purl, const char *flags)
 
 fouch:
        if (e != -1)
-               _ftp_seterr(e);
-       _fetch_close(conn);
+               ftp_seterr(e);
+       fetch_close(conn);
        return (NULL);
 }
 
@@ -1002,19 +1008,19 @@ fouch:
  * Disconnect from server
  */
 static void
-_ftp_disconnect(conn_t *conn)
+ftp_disconnect(conn_t *conn)
 {
-       (void)_ftp_cmd(conn, "QUIT");
+       (void)ftp_cmd(conn, "QUIT");
        if (conn == cached_connection && conn->ref == 1)
                cached_connection = NULL;
-       _fetch_close(conn);
+       fetch_close(conn);
 }
 
 /*
  * Check if we're already connected
  */
 static int
-_ftp_isconnected(struct url *url)
+ftp_isconnected(struct url *url)
 {
        return (cached_connection
            && (strcmp(url->host, cached_host.host) == 0)
@@ -1027,28 +1033,28 @@ _ftp_isconnected(struct url *url)
  * Check the cache, reconnect if no luck
  */
 static conn_t *
-_ftp_cached_connect(struct url *url, struct url *purl, const char *flags)
+ftp_cached_connect(struct url *url, struct url *purl, const char *flags)
 {
        conn_t *conn;
        int e;
 
        /* set default port */
        if (!url->port)
-               url->port = _fetch_default_port(url->scheme);
+               url->port = fetch_default_port(url->scheme);
 
        /* try to use previously cached connection */
-       if (_ftp_isconnected(url)) {
-               e = _ftp_cmd(cached_connection, "NOOP");
+       if (ftp_isconnected(url)) {
+               e = ftp_cmd(cached_connection, "NOOP");
                if (e == FTP_OK || e == FTP_SYNTAX_ERROR)
-                       return (_fetch_ref(cached_connection));
+                       return (fetch_ref(cached_connection));
        }
 
        /* connect to server */
-       if ((conn = _ftp_connect(url, purl, flags)) == NULL)
+       if ((conn = ftp_connect(url, purl, flags)) == NULL)
                return (NULL);
        if (cached_connection)
-               _ftp_disconnect(cached_connection);
-       cached_connection = _fetch_ref(conn);
+               ftp_disconnect(cached_connection);
+       cached_connection = fetch_ref(conn);
        memcpy(&cached_host, url, sizeof(*url));
        return (conn);
 }
@@ -1057,13 +1063,15 @@ _ftp_cached_connect(struct url *url, struct url *purl, const char *flags)
  * Check the proxy settings
  */
 static struct url *
-_ftp_get_proxy(const char *flags)
+ftp_get_proxy(struct url * url, const char *flags)
 {
        struct url *purl;
        char *p;
 
        if (flags != NULL && strchr(flags, 'd') != NULL)
                return (NULL);
+       if (fetch_no_proxy_match(url->host))
+               return (NULL);
        if (((p = getenv("FTP_PROXY")) || (p = getenv("ftp_proxy")) ||
                (p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
            *p && (purl = fetchParseURL(p)) != NULL) {
@@ -1074,7 +1082,7 @@ _ftp_get_proxy(const char *flags)
                                strcpy(purl->scheme, SCHEME_HTTP);
                }
                if (!purl->port)
-                       purl->port = _fetch_default_proxy_port(purl->scheme);
+                       purl->port = fetch_default_proxy_port(purl->scheme);
                if (strcasecmp(purl->scheme, SCHEME_FTP) == 0 ||
                    strcasecmp(purl->scheme, SCHEME_HTTP) == 0)
                        return (purl);
@@ -1087,7 +1095,7 @@ _ftp_get_proxy(const char *flags)
  * Process an FTP request
  */
 FILE *
-_ftp_request(struct url *url, const char *op, struct url_stat *us,
+ftp_request(struct url *url, const char *op, struct url_stat *us,
     struct url *purl, const char *flags)
 {
        conn_t *conn;
@@ -1096,9 +1104,9 @@ _ftp_request(struct url *url, const char *op, struct url_stat *us,
        /* check if we should use HTTP instead */
        if (purl && strcasecmp(purl->scheme, SCHEME_HTTP) == 0) {
                if (strcmp(op, "STAT") == 0)
-                       return (_http_request(url, "HEAD", us, purl, flags));
+                       return (http_request(url, "HEAD", us, purl, flags));
                else if (strcmp(op, "RETR") == 0)
-                       return (_http_request(url, "GET", us, purl, flags));
+                       return (http_request(url, "GET", us, purl, flags));
                /*
                 * Our HTTP code doesn't support PUT requests yet, so try
                 * a direct connection.
@@ -1106,18 +1114,18 @@ _ftp_request(struct url *url, const char *op, struct url_stat *us,
        }
 
        /* connect to server */
-       conn = _ftp_cached_connect(url, purl, flags);
+       conn = ftp_cached_connect(url, purl, flags);
        if (purl)
                fetchFreeURL(purl);
        if (conn == NULL)
                return (NULL);
 
        /* change directory */
-       if (_ftp_cwd(conn, url->doc) == -1)
+       if (ftp_cwd(conn, url->doc) == -1)
                return (NULL);
 
        /* stat file */
-       if (us && _ftp_stat(conn, url->doc, us) == -1
+       if (us && ftp_stat(conn, url->doc, us) == -1
            && fetchLastErrCode != FETCH_PROTO
            && fetchLastErrCode != FETCH_UNAVAIL)
                return (NULL);
@@ -1131,7 +1139,7 @@ _ftp_request(struct url *url, const char *op, struct url_stat *us,
                oflag = O_RDONLY;
 
        /* initiate the transfer */
-       return (_ftp_transfer(conn, op, url->doc, oflag, url->offset, flags));
+       return (ftp_transfer(conn, op, url->doc, oflag, url->offset, flags));
 }
 
 /*
@@ -1140,7 +1148,7 @@ _ftp_request(struct url *url, const char *op, struct url_stat *us,
 FILE *
 fetchXGetFTP(struct url *url, struct url_stat *us, const char *flags)
 {
-       return (_ftp_request(url, "RETR", us, _ftp_get_proxy(flags), flags));
+       return (ftp_request(url, "RETR", us, ftp_get_proxy(url, flags), flags));
 }
 
 /*
@@ -1158,9 +1166,8 @@ fetchGetFTP(struct url *url, const char *flags)
 FILE *
 fetchPutFTP(struct url *url, const char *flags)
 {
-
-       return (_ftp_request(url, CHECK_FLAG('a') ? "APPE" : "STOR", NULL,
-           _ftp_get_proxy(flags), flags));
+       return (ftp_request(url, CHECK_FLAG('a') ? "APPE" : "STOR", NULL,
+           ftp_get_proxy(url, flags), flags));
 }
 
 /*
@@ -1171,9 +1178,14 @@ fetchStatFTP(struct url *url, struct url_stat *us, const char *flags)
 {
        FILE *f;
 
-       f = _ftp_request(url, "STAT", us, _ftp_get_proxy(flags), flags);
+       f = ftp_request(url, "STAT", us, ftp_get_proxy(url, flags), flags);
        if (f == NULL)
                return (-1);
+       /*
+        * When op is "STAT", ftp_request() will return either NULL or
+        * (FILE *)1, never a valid FILE *, so we mustn't fclose(f) before
+        * returning, as it would cause a segfault.
+        */
        return (0);
 }
 
index f9ce043..86b3e23 100644 (file)
@@ -25,7 +25,7 @@
  * (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/libfetch/http.c,v 1.78 2007/05/08 19:28:03 des Exp $
+ * $FreeBSD: src/lib/libfetch/http.c,v 1.86 2008/12/15 08:27:44 murray Exp $
  * $DragonFly: src/lib/libfetch/http.c,v 1.4 2007/08/05 21:48:12 swildner Exp $
  */
 
@@ -63,6 +63,7 @@
 
 #include <sys/param.h>
 #include <sys/socket.h>
+#include <sys/time.h>
 
 #include <ctype.h>
 #include <err.h>
@@ -92,6 +93,7 @@
 #define HTTP_MOVED_PERM                301
 #define HTTP_MOVED_TEMP                302
 #define HTTP_SEE_OTHER         303
+#define HTTP_NOT_MODIFIED      304
 #define HTTP_TEMP_REDIRECT     307
 #define HTTP_NEED_AUTH         401
 #define HTTP_NEED_PROXY_AUTH   407
@@ -130,27 +132,27 @@ struct httpio
  * Get next chunk header
  */
 static int
-_http_new_chunk(struct httpio *io)
+http_new_chunk(struct httpio *io)
 {
        char *p;
 
-       if (_fetch_getln(io->conn) == -1)
+       if (fetch_getln(io->conn) == -1)
                return (-1);
 
-       if (io->conn->buflen < 2 || !isxdigit(*io->conn->buf))
+       if (io->conn->buflen < 2 || !isxdigit((unsigned char)*io->conn->buf))
                return (-1);
 
-       for (p = io->conn->buf; *p && !isspace(*p); ++p) {
+       for (p = io->conn->buf; *p && !isspace((unsigned char)*p); ++p) {
                if (*p == ';')
                        break;
-               if (!isxdigit(*p))
+               if (!isxdigit((unsigned char)*p))
                        return (-1);
-               if (isdigit(*p)) {
+               if (isdigit((unsigned char)*p)) {
                        io->chunksize = io->chunksize * 16 +
                            *p - '0';
                } else {
                        io->chunksize = io->chunksize * 16 +
-                           10 + tolower(*p) - 'a';
+                           10 + tolower((unsigned char)*p) - 'a';
                }
        }
 
@@ -173,7 +175,7 @@ _http_new_chunk(struct httpio *io)
  * Grow the input buffer to at least len bytes
  */
 static inline int
-_http_growbuf(struct httpio *io, size_t len)
+http_growbuf(struct httpio *io, size_t len)
 {
        char *tmp;
 
@@ -191,7 +193,7 @@ _http_growbuf(struct httpio *io, size_t len)
  * Fill the input buffer, do chunk decoding on the fly
  */
 static int
-_http_fillbuf(struct httpio *io, size_t len)
+http_fillbuf(struct httpio *io, size_t len)
 {
        if (io->error)
                return (-1);
@@ -199,9 +201,9 @@ _http_fillbuf(struct httpio *io, size_t len)
                return (0);
 
        if (io->chunked == 0) {
-               if (_http_growbuf(io, len) == -1)
+               if (http_growbuf(io, len) == -1)
                        return (-1);
-               if ((io->buflen = _fetch_read(io->conn, io->buf, len)) == -1) {
+               if ((io->buflen = fetch_read(io->conn, io->buf, len)) == -1) {
                        io->error = 1;
                        return (-1);
                }
@@ -210,7 +212,7 @@ _http_fillbuf(struct httpio *io, size_t len)
        }
 
        if (io->chunksize == 0) {
-               switch (_http_new_chunk(io)) {
+               switch (http_new_chunk(io)) {
                case -1:
                        io->error = 1;
                        return (-1);
@@ -222,9 +224,9 @@ _http_fillbuf(struct httpio *io, size_t len)
 
        if (len > io->chunksize)
                len = io->chunksize;
-       if (_http_growbuf(io, len) == -1)
+       if (http_growbuf(io, len) == -1)
                return (-1);
-       if ((io->buflen = _fetch_read(io->conn, io->buf, len)) == -1) {
+       if ((io->buflen = fetch_read(io->conn, io->buf, len)) == -1) {
                io->error = 1;
                return (-1);
        }
@@ -233,7 +235,7 @@ _http_fillbuf(struct httpio *io, size_t len)
        if (io->chunksize == 0) {
                char endl[2];
 
-               if (_fetch_read(io->conn, endl, 2) != 2 ||
+               if (fetch_read(io->conn, endl, 2) != 2 ||
                    endl[0] != '\r' || endl[1] != '\n')
                        return (-1);
        }
@@ -247,7 +249,7 @@ _http_fillbuf(struct httpio *io, size_t len)
  * Read function
  */
 static int
-_http_readfn(void *v, char *buf, int len)
+http_readfn(void *v, char *buf, int len)
 {
        struct httpio *io = (struct httpio *)v;
        int l, pos;
@@ -260,12 +262,12 @@ _http_readfn(void *v, char *buf, int len)
        for (pos = 0; len > 0; pos += l, len -= l) {
                /* empty buffer */
                if (!io->buf || io->bufpos == io->buflen)
-                       if (_http_fillbuf(io, len) < 1)
+                       if (http_fillbuf(io, len) < 1)
                                break;
                l = io->buflen - io->bufpos;
                if (len < l)
                        l = len;
-               bcopy(io->buf + io->bufpos, buf + pos, l);
+               memcpy(buf + pos, io->buf + io->bufpos, l);
                io->bufpos += l;
        }
 
@@ -278,23 +280,23 @@ _http_readfn(void *v, char *buf, int len)
  * Write function
  */
 static int
-_http_writefn(void *v, const char *buf, int len)
+http_writefn(void *v, const char *buf, int len)
 {
        struct httpio *io = (struct httpio *)v;
 
-       return (_fetch_write(io->conn, buf, len));
+       return (fetch_write(io->conn, buf, len));
 }
 
 /*
  * Close function
  */
 static int
-_http_closefn(void *v)
+http_closefn(void *v)
 {
        struct httpio *io = (struct httpio *)v;
        int r;
 
-       r = _fetch_close(io->conn);
+       r = fetch_close(io->conn);
        if (io->buf)
                free(io->buf);
        free(io);
@@ -305,20 +307,20 @@ _http_closefn(void *v)
  * Wrap a file descriptor up
  */
 static FILE *
-_http_funopen(conn_t *conn, int chunked)
+http_funopen(conn_t *conn, int chunked)
 {
        struct httpio *io;
        FILE *f;
 
        if ((io = calloc(1, sizeof(*io))) == NULL) {
-               _fetch_syserr();
+               fetch_syserr();
                return (NULL);
        }
        io->conn = conn;
        io->chunked = chunked;
-       f = funopen(io, _http_readfn, _http_writefn, NULL, _http_closefn);
+       f = funopen(io, http_readfn, http_writefn, NULL, http_closefn);
        if (f == NULL) {
-               _fetch_syserr();
+               fetch_syserr();
                free(io);
                return (NULL);
        }
@@ -362,7 +364,7 @@ static struct {
  * Send a formatted line; optionally echo to terminal
  */
 static int
-_http_cmd(conn_t *conn, const char *fmt, ...)
+http_cmd(conn_t *conn, const char *fmt, ...)
 {
        va_list ap;
        size_t len;
@@ -375,15 +377,15 @@ _http_cmd(conn_t *conn, const char *fmt, ...)
 
        if (msg == NULL) {
                errno = ENOMEM;
-               _fetch_syserr();
+               fetch_syserr();
                return (-1);
        }
 
-       r = _fetch_putln(conn, msg, len);
+       r = fetch_putln(conn, msg, len);
        free(msg);
 
        if (r == -1) {
-               _fetch_syserr();
+               fetch_syserr();
                return (-1);
        }
 
@@ -394,11 +396,11 @@ _http_cmd(conn_t *conn, const char *fmt, ...)
  * Get and parse status line
  */
 static int
-_http_get_reply(conn_t *conn)
+http_get_reply(conn_t *conn)
 {
        char *p;
 
-       if (_fetch_getln(conn) == -1)
+       if (fetch_getln(conn) == -1)
                return (-1);
        /*
         * A valid status line looks like "HTTP/m.n xyz reason" where m
@@ -417,7 +419,10 @@ _http_get_reply(conn_t *conn)
                        return (HTTP_PROTOCOL_ERROR);
                p += 4;
        }
-       if (*p != ' ' || !isdigit(p[1]) || !isdigit(p[2]) || !isdigit(p[3]))
+       if (*p != ' ' ||
+           !isdigit((unsigned char)p[1]) ||
+           !isdigit((unsigned char)p[2]) ||
+           !isdigit((unsigned char)p[3]))
                return (HTTP_PROTOCOL_ERROR);
 
        conn->err = (p[1] - '0') * 100 + (p[2] - '0') * 10 + (p[3] - '0');
@@ -429,13 +434,14 @@ _http_get_reply(conn_t *conn)
  * to the beginning of the value.
  */
 static const char *
-_http_match(const char *str, const char *hdr)
+http_match(const char *str, const char *hdr)
 {
-       while (*str && *hdr && tolower(*str++) == tolower(*hdr++))
+       while (*str && *hdr &&
+           tolower((unsigned char)*str++) == tolower((unsigned char)*hdr++))
                /* nothing */;
        if (*str || *hdr != ':')
                return (NULL);
-       while (*hdr && isspace(*++hdr))
+       while (*hdr && isspace((unsigned char)*++hdr))
                /* nothing */;
        return (hdr);
 }
@@ -444,13 +450,13 @@ _http_match(const char *str, const char *hdr)
  * Get the next header and return the appropriate symbolic code.
  */
 static hdr_t
-_http_next_header(conn_t *conn, const char **p)
+http_next_header(conn_t *conn, const char **p)
 {
        int i;
 
-       if (_fetch_getln(conn) == -1)
+       if (fetch_getln(conn) == -1)
                return (hdr_syserror);
-       while (conn->buflen && isspace(conn->buf[conn->buflen - 1]))
+       while (conn->buflen && isspace((unsigned char)conn->buf[conn->buflen - 1]))
                conn->buflen--;
        conn->buf[conn->buflen] = '\0';
        if (conn->buflen == 0)
@@ -462,7 +468,7 @@ _http_next_header(conn_t *conn, const char **p)
         * characters except "()<>@,;:\\\"{}".
         */
        for (i = 0; hdr_names[i].num != hdr_unknown; i++)
-               if ((*p = _http_match(hdr_names[i].name, conn->buf)) != NULL)
+               if ((*p = http_match(hdr_names[i].name, conn->buf)) != NULL)
                        return (hdr_names[i].num);
        return (hdr_unknown);
 }
@@ -471,7 +477,7 @@ _http_next_header(conn_t *conn, const char **p)
  * Parse a last-modified header
  */
 static int
-_http_parse_mtime(const char *p, time_t *mtime)
+http_parse_mtime(const char *p, time_t *mtime)
 {
        char locale[64], *r;
        struct tm tm;
@@ -495,11 +501,11 @@ _http_parse_mtime(const char *p, time_t *mtime)
  * Parse a content-length header
  */
 static int
-_http_parse_length(const char *p, off_t *length)
+http_parse_length(const char *p, off_t *length)
 {
        off_t len;
 
-       for (len = 0; *p && isdigit(*p); ++p)
+       for (len = 0; *p && isdigit((unsigned char)*p); ++p)
                len = len * 10 + (*p - '0');
        if (*p)
                return (-1);
@@ -513,7 +519,7 @@ _http_parse_length(const char *p, off_t *length)
  * Parse a content-range header
  */
 static int
-_http_parse_range(const char *p, off_t *offset, off_t *length, off_t *size)
+http_parse_range(const char *p, off_t *offset, off_t *length, off_t *size)
 {
        off_t first, last, len;
 
@@ -524,16 +530,16 @@ _http_parse_range(const char *p, off_t *offset, off_t *length, off_t *size)
                first = last = -1;
                ++p;
        } else {
-               for (first = 0; *p && isdigit(*p); ++p)
+               for (first = 0; *p && isdigit((unsigned char)*p); ++p)
                        first = first * 10 + *p - '0';
                if (*p != '-')
                        return (-1);
-               for (last = 0, ++p; *p && isdigit(*p); ++p)
+               for (last = 0, ++p; *p && isdigit((unsigned char)*p); ++p)
                        last = last * 10 + *p - '0';
        }
        if (first > last || *p != '/')
                return (-1);
-       for (len = 0, ++p; *p && isdigit(*p); ++p)
+       for (len = 0, ++p; *p && isdigit((unsigned char)*p); ++p)
                len = len * 10 + *p - '0';
        if (*p || len < last - first + 1)
                return (-1);
@@ -560,7 +566,7 @@ _http_parse_range(const char *p, off_t *offset, off_t *length, off_t *size)
  * Base64 encoding
  */
 static char *
-_http_base64(const char *src)
+http_base64(const char *src)
 {
        static const char base64[] =
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
@@ -616,7 +622,7 @@ _http_base64(const char *src)
  * Encode username and password
  */
 static int
-_http_basic_auth(conn_t *conn, const char *hdr, const char *usr, const char *pwd)
+http_basic_auth(conn_t *conn, const char *hdr, const char *usr, const char *pwd)
 {
        char *upw, *auth;
        int r;
@@ -625,11 +631,11 @@ _http_basic_auth(conn_t *conn, const char *hdr, const char *usr, const char *pwd
        DEBUG(fprintf(stderr, "pwd: [%s]\n", pwd));
        if (asprintf(&upw, "%s:%s", usr, pwd) == -1)
                return (-1);
-       auth = _http_base64(upw);
+       auth = http_base64(upw);
        free(upw);
        if (auth == NULL)
                return (-1);
-       r = _http_cmd(conn, "%s: Basic %s", hdr, auth);
+       r = http_cmd(conn, "%s: Basic %s", hdr, auth);
        free(auth);
        return (r);
 }
@@ -638,7 +644,7 @@ _http_basic_auth(conn_t *conn, const char *hdr, const char *usr, const char *pwd
  * Send an authorization header
  */
 static int
-_http_authorize(conn_t *conn, const char *hdr, const char *p)
+http_authorize(conn_t *conn, const char *hdr, const char *p)
 {
        /* basic authorization */
        if (strncasecmp(p, "basic:", 6) == 0) {
@@ -655,7 +661,7 @@ _http_authorize(conn_t *conn, const char *hdr, const char *p)
                user = str;
                pwd = strchr(str, ':');
                *pwd++ = '\0';
-               r = _http_basic_auth(conn, hdr, user, pwd);
+               r = http_basic_auth(conn, hdr, user, pwd);
                free(str);
                return (r);
        }
@@ -671,7 +677,7 @@ _http_authorize(conn_t *conn, const char *hdr, const char *p)
  * Connect to the correct HTTP server or proxy.
  */
 static conn_t *
-_http_connect(struct url *URL, struct url *purl, const char *flags)
+http_connect(struct url *URL, struct url *purl, const char *flags)
 {
        conn_t *conn;
        int verbose;
@@ -699,15 +705,15 @@ _http_connect(struct url *URL, struct url *purl, const char *flags)
                return (NULL);
        }
 
-       if ((conn = _fetch_connect(URL->host, URL->port, af, verbose)) == NULL)
-               /* _fetch_connect() has already set an error code */
+       if ((conn = fetch_connect(URL->host, URL->port, af, verbose)) == NULL)
+               /* fetch_connect() has already set an error code */
                return (NULL);
        if (strcasecmp(URL->scheme, SCHEME_HTTPS) == 0 &&
-           _fetch_ssl(conn, verbose) == -1) {
-               _fetch_close(conn);
+           fetch_ssl(conn, verbose) == -1) {
+               fetch_close(conn);
                /* grrr */
                errno = EAUTH;
-               _fetch_syserr();
+               fetch_syserr();
                return (NULL);
        }
 
@@ -718,19 +724,21 @@ _http_connect(struct url *URL, struct url *purl, const char *flags)
 }
 
 static struct url *
-_http_get_proxy(const char *flags)
+http_get_proxy(struct url * url, const char *flags)
 {
        struct url *purl;
        char *p;
 
        if (flags != NULL && strchr(flags, 'd') != NULL)
                return (NULL);
+       if (fetch_no_proxy_match(url->host))
+               return (NULL);
        if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
            *p && (purl = fetchParseURL(p))) {
                if (!*purl->scheme)
                        strcpy(purl->scheme, SCHEME_HTTP);
                if (!purl->port)
-                       purl->port = _fetch_default_proxy_port(purl->scheme);
+                       purl->port = fetch_default_proxy_port(purl->scheme);
                if (strcasecmp(purl->scheme, SCHEME_HTTP) == 0)
                        return (purl);
                fetchFreeURL(purl);
@@ -739,7 +747,7 @@ _http_get_proxy(const char *flags)
 }
 
 static void
-_http_print_html(FILE *out, FILE *in)
+http_print_html(FILE *out, FILE *in)
 {
        size_t len;
        char *line, *p, *q;
@@ -747,7 +755,7 @@ _http_print_html(FILE *out, FILE *in)
 
        comment = tag = 0;
        while ((line = fgetln(in, &len)) != NULL) {
-               while (len && isspace(line[len - 1]))
+               while (len && isspace((unsigned char)line[len - 1]))
                        --len;
                for (p = q = line; q < line + len; ++q) {
                        if (comment && *q == '-') {
@@ -788,23 +796,26 @@ _http_print_html(FILE *out, FILE *in)
  * XXX off into a separate function.
  */
 FILE *
-_http_request(struct url *URL, const char *op, struct url_stat *us,
+http_request(struct url *URL, const char *op, struct url_stat *us,
     struct url *purl, const char *flags)
 {
+       char timebuf[80];
+       char hbuf[MAXHOSTNAMELEN + 7], *host;
        conn_t *conn;
        struct url *url, *new;
-       int chunked, direct, need_auth, noredirect, verbose;
+       int chunked, direct, ims, need_auth, noredirect, verbose;
        int e, i, n, val;
        off_t offset, clength, length, size;
        time_t mtime;
        const char *p;
        FILE *f;
        hdr_t h;
-       char hbuf[MAXHOSTNAMELEN + 7], *host;
+       struct tm *timestruct;
 
        direct = CHECK_FLAG('d');
        noredirect = CHECK_FLAG('A');
        verbose = CHECK_FLAG('v');
+       ims = CHECK_FLAG('i');
 
        if (direct && purl) {
                fetchFreeURL(purl);
@@ -831,18 +842,18 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
 
                /* check port */
                if (!url->port)
-                       url->port = _fetch_default_port(url->scheme);
+                       url->port = fetch_default_port(url->scheme);
 
                /* were we redirected to an FTP URL? */
                if (purl == NULL && strcmp(url->scheme, SCHEME_FTP) == 0) {
                        if (strcmp(op, "GET") == 0)
-                               return (_ftp_request(url, "RETR", us, purl, flags));
+                               return (ftp_request(url, "RETR", us, purl, flags));
                        else if (strcmp(op, "HEAD") == 0)
-                               return (_ftp_request(url, "STAT", us, purl, flags));
+                               return (ftp_request(url, "STAT", us, purl, flags));
                }
 
                /* connect to server or proxy */
-               if ((conn = _http_connect(url, purl, flags)) == NULL)
+               if ((conn = http_connect(url, purl, flags)) == NULL)
                        goto ouch;
 
                host = url->host;
@@ -852,7 +863,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                        host = hbuf;
                }
 #endif
-               if (url->port != _fetch_default_port(url->scheme)) {
+               if (url->port != fetch_default_port(url->scheme)) {
                        if (host != hbuf) {
                                strcpy(hbuf, host);
                                host = hbuf;
@@ -863,38 +874,46 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
 
                /* send request */
                if (verbose)
-                       _fetch_info("requesting %s://%s%s",
+                       fetch_info("requesting %s://%s%s",
                            url->scheme, host, url->doc);
                if (purl) {
-                       _http_cmd(conn, "%s %s://%s%s HTTP/1.1",
+                       http_cmd(conn, "%s %s://%s%s HTTP/1.1",
                            op, url->scheme, host, url->doc);
                } else {
-                       _http_cmd(conn, "%s %s HTTP/1.1",
+                       http_cmd(conn, "%s %s HTTP/1.1",
                            op, url->doc);
                }
 
+               if (ims && url->ims_time) {
+                       timestruct = gmtime((time_t *)&url->ims_time);
+                       (void)strftime(timebuf, 80, "%a, %d %b %Y %T GMT",
+                           timestruct);
+                       if (verbose)
+                               fetch_info("If-Modified-Since: %s", timebuf);
+                       http_cmd(conn, "If-Modified-Since: %s", timebuf);
+               }
                /* virtual host */
-               _http_cmd(conn, "Host: %s", host);
+               http_cmd(conn, "Host: %s", host);
 
                /* proxy authorization */
                if (purl) {
                        if (*purl->user || *purl->pwd)
-                               _http_basic_auth(conn, "Proxy-Authorization",
+                               http_basic_auth(conn, "Proxy-Authorization",
                                    purl->user, purl->pwd);
                        else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && *p != '\0')
-                               _http_authorize(conn, "Proxy-Authorization", p);
+                               http_authorize(conn, "Proxy-Authorization", p);
                }
 
                /* server authorization */
                if (need_auth || *url->user || *url->pwd) {
                        if (*url->user || *url->pwd)
-                               _http_basic_auth(conn, "Authorization", url->user, url->pwd);
+                               http_basic_auth(conn, "Authorization", url->user, url->pwd);
                        else if ((p = getenv("HTTP_AUTH")) != NULL && *p != '\0')
-                               _http_authorize(conn, "Authorization", p);
+                               http_authorize(conn, "Authorization", p);
                        else if (fetchAuthMethod && fetchAuthMethod(url) == 0) {
-                               _http_basic_auth(conn, "Authorization", url->user, url->pwd);
+                               http_basic_auth(conn, "Authorization", url->user, url->pwd);
                        } else {
-                               _http_seterr(HTTP_NEED_AUTH);
+                               http_seterr(HTTP_NEED_AUTH);
                                goto ouch;
                        }
                }
@@ -902,19 +921,19 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                /* other headers */
                if ((p = getenv("HTTP_REFERER")) != NULL && *p != '\0') {
                        if (strcasecmp(p, "auto") == 0)
-                               _http_cmd(conn, "Referer: %s://%s%s",
+                               http_cmd(conn, "Referer: %s://%s%s",
                                    url->scheme, host, url->doc);
                        else
-                               _http_cmd(conn, "Referer: %s", p);
+                               http_cmd(conn, "Referer: %s", p);
                }
                if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0')
-                       _http_cmd(conn, "User-Agent: %s", p);
+                       http_cmd(conn, "User-Agent: %s", p);
                else
-                       _http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, getprogname());
+                       http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, getprogname());
                if (url->offset > 0)
-                       _http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset);
-               _http_cmd(conn, "Connection: close");
-               _http_cmd(conn, "");
+                       http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset);
+               http_cmd(conn, "Connection: close");
+               http_cmd(conn, "");
 
                /*
                 * Force the queued request to be dispatched.  Normally, one
@@ -931,9 +950,10 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                           sizeof(val));
 
                /* get reply */
-               switch (_http_get_reply(conn)) {
+               switch (http_get_reply(conn)) {
                case HTTP_OK:
                case HTTP_PARTIAL:
+               case HTTP_NOT_MODIFIED:
                        /* fine */
                        break;
                case HTTP_MOVED_PERM:
@@ -950,12 +970,12 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                                 * We already sent out authorization code,
                                 * so there's nothing more we can do.
                                 */
-                               _http_seterr(conn->err);
+                               http_seterr(conn->err);
                                goto ouch;
                        }
                        /* try again, but send the password this time */
                        if (verbose)
-                               _fetch_info("server requires authorization");
+                               fetch_info("server requires authorization");
                        break;
                case HTTP_NEED_PROXY_AUTH:
                        /*
@@ -963,7 +983,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                         * our proxy authorization code, so there's
                         * nothing more we can do.
                         */
-                       _http_seterr(conn->err);
+                       http_seterr(conn->err);
                        goto ouch;
                case HTTP_BAD_RANGE:
                        /*
@@ -975,10 +995,10 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                case HTTP_PROTOCOL_ERROR:
                        /* fall through */
                case -1:
-                       _fetch_syserr();
+                       fetch_syserr();
                        goto ouch;
                default:
-                       _http_seterr(conn->err);
+                       http_seterr(conn->err);
                        if (!verbose)
                                goto ouch;
                        /* fall through so we can get the full error message */
@@ -986,21 +1006,21 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
 
                /* get headers */
                do {
-                       switch ((h = _http_next_header(conn, &p))) {
+                       switch ((h = http_next_header(conn, &p))) {
                        case hdr_syserror:
-                               _fetch_syserr();
+                               fetch_syserr();
                                goto ouch;
                        case hdr_error:
-                               _http_seterr(HTTP_PROTOCOL_ERROR);
+                               http_seterr(HTTP_PROTOCOL_ERROR);
                                goto ouch;
                        case hdr_content_length:
-                               _http_parse_length(p, &clength);
+                               http_parse_length(p, &clength);
                                break;
                        case hdr_content_range:
-                               _http_parse_range(p, &offset, &length, &size);
+                               http_parse_range(p, &offset, &length, &size);
                                break;
                        case hdr_last_modified:
-                               _http_parse_mtime(p, &mtime);
+                               http_parse_mtime(p, &mtime);
                                break;
                        case hdr_location:
                                if (!HTTP_REDIRECT(conn->err))
@@ -1008,7 +1028,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                                if (new)
                                        free(new);
                                if (verbose)
-                                       _fetch_info("%d redirect to %s", conn->err, p);
+                                       fetch_info("%d redirect to %s", conn->err, p);
                                if (*p == '/')
                                        /* absolute path */
                                        new = fetchMakeURL(url->scheme, url->host, url->port, p,
@@ -1048,7 +1068,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                if (conn->err == HTTP_NEED_AUTH) {
                        e = conn->err;
                        need_auth = 1;
-                       _fetch_close(conn);
+                       fetch_close(conn);
                        conn = NULL;
                        continue;
                }
@@ -1058,22 +1078,26 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                        if (url->offset == size && url->length == 0) {
                                /* asked for 0 bytes; fake it */
                                offset = url->offset;
+                               clength = -1;
                                conn->err = HTTP_OK;
                                break;
                        } else {
-                               _http_seterr(conn->err);
+                               http_seterr(conn->err);
                                goto ouch;
                        }
                }
 
                /* we have a hit or an error */
-               if (conn->err == HTTP_OK || conn->err == HTTP_PARTIAL || HTTP_ERROR(conn->err))
+               if (conn->err == HTTP_OK
+                   || conn->err == HTTP_NOT_MODIFIED
+                   || conn->err == HTTP_PARTIAL
+                   || HTTP_ERROR(conn->err))
                        break;
 
                /* all other cases: we got a redirect */
                e = conn->err;
                need_auth = 0;
-               _fetch_close(conn);
+               fetch_close(conn);
                conn = NULL;
                if (!new) {
                        DEBUG(fprintf(stderr, "redirect with no new location\n"));
@@ -1086,7 +1110,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
 
        /* we failed, or ran out of retries */
        if (conn == NULL) {
-               _http_seterr(e);
+               http_seterr(e);
                goto ouch;
        }
 
@@ -1095,9 +1119,14 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                  (long long)offset, (long long)length,
                  (long long)size, (long long)clength));
 
+       if (conn->err == HTTP_NOT_MODIFIED) {
+               http_seterr(HTTP_NOT_MODIFIED);
+               return (NULL);
+       }
+
        /* check for inconsistencies */
        if (clength != -1 && length != -1 && clength != length) {
-               _http_seterr(HTTP_PROTOCOL_ERROR);
+               http_seterr(HTTP_PROTOCOL_ERROR);
                goto ouch;
        }
        if (clength == -1)
@@ -1105,7 +1134,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
        if (clength != -1)
                length = offset + clength;
        if (length != -1 && size != -1 && length != size) {
-               _http_seterr(HTTP_PROTOCOL_ERROR);
+               http_seterr(HTTP_PROTOCOL_ERROR);
                goto ouch;
        }
        if (size == -1)
@@ -1119,7 +1148,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
 
        /* too far? */
        if (URL->offset > 0 && offset > URL->offset) {
-               _http_seterr(HTTP_PROTOCOL_ERROR);
+               http_seterr(HTTP_PROTOCOL_ERROR);
                goto ouch;
        }
 
@@ -1128,8 +1157,8 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
        URL->length = clength;
 
        /* wrap it up in a FILE */
-       if ((f = _http_funopen(conn, chunked)) == NULL) {
-               _fetch_syserr();
+       if ((f = http_funopen(conn, chunked)) == NULL) {
+               fetch_syserr();
                goto ouch;
        }
 
@@ -1139,7 +1168,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
                fetchFreeURL(purl);
 
        if (HTTP_ERROR(conn->err)) {
-               _http_print_html(stderr, f);
+               http_print_html(stderr, f);
                fclose(f);
                f = NULL;
        }
@@ -1152,7 +1181,7 @@ ouch:
        if (purl)
                fetchFreeURL(purl);
        if (conn != NULL)
-               _fetch_close(conn);
+               fetch_close(conn);
        return (NULL);
 }
 
@@ -1167,7 +1196,7 @@ ouch:
 FILE *
 fetchXGetHTTP(struct url *URL, struct url_stat *us, const char *flags)
 {
-       return (_http_request(URL, "GET", us, _http_get_proxy(flags), flags));
+       return (http_request(URL, "GET", us, http_get_proxy(URL, flags), flags));
 }
 
 /*
@@ -1197,7 +1226,7 @@ fetchStatHTTP(struct url *URL, struct url_stat *us, const char *flags)
 {
        FILE *f;
 
-       f = _http_request(URL, "HEAD", us, _http_get_proxy(flags), flags);
+       f = http_request(URL, "HEAD", us, http_get_proxy(URL, flags), flags);
        if (f == NULL)
                return (-1);
        fclose(f);