svn commit: r203979 - in user/imp/tbemd: . bin/rmail etc/ppp games
games/bcd games/caesar games/fortune/fortune
games/fortune/strfile games/fortune/unstr games/grdc
games/morse games/number games/p...
Warner Losh
imp at FreeBSD.org
Tue Feb 16 23:59:50 UTC 2010
Author: imp
Date: Tue Feb 16 23:59:48 2010
New Revision: 203979
URL: http://svn.freebsd.org/changeset/base/203979
Log:
Merge from current.
Added:
user/imp/tbemd/share/man/man4/bwn.4
- copied unchanged from r203978, head/share/man/man4/bwn.4
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar9285.c
- copied unchanged from r203978, head/sys/dev/ath/ath_hal/ar5416/ar9285.c
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar9285.h
- copied unchanged from r203978, head/sys/dev/ath/ath_hal/ar5416/ar9285.h
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
- copied unchanged from r203978, head/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c
- copied unchanged from r203978, head/sys/dev/ath/ath_hal/ar5416/ar9285_reset.c
user/imp/tbemd/sys/dev/bwn/
- copied from r203978, head/sys/dev/bwn/
user/imp/tbemd/sys/modules/bwn/
- copied from r203978, head/sys/modules/bwn/
user/imp/tbemd/sys/modules/nfs_common/
- copied from r203978, head/sys/modules/nfs_common/
Modified:
user/imp/tbemd/Makefile.inc1
user/imp/tbemd/bin/rmail/Makefile
user/imp/tbemd/etc/ppp/ppp.conf
user/imp/tbemd/games/Makefile.inc
user/imp/tbemd/games/bcd/Makefile
user/imp/tbemd/games/bcd/bcd.c
user/imp/tbemd/games/caesar/Makefile
user/imp/tbemd/games/caesar/caesar.c
user/imp/tbemd/games/fortune/fortune/Makefile
user/imp/tbemd/games/fortune/fortune/fortune.6
user/imp/tbemd/games/fortune/fortune/fortune.c
user/imp/tbemd/games/fortune/fortune/pathnames.h
user/imp/tbemd/games/fortune/strfile/Makefile
user/imp/tbemd/games/fortune/strfile/strfile.8
user/imp/tbemd/games/fortune/strfile/strfile.c
user/imp/tbemd/games/fortune/strfile/strfile.h
user/imp/tbemd/games/fortune/unstr/Makefile
user/imp/tbemd/games/fortune/unstr/unstr.c
user/imp/tbemd/games/grdc/Makefile
user/imp/tbemd/games/grdc/grdc.c
user/imp/tbemd/games/morse/morse.c
user/imp/tbemd/games/number/Makefile
user/imp/tbemd/games/number/number.c
user/imp/tbemd/games/pom/Makefile
user/imp/tbemd/games/pom/pom.c
user/imp/tbemd/games/ppt/Makefile
user/imp/tbemd/games/ppt/ppt.c
user/imp/tbemd/games/primes/pattern.c
user/imp/tbemd/games/primes/pr_tbl.c
user/imp/tbemd/games/primes/primes.c
user/imp/tbemd/games/primes/primes.h
user/imp/tbemd/games/random/Makefile
user/imp/tbemd/games/random/random.c
user/imp/tbemd/gnu/usr.bin/gdb/arch/ia64/Makefile
user/imp/tbemd/gnu/usr.bin/gdb/arch/ia64/init.c
user/imp/tbemd/include/_ctype.h
user/imp/tbemd/include/a.out.h
user/imp/tbemd/include/ar.h
user/imp/tbemd/include/arpa/ftp.h
user/imp/tbemd/include/arpa/inet.h
user/imp/tbemd/include/arpa/nameser.h
user/imp/tbemd/include/arpa/nameser_compat.h
user/imp/tbemd/include/arpa/telnet.h
user/imp/tbemd/include/arpa/tftp.h
user/imp/tbemd/include/assert.h
user/imp/tbemd/include/ctype.h
user/imp/tbemd/include/db.h
user/imp/tbemd/include/dirent.h
user/imp/tbemd/include/dlfcn.h
user/imp/tbemd/include/err.h
user/imp/tbemd/include/fnmatch.h
user/imp/tbemd/include/fstab.h
user/imp/tbemd/include/fts.h
user/imp/tbemd/include/getopt.h
user/imp/tbemd/include/glob.h
user/imp/tbemd/include/grp.h
user/imp/tbemd/include/hesiod.h
user/imp/tbemd/include/limits.h
user/imp/tbemd/include/locale.h
user/imp/tbemd/include/memory.h
user/imp/tbemd/include/mpool.h
user/imp/tbemd/include/ndbm.h
user/imp/tbemd/include/netdb.h
user/imp/tbemd/include/nl_types.h
user/imp/tbemd/include/nlist.h
user/imp/tbemd/include/nsswitch.h
user/imp/tbemd/include/paths.h
user/imp/tbemd/include/protocols/dumprestore.h
user/imp/tbemd/include/protocols/routed.h
user/imp/tbemd/include/protocols/rwhod.h
user/imp/tbemd/include/protocols/talkd.h
user/imp/tbemd/include/protocols/timed.h
user/imp/tbemd/include/pwd.h
user/imp/tbemd/include/ranlib.h
user/imp/tbemd/include/regex.h
user/imp/tbemd/include/regexp.h
user/imp/tbemd/include/resolv.h
user/imp/tbemd/include/runetype.h
user/imp/tbemd/include/setjmp.h
user/imp/tbemd/include/signal.h
user/imp/tbemd/include/stab.h
user/imp/tbemd/include/stddef.h
user/imp/tbemd/include/stdio.h
user/imp/tbemd/include/stdlib.h
user/imp/tbemd/include/string.h
user/imp/tbemd/include/sysexits.h
user/imp/tbemd/include/tar.h
user/imp/tbemd/include/termios.h
user/imp/tbemd/include/time.h
user/imp/tbemd/include/timeconv.h
user/imp/tbemd/include/ttyent.h
user/imp/tbemd/include/unistd.h
user/imp/tbemd/include/utime.h
user/imp/tbemd/include/vis.h
user/imp/tbemd/include/wchar.h
user/imp/tbemd/lib/libarchive/archive_write_disk.3
user/imp/tbemd/lib/libc/gen/tls.c
user/imp/tbemd/lib/libc/stdio/printf.3
user/imp/tbemd/lib/libc/stdlib/malloc.c
user/imp/tbemd/lib/libc/stdtime/strptime.3
user/imp/tbemd/lib/libc_r/Makefile
user/imp/tbemd/lib/libkse/Makefile
user/imp/tbemd/lib/libpam/modules/pam_echo/pam_echo.8
user/imp/tbemd/libexec/rtld-elf/arm/rtld_start.S
user/imp/tbemd/libexec/rtld-elf/rtld.c
user/imp/tbemd/sbin/devd/Makefile
user/imp/tbemd/sbin/devfs/Makefile
user/imp/tbemd/sbin/ffsinfo/Makefile
user/imp/tbemd/sbin/ifconfig/ifieee80211.c
user/imp/tbemd/sbin/mknod/Makefile
user/imp/tbemd/sbin/mount_std/Makefile
user/imp/tbemd/sbin/sunlabel/Makefile
user/imp/tbemd/sbin/sysctl/Makefile
user/imp/tbemd/sbin/sysctl/sysctl.c
user/imp/tbemd/share/man/man5/tmpfs.5
user/imp/tbemd/share/man/man9/locking.9
user/imp/tbemd/share/misc/committers-src.dot
user/imp/tbemd/share/syscons/keymaps/fr.dvorak.acc.kbd
user/imp/tbemd/sys/amd64/conf/GENERIC
user/imp/tbemd/sys/amd64/conf/XENHVM
user/imp/tbemd/sys/arm/arm/pmap.c
user/imp/tbemd/sys/arm/arm/support.S
user/imp/tbemd/sys/arm/conf/AVILA
user/imp/tbemd/sys/arm/conf/BWCT
user/imp/tbemd/sys/arm/conf/CAMBRIA
user/imp/tbemd/sys/arm/conf/CNS11XXNAS
user/imp/tbemd/sys/arm/conf/CRB
user/imp/tbemd/sys/arm/conf/DB-88F5XXX
user/imp/tbemd/sys/arm/conf/DB-88F6XXX
user/imp/tbemd/sys/arm/conf/EP80219
user/imp/tbemd/sys/arm/conf/GUMSTIX
user/imp/tbemd/sys/arm/conf/HL200
user/imp/tbemd/sys/arm/conf/IQ31244
user/imp/tbemd/sys/arm/conf/KB920X
user/imp/tbemd/sys/arm/conf/NSLU
user/imp/tbemd/sys/arm/conf/SKYEYE
user/imp/tbemd/sys/arm/include/_inttypes.h
user/imp/tbemd/sys/arm/include/_stdint.h
user/imp/tbemd/sys/arm/include/bus.h
user/imp/tbemd/sys/arm/include/bus_dma.h
user/imp/tbemd/sys/arm/include/ucontext.h
user/imp/tbemd/sys/arm/sa11x0/sa11x0.c
user/imp/tbemd/sys/arm/sa11x0/sa11x0_dmacreg.h
user/imp/tbemd/sys/arm/sa11x0/sa11x0_gpioreg.h
user/imp/tbemd/sys/arm/sa11x0/sa11x0_irq.S
user/imp/tbemd/sys/arm/sa11x0/sa11x0_irqhandler.c
user/imp/tbemd/sys/arm/sa11x0/sa11x0_ostreg.h
user/imp/tbemd/sys/arm/sa11x0/sa11x0_ppcreg.h
user/imp/tbemd/sys/arm/sa11x0/sa11x0_reg.h
user/imp/tbemd/sys/arm/sa11x0/sa11x0_var.h
user/imp/tbemd/sys/cam/scsi/scsi_cd.c
user/imp/tbemd/sys/conf/NOTES
user/imp/tbemd/sys/conf/files
user/imp/tbemd/sys/dev/acpica/acpi_video.c
user/imp/tbemd/sys/dev/ath/ath_hal/ah.h
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar5416.h
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar5416reg.h
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar9280.h
user/imp/tbemd/sys/dev/ath/ath_hal/ar5416/ar9280_attach.c
user/imp/tbemd/sys/dev/iwn/if_iwn.c
user/imp/tbemd/sys/dev/siba/siba_core.c
user/imp/tbemd/sys/dev/siba/sibareg.h
user/imp/tbemd/sys/dev/siba/sibavar.h
user/imp/tbemd/sys/i386/conf/GENERIC
user/imp/tbemd/sys/i386/conf/XEN
user/imp/tbemd/sys/ia64/conf/GENERIC
user/imp/tbemd/sys/mips/cavium/octeon_machdep.c
user/imp/tbemd/sys/mips/conf/ADM5120
user/imp/tbemd/sys/mips/conf/ALCHEMY
user/imp/tbemd/sys/mips/conf/IDT
user/imp/tbemd/sys/mips/conf/MALTA
user/imp/tbemd/sys/mips/conf/MALTA64
user/imp/tbemd/sys/mips/conf/OCTEON1
user/imp/tbemd/sys/mips/conf/OCTEON1-32
user/imp/tbemd/sys/mips/conf/QEMU
user/imp/tbemd/sys/mips/conf/SENTRY5
user/imp/tbemd/sys/mips/conf/SWARM
user/imp/tbemd/sys/mips/conf/XLR
user/imp/tbemd/sys/modules/nfsclient/Makefile
user/imp/tbemd/sys/modules/nfsserver/Makefile
user/imp/tbemd/sys/net/netisr.c
user/imp/tbemd/sys/nfs/nfs_common.c
user/imp/tbemd/sys/nfsclient/nfs_vfsops.c
user/imp/tbemd/sys/nfsserver/nfs_srvsubs.c
user/imp/tbemd/sys/pc98/conf/GENERIC
user/imp/tbemd/sys/powerpc/booke/machdep.c
user/imp/tbemd/sys/powerpc/conf/GENERIC
user/imp/tbemd/sys/powerpc/conf/MPC85XX
user/imp/tbemd/sys/sun4v/conf/GENERIC
user/imp/tbemd/tools/regression/usr.bin/env/Makefile
user/imp/tbemd/usr.bin/gencat/gencat.c
user/imp/tbemd/usr.bin/getent/getent.1
user/imp/tbemd/usr.bin/getent/getent.c
user/imp/tbemd/usr.bin/nl/nl.1
user/imp/tbemd/usr.bin/nl/nl.c
user/imp/tbemd/usr.bin/stat/stat.1
user/imp/tbemd/usr.bin/stat/stat.c
user/imp/tbemd/usr.bin/unzip/unzip.1
user/imp/tbemd/usr.bin/unzip/unzip.c
user/imp/tbemd/usr.bin/usbhidaction/usbhidaction.1
user/imp/tbemd/usr.bin/usbhidaction/usbhidaction.c
user/imp/tbemd/usr.bin/usbhidctl/usbhid.c
user/imp/tbemd/usr.bin/usbhidctl/usbhidctl.1
user/imp/tbemd/usr.bin/xlint/lint1/makeman
user/imp/tbemd/usr.sbin/arp/arp.c
user/imp/tbemd/usr.sbin/cxgbtool/Makefile
user/imp/tbemd/usr.sbin/eeprom/eeprom.8
user/imp/tbemd/usr.sbin/eeprom/eeprom.c
user/imp/tbemd/usr.sbin/ftp-proxy/Makefile.inc
user/imp/tbemd/usr.sbin/makefs/compat/pwcache.c
user/imp/tbemd/usr.sbin/makefs/compat/strsuftoll.c
user/imp/tbemd/usr.sbin/makefs/getid.c
user/imp/tbemd/usr.sbin/rpcbind/util.c
user/imp/tbemd/usr.sbin/usbdevs/usbdevs.8
user/imp/tbemd/usr.sbin/usbdevs/usbdevs.c
user/imp/tbemd/usr.sbin/yppoll/yppoll.8
Directory Properties:
user/imp/tbemd/ (props changed)
Modified: user/imp/tbemd/Makefile.inc1
==============================================================================
--- user/imp/tbemd/Makefile.inc1 Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/Makefile.inc1 Tue Feb 16 23:59:48 2010 (r203979)
@@ -15,6 +15,7 @@
# -DNO_CTF do not run the DTrace CTF conversion tools on built objects
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
# TARGET="machine" to crossbuild world for a different machine type
+# TARGET_ARCH= may be required when a TARGET supports multiple endians.
#
# The intended user-driven targets are:
@@ -30,7 +31,7 @@
.include <bsd.own.mk>
.if ${MACHINE_CPUARCH} == "mips"
-MK_RESCUE=no # not yet
+#MK_RESCUE=no # not yet
.endif
# We must do share/info early so that installation of info `dir'
@@ -120,10 +121,10 @@ VERSION+= ${OSRELDATE}
# Guess machine architecture from machine type, and vice versa.
.if !defined(TARGET_ARCH) && defined(TARGET)
-TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/}
+TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/}
.elif !defined(TARGET) && defined(TARGET_ARCH) && \
${TARGET_ARCH} != ${MACHINE_ARCH}
-TARGET= ${TARGET_ARCH}
+TARGET= ${TARGET_ARCH:C/mipse[lb]/mips/:C/armeb/arm}
.endif
# Otherwise, default to current machine type and architecture.
TARGET?= ${MACHINE}
Modified: user/imp/tbemd/bin/rmail/Makefile
==============================================================================
--- user/imp/tbemd/bin/rmail/Makefile Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/bin/rmail/Makefile Tue Feb 16 23:59:48 2010 (r203979)
@@ -11,7 +11,7 @@ PROG= rmail
SRCS= rmail.c
MAN= rmail.8
-WARNS?= 0
+WARNS?= 2
CFLAGS+=-I${SENDMAIL_DIR}/include -I.
LIBSMDIR= ${.OBJDIR}/../../lib/libsm
Modified: user/imp/tbemd/etc/ppp/ppp.conf
==============================================================================
--- user/imp/tbemd/etc/ppp/ppp.conf Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/etc/ppp/ppp.conf Tue Feb 16 23:59:48 2010 (r203979)
@@ -10,7 +10,7 @@
default:
set log Phase Chat LCP IPCP CCP tun command
- ident user-ppp VERSION (built COMPILATIONDATE)
+ ident user-ppp VERSION
# Ensure that "device" references the correct serial port
# for your modem. (cuau0 = COM1, cuau1 = COM2)
Modified: user/imp/tbemd/games/Makefile.inc
==============================================================================
--- user/imp/tbemd/games/Makefile.inc Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/Makefile.inc Tue Feb 16 23:59:48 2010 (r203979)
@@ -3,3 +3,4 @@
BINDIR?= /usr/games
FILESDIR?= ${SHAREDIR}/games
+WARNS?= 6
Modified: user/imp/tbemd/games/bcd/Makefile
==============================================================================
--- user/imp/tbemd/games/bcd/Makefile Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/bcd/Makefile Tue Feb 16 23:59:48 2010 (r203979)
@@ -2,7 +2,6 @@
# $FreeBSD$
PROG= bcd
-WARNS?= 6
MAN= bcd.6
MLINKS= bcd.6 ppt.6
Modified: user/imp/tbemd/games/bcd/bcd.c
==============================================================================
--- user/imp/tbemd/games/bcd/bcd.c Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/bcd/bcd.c Tue Feb 16 23:59:48 2010 (r203979)
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
Modified: user/imp/tbemd/games/caesar/Makefile
==============================================================================
--- user/imp/tbemd/games/caesar/Makefile Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/caesar/Makefile Tue Feb 16 23:59:48 2010 (r203979)
@@ -8,6 +8,4 @@ SCRIPTS=rot13.sh
MAN= caesar.6
MLINKS= caesar.6 rot13.6
-WARNS?= 6
-
.include <bsd.prog.mk>
Modified: user/imp/tbemd/games/caesar/caesar.c
==============================================================================
--- user/imp/tbemd/games/caesar/caesar.c Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/caesar/caesar.c Tue Feb 16 23:59:48 2010 (r203979)
@@ -18,11 +18,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
Modified: user/imp/tbemd/games/fortune/fortune/Makefile
==============================================================================
--- user/imp/tbemd/games/fortune/fortune/Makefile Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/fortune/fortune/Makefile Tue Feb 16 23:59:48 2010 (r203979)
@@ -3,7 +3,6 @@
PROG= fortune
MAN= fortune.6
-WARNS?= 2
CFLAGS+=-DDEBUG -I${.CURDIR}/../strfile
.include <bsd.prog.mk>
Modified: user/imp/tbemd/games/fortune/fortune/fortune.6
==============================================================================
--- user/imp/tbemd/games/fortune/fortune/fortune.6 Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/fortune/fortune/fortune.6 Tue Feb 16 23:59:48 2010 (r203979)
@@ -12,11 +12,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
+.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
Modified: user/imp/tbemd/games/fortune/fortune/fortune.c
==============================================================================
--- user/imp/tbemd/games/fortune/fortune/fortune.c Tue Feb 16 22:55:38 2010 (r203978)
+++ user/imp/tbemd/games/fortune/fortune/fortune.c Tue Feb 16 23:59:48 2010 (r203979)
@@ -13,11 +13,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -48,49 +44,50 @@ static const char sccsid[] = "@(#)fortun
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-# include <sys/stat.h>
-# include <sys/endian.h>
+#include <sys/stat.h>
+#include <sys/endian.h>
-# include <dirent.h>
-# include <fcntl.h>
-# include <assert.h>
-# include <unistd.h>
-# include <stdio.h>
-# include <ctype.h>
-# include <stdlib.h>
-# include <string.h>
-# include <locale.h>
-# include <time.h>
-# include <regex.h>
-# include "strfile.h"
-# include "pathnames.h"
-
-# define TRUE 1
-# define FALSE 0
-# define bool short
-
-# define MINW 6 /* minimum wait if desired */
-# define CPERS 20 /* # of chars for each sec */
-# define SLEN 160 /* # of chars in short fortune */
-
-# define POS_UNKNOWN ((uint32_t) -1) /* pos for file unknown */
-# define NO_PROB (-1) /* no prob specified for file */
-
-# ifdef DEBUG
-# define DPRINTF(l,x) { if (Debug >= l) fprintf x; }
-# undef NDEBUG
-# else
-# define DPRINTF(l,x)
-# define NDEBUG 1
-# endif
+#include <assert.h>
+#include <ctype.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <locale.h>
+#include <regex.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <unistd.h>
+
+#include "strfile.h"
+#include "pathnames.h"
+
+#define TRUE 1
+#define FALSE 0
+#define bool short
+
+#define MINW 6 /* minimum wait if desired */
+#define CPERS 20 /* # of chars for each sec */
+#define SLEN 160 /* # of chars in short fortune */
+
+#define POS_UNKNOWN ((uint32_t) -1) /* pos for file unknown */
+#define NO_PROB (-1) /* no prob specified for file */
+
+#ifdef DEBUG
+#define DPRINTF(l,x) { if (Debug >= l) fprintf x; }
+#undef NDEBUG
+#else
+#define DPRINTF(l,x)
+#define NDEBUG 1
+#endif
typedef struct fd {
int percent;
int fd, datfd;
uint32_t pos;
FILE *inf;
- char *name;
- char *path;
+ const char *name;
+ const char *path;
char *datfile, *posfile;
bool read_tbl;
bool was_pos_file;
@@ -102,7 +99,7 @@ typedef struct fd {
bool Found_one; /* did we find a match? */
bool Find_files = FALSE; /* just find a list of proper fortune files */
-bool Fortunes_only = FALSE; /* check only "fortunes" files */
+bool Fortunes_only = FALSE; /* check only "fortunes" files */
bool Wait = FALSE; /* wait desired after fortune */
bool Short_only = FALSE; /* short fortune desired */
bool Long_only = FALSE; /* long fortune desired */
@@ -126,14 +123,14 @@ FILEDESC *Fortfile; /* Fortune file to
STRFILE Noprob_tbl; /* sum of data for all no prob files */
-char *Fortune_path;
+const char *Fortune_path;
char **Fortune_path_arr;
int add_dir(FILEDESC *);
-int add_file __P((int,
- char *, char *, FILEDESC **, FILEDESC **, FILEDESC *));
+int add_file(int, const char *, const char *, FILEDESC **, FILEDESC **,
+ FILEDESC *);
void all_forts(FILEDESC *, char *);
-char *copy(char *, u_int);
+char *copy(const char *, u_int);
void display(FILEDESC *);
void do_free(void *);
void *do_malloc(u_int);
@@ -145,13 +142,13 @@ void get_tbl(FILEDESC *);
void getargs(int, char *[]);
void getpath(void);
void init_prob(void);
-int is_dir(char *);
-int is_fortfile(char *, char **, char **, int);
-int is_off_name(char *);
+int is_dir(const char *);
+int is_fortfile(const char *, char **, char **, int);
+int is_off_name(const char *);
int max(int, int);
FILEDESC *
new_fp(void);
-char *off_name(char *);
+char *off_name(const char *);
void open_dat(FILEDESC *);
void open_fp(FILEDESC *);
FILEDESC *
@@ -171,18 +168,16 @@ int maxlen_in_list(FILEDESC *);
static regex_t Re_pat;
int
-main(ac, av)
-int ac;
-char *av[];
+main(int argc, char *argv[])
{
-#ifdef OK_TO_WRITE_DISK
+#ifdef OK_TO_WRITE_DISK
int fd;
-#endif /* OK_TO_WRITE_DISK */
+#endif /* OK_TO_WRITE_DISK */
(void) setlocale(LC_ALL, "");
getpath();
- getargs(ac, av);
+ getargs(argc, argv);
if (Match)
exit(find_matches() != 0);
@@ -195,45 +190,44 @@ char *av[];
display(Fortfile);
-#ifdef OK_TO_WRITE_DISK
+#ifdef OK_TO_WRITE_DISK
if ((fd = creat(Fortfile->posfile, 0666)) < 0) {
perror(Fortfile->posfile);
exit(1);
}
-#ifdef LOCK_EX
+#ifdef LOCK_EX
/*
* if we can, we exclusive lock, but since it isn't very
* important, we just punt if we don't have easy locking
* available.
*/
(void) flock(fd, LOCK_EX);
-#endif /* LOCK_EX */
+#endif /* LOCK_EX */
write(fd, (char *) &Fortfile->pos, sizeof Fortfile->pos);
if (!Fortfile->was_pos_file)
(void) chmod(Fortfile->path, 0666);
-#ifdef LOCK_EX
+#ifdef LOCK_EX
(void) flock(fd, LOCK_UN);
-#endif /* LOCK_EX */
-#endif /* OK_TO_WRITE_DISK */
+#endif /* LOCK_EX */
+#endif /* OK_TO_WRITE_DISK */
if (Wait) {
if (Fort_len == 0)
(void) fortlen();
sleep((unsigned int) max(Fort_len / CPERS, MINW));
}
- exit(0);
- /* NOTREACHED */
+
+ return (0);
}
void
-display(fp)
-FILEDESC *fp;
+display(FILEDESC *fp)
{
char *p;
unsigned char ch;
char line[BUFSIZ];
open_fp(fp);
- (void) fseeko(fp->inf, Seekpts[0], 0);
+ fseeko(fp->inf, Seekpts[0], SEEK_SET);
for (Fort_len = 0; fgets(line, sizeof line, fp->inf) != NULL &&
!STR_ENDSTRING(line, fp->tbl); Fort_len++) {
if (fp->tbl.str_flags & STR_ROTATED)
@@ -259,7 +253,7 @@ FILEDESC *fp;
* Return the length of the fortune.
*/
int
-fortlen()
+fortlen(void)
{
int nchar;
char line[BUFSIZ];
@@ -268,34 +262,31 @@ fortlen()
nchar = (int)(Seekpts[1] - Seekpts[0]);
else {
open_fp(Fortfile);
- (void) fseeko(Fortfile->inf, Seekpts[0], 0);
+ fseeko(Fortfile->inf, Seekpts[0], SEEK_SET);
nchar = 0;
while (fgets(line, sizeof line, Fortfile->inf) != NULL &&
!STR_ENDSTRING(line, Fortfile->tbl))
nchar += strlen(line);
}
Fort_len = nchar;
- return nchar;
+
+ return (nchar);
}
/*
* This routine evaluates the arguments on the command line
*/
void
-getargs(argc, argv)
-int argc;
-char **argv;
+getargs(int argc, char *argv[])
{
int ignore_case;
char *pat;
- extern char *optarg;
- extern int optind;
int ch;
ignore_case = FALSE;
pat = NULL;
-# ifdef DEBUG
+#ifdef DEBUG
while ((ch = getopt(argc, argv, "aDefilm:osw")) != -1)
#else
while ((ch = getopt(argc, argv, "aefilm:osw")) != -1)
@@ -304,11 +295,11 @@ char **argv;
case 'a': /* any fortune */
All_forts++;
break;
-# ifdef DEBUG
+#ifdef DEBUG
case 'D':
Debug++;
break;
-# endif /* DEBUG */
+#endif /* DEBUG */
case 'e':
Equal_probs++; /* scatter un-allocted prob equally */
break;
@@ -362,7 +353,7 @@ char **argv;
error = regcomp(&Re_pat, pat, REG_BASIC);
if (error) {
fprintf(stderr, "regcomp(%s) fails\n", pat);
- exit (1);
+ exit(1);
}
}
}
@@ -372,9 +363,7 @@ char **argv;
* Form the file list from the file specifications.
*/
int
-form_file_list(files, file_cnt)
-char **files;
-int file_cnt;
+form_file_list(char **files, int file_cnt)
{
int i, percent;
char *sp;
@@ -386,7 +375,7 @@ int file_cnt;
pstr = Fortune_path_arr;
i = 0;
while (*pstr) {
- i += add_file(NO_PROB, *pstr++, NULL,
+ i += add_file(NO_PROB, *pstr++, NULL,
&File_list, &File_tail, NULL);
}
Fortunes_only = FALSE;
@@ -394,7 +383,7 @@ int file_cnt;
fprintf(stderr, "No fortunes found in %s.\n",
Fortune_path);
}
- return i != 0;
+ return (i != 0);
} else {
pstr = Fortune_path_arr;
i = 0;
@@ -406,7 +395,7 @@ int file_cnt;
fprintf(stderr, "No fortunes found in %s.\n",
Fortune_path);
}
- return i != 0;
+ return (i != 0);
}
}
for (i = 0; i < file_cnt; i++) {
@@ -419,11 +408,11 @@ int file_cnt;
percent = percent * 10 + *sp - '0';
if (percent > 100) {
fprintf(stderr, "percentages must be <= 100\n");
- return FALSE;
+ return (FALSE);
}
if (*sp == '.') {
fprintf(stderr, "percentages must be integers\n");
- return FALSE;
+ return (FALSE);
}
/*
* If the number isn't followed by a '%', then
@@ -437,7 +426,7 @@ int file_cnt;
else if (*++sp == '\0') {
if (++i >= file_cnt) {
fprintf(stderr, "percentages must precede files\n");
- return FALSE;
+ return (FALSE);
}
sp = files[i];
}
@@ -446,20 +435,21 @@ int file_cnt;
pstr = Fortune_path_arr;
i = 0;
while (*pstr) {
- i += add_file(NO_PROB, *pstr++, NULL,
+ i += add_file(NO_PROB, *pstr++, NULL,
&File_list, &File_tail, NULL);
}
if (!i) {
fprintf(stderr, "No fortunes found in %s.\n",
Fortune_path);
- return FALSE;
+ return (FALSE);
}
- } else if (!add_file(percent, sp, NULL, &File_list,
+ } else if (!add_file(percent, sp, NULL, &File_list,
&File_tail, NULL)) {
- return FALSE;
+ return (FALSE);
}
}
- return TRUE;
+
+ return (TRUE);
}
/*
@@ -467,32 +457,31 @@ int file_cnt;
* Add a file to the file list.
*/
int
-add_file(percent, file, dir, head, tail, parent)
-int percent;
-char *file;
-char *dir;
-FILEDESC **head, **tail;
-FILEDESC *parent;
+add_file(int percent, const char *file, const char *dir, FILEDESC **head,
+ FILEDESC **tail, FILEDESC *parent)
{
FILEDESC *fp;
int fd;
- char *path, *offensive;
+ const char *path;
+ char *tpath, *offensive;
bool was_malloc;
bool isdir;
if (dir == NULL) {
path = file;
+ tpath = NULL;
was_malloc = FALSE;
}
else {
- path = do_malloc((unsigned int) (strlen(dir) + strlen(file) + 2));
- (void) strcat(strcat(strcpy(path, dir), "/"), file);
+ tpath = do_malloc((unsigned int)(strlen(dir) + strlen(file) + 2));
+ strcat(strcat(strcpy(tpath, dir), "/"), file);
+ path = tpath;
was_malloc = TRUE;
}
if ((isdir = is_dir(path)) && parent != NULL) {
if (was_malloc)
- free(path);
- return FALSE; /* don't recurse */
+ free(tpath);
+ return (FALSE); /* don't recurse */
}
offensive = NULL;
if (!isdir && parent == NULL && (All_forts || Offend) &&
@@ -500,7 +489,7 @@ FILEDESC *parent;
offensive = off_name(path);
if (Offend) {
if (was_malloc)
- free(path);
+ free(tpath);
path = offensive;
offensive = NULL;
was_malloc = TRUE;
@@ -511,7 +500,7 @@ FILEDESC *parent;
DPRINTF(1, (stderr, "adding file \"%s\"\n", path));
over:
- if ((fd = open(path, 0)) < 0) {
+ if ((fd = open(path, O_RDONLY)) < 0) {
/*
* This is a sneak. If the user said -a, and if the
* file we're given isn't a file, we check to see if
@@ -522,7 +511,7 @@ over:
*/
if (All_forts && offensive != NULL) {
if (was_malloc)
- free(path);
+ free(tpath);
path = offensive;
offensive = NULL;
was_malloc = TRUE;
@@ -535,22 +524,22 @@ over:
char **pstr = Fortune_path_arr;
while (*pstr) {
- i += add_file(percent, file, *pstr++,
+ i += add_file(percent, file, *pstr++,
head, tail, parent);
}
if (!i) {
fprintf(stderr, "No '%s' found in %s.\n",
file, Fortune_path);
}
- return i != 0;
+ return (i != 0);
}
/*
if (parent == NULL)
perror(path);
*/
if (was_malloc)
- free(path);
- return FALSE;
+ free(tpath);
+ return (FALSE);
}
DPRINTF(2, (stderr, "path = \"%s\"\n", path));
@@ -571,12 +560,12 @@ over:
"fortune:%s not a fortune file or directory\n",
path);
if (was_malloc)
- free(path);
+ free(tpath);
do_free(fp->datfile);
do_free(fp->posfile);
- free((char *) fp);
+ free(fp);
do_free(offensive);
- return FALSE;
+ return (FALSE);
}
/*
* If the user said -a, we need to make this node a pointer to
@@ -598,11 +587,11 @@ over:
fp->next = *head;
*head = fp;
}
-#ifdef OK_TO_WRITE_DISK
+#ifdef OK_TO_WRITE_DISK
fp->was_pos_file = (access(fp->posfile, W_OK) >= 0);
-#endif /* OK_TO_WRITE_DISK */
+#endif /* OK_TO_WRITE_DISK */
- return TRUE;
+ return (TRUE);
}
/*
@@ -610,11 +599,11 @@ over:
* Return a pointer to an initialized new FILEDESC.
*/
FILEDESC *
-new_fp()
+new_fp(void)
{
FILEDESC *fp;
- fp = (FILEDESC *) do_malloc(sizeof *fp);
+ fp = do_malloc(sizeof(*fp));
fp->datfd = -1;
fp->pos = POS_UNKNOWN;
fp->inf = NULL;
@@ -627,7 +616,8 @@ new_fp()
fp->parent = NULL;
fp->datfile = NULL;
fp->posfile = NULL;
- return fp;
+
+ return (fp);
}
/*
@@ -635,13 +625,13 @@ new_fp()
* Return a pointer to the offensive version of a file of this name.
*/
char *
-off_name(file)
-char *file;
+off_name(const char *file)
{
char *new;
new = copy(file, (unsigned int) (strlen(file) + 2));
- return strcat(new, "-o");
+
+ return (strcat(new, "-o"));
}
/*
@@ -649,12 +639,12 @@ char *file;
* Is the file an offensive-style name?
*/
int
-is_off_name(file)
-char *file;
+is_off_name(const char *file)
{
int len;
len = strlen(file);
+
return (len >= 3 && file[len - 2] == '-' && file[len - 1] == 'o');
}
@@ -664,20 +654,18 @@ char *file;
* there are two children to be a parent of.
*/
void
-all_forts(fp, offensive)
-FILEDESC *fp;
-char *offensive;
+all_forts(FILEDESC *fp, char *offensive)
{
char *sp;
FILEDESC *scene, *obscene;
int fd;
- auto char *datfile, *posfile;
+ char *datfile, *posfile;
if (fp->child != NULL) /* this is a directory, not a file */
return;
if (!is_fortfile(offensive, &datfile, &posfile, FALSE))
return;
- if ((fd = open(offensive, 0)) < 0)
+ if ((fd = open(offensive, O_RDONLY)) < 0)
return;
DPRINTF(1, (stderr, "adding \"%s\" because of -a\n", offensive));
scene = new_fp();
@@ -704,9 +692,9 @@ char *offensive;
obscene->datfile = datfile;
obscene->posfile = posfile;
obscene->read_tbl = FALSE;
-#ifdef OK_TO_WRITE_DISK
+#ifdef OK_TO_WRITE_DISK
obscene->was_pos_file = (access(obscene->posfile, W_OK) >= 0);
-#endif /* OK_TO_WRITE_DISK */
+#endif /* OK_TO_WRITE_DISK */
}
/*
@@ -714,19 +702,18 @@ char *offensive;
* Add the contents of an entire directory.
*/
int
-add_dir(fp)
-FILEDESC *fp;
+add_dir(FILEDESC *fp)
{
DIR *dir;
struct dirent *dirent;
- auto FILEDESC *tailp;
- auto char *name;
+ FILEDESC *tailp;
+ char *name;
(void) close(fp->fd);
fp->fd = -1;
if ((dir = opendir(fp->path)) == NULL) {
perror(fp->path);
- return FALSE;
+ return (FALSE);
}
tailp = NULL;
DPRINTF(1, (stderr, "adding dir \"%s\"\n", fp->path));
@@ -743,9 +730,10 @@ FILEDESC *fp;
if (fp->num_children == 0) {
(void) fprintf(stderr,
"fortune: %s: No fortune files in directory.\n", fp->path);
- return FALSE;
+ return (FALSE);
}
- return TRUE;
+
+ return (TRUE);
}
/*
@@ -753,13 +741,13 @@ FILEDESC *fp;
* Return TRUE if the file is a directory, FALSE otherwise.
*/
int
-is_dir(file)
-char *file;
+is_dir(const char *file)
{
- auto struct stat sbuf;
+ struct stat sbuf;
if (stat(file, &sbuf) < 0)
- return FALSE;
+ return (FALSE);
+
return (sbuf.st_mode & S_IFDIR);
}
@@ -772,19 +760,18 @@ char *file;
*/
/* ARGSUSED */
int
-is_fortfile(file, datp, posp, check_for_offend)
-char *file, **datp, **posp;
-int check_for_offend;
+is_fortfile(const char *file, char **datp, char **posp, int check_for_offend)
{
int i;
- char *sp;
+ const char *sp;
char *datfile;
- static char *suflist[] = { /* list of "illegal" suffixes" */
- "dat", "pos", "c", "h", "p", "i", "f",
- "pas", "ftn", "ins.c", "ins,pas",
- "ins.ftn", "sml",
- NULL
- };
+ static const char *suflist[] = {
+ /* list of "illegal" suffixes" */
+ "dat", "pos", "c", "h", "p", "i", "f",
+ "pas", "ftn", "ins.c", "ins,pas",
+ "ins.ftn", "sml",
+ NULL
+ };
DPRINTF(2, (stderr, "is_fortfile(%s) returns ", file));
@@ -796,7 +783,7 @@ int check_for_offend;
i = strlen(file);
if (Offend ^ (file[i - 2] == '-' && file[i - 1] == 'o')) {
DPRINTF(2, (stderr, "FALSE (offending file)\n"));
- return FALSE;
+ return (FALSE);
}
}
@@ -806,18 +793,18 @@ int check_for_offend;
sp++;
if (*sp == '.') {
DPRINTF(2, (stderr, "FALSE (file starts with '.')\n"));
- return FALSE;
+ return (FALSE);
}
if (Fortunes_only && strncmp(sp, "fortunes", 8) != 0) {
DPRINTF(2, (stderr, "FALSE (check fortunes only)\n"));
- return FALSE;
+ return (FALSE);
}
if ((sp = rindex(sp, '.')) != NULL) {
sp++;
for (i = 0; suflist[i] != NULL; i++)
if (strcmp(sp, suflist[i]) == 0) {
DPRINTF(2, (stderr, "FALSE (file has suffix \".%s\")\n", sp));
- return FALSE;
+ return (FALSE);
}
}
@@ -830,22 +817,23 @@ int check_for_offend;
DPRINTF(0, (stderr, "Warning: file \"%s\" unreadable\n", datfile));
#endif
free(datfile);
- return FALSE;
+ return (FALSE);
}
if (datp != NULL)
*datp = datfile;
else
free(datfile);
if (posp != NULL) {
-#ifdef OK_TO_WRITE_DISK
+#ifdef OK_TO_WRITE_DISK
*posp = copy(file, (unsigned int) (strlen(file) + 4)); /* +4 for ".dat" */
(void) strcat(*posp, ".pos");
#else
*posp = NULL;
-#endif /* OK_TO_WRITE_DISK */
+#endif /* OK_TO_WRITE_DISK */
}
DPRINTF(2, (stderr, "TRUE\n"));
- return TRUE;
+
+ return (TRUE);
}
/*
@@ -853,18 +841,17 @@ int check_for_offend;
* Return a malloc()'ed copy of the string
*/
char *
-copy(str, len)
-char *str;
-unsigned int len;
+copy(const char *str, unsigned int len)
{
- char *new, *sp;
+ char *new, *sp;
new = do_malloc(len + 1);
sp = new;
do {
*sp++ = *str;
} while (*str++);
- return new;
+
+ return (new);
}
/*
@@ -872,16 +859,16 @@ unsigned int len;
* Do a malloc, checking for NULL return.
*/
void *
-do_malloc(size)
-unsigned int size;
+do_malloc(unsigned int size)
{
- void *new;
+ void *new;
if ((new = malloc(size)) == NULL) {
(void) fprintf(stderr, "fortune: out of memory.\n");
exit(1);
}
- return new;
+
+ return (new);
}
/*
@@ -889,8 +876,7 @@ unsigned int size;
* Free malloc'ed space, if any.
*/
void
-do_free(ptr)
-void *ptr;
+do_free(void *ptr)
{
if (ptr != NULL)
free(ptr);
@@ -901,7 +887,7 @@ void *ptr;
* Initialize the fortune probabilities.
*/
void
-init_prob()
+init_prob(void)
{
FILEDESC *fp, *last = NULL;
int percent, num_noprob, frac;
@@ -919,8 +905,7 @@ init_prob()
num_noprob++;
if (Equal_probs)
last = fp;
- }
- else
+ } else
percent += fp->percent;
DPRINTF(1, (stderr, "summing probabilities:%d%% with %d NO_PROB's",
percent, num_noprob));
@@ -928,14 +913,12 @@ init_prob()
(void) fprintf(stderr,
"fortune: probabilities sum to %d%% > 100%%!\n", percent);
exit(1);
- }
- else if (percent < 100 && num_noprob == 0) {
+ } else if (percent < 100 && num_noprob == 0) {
(void) fprintf(stderr,
"fortune: no place to put residual probability (%d%% < 100%%)\n",
percent);
exit(1);
- }
- else if (percent == 100 && num_noprob != 0) {
+ } else if (percent == 100 && num_noprob != 0) {
(void) fprintf(stderr,
"fortune: no probability left to put in residual files (100%%)\n");
exit(1);
@@ -955,7 +938,7 @@ init_prob()
last->percent = percent;
DPRINTF(1, (stderr, ", residual = %d%%", percent));
}
- else
+ else
DPRINTF(1, (stderr,
", %d%% distributed over remaining fortunes\n",
percent));
@@ -973,7 +956,7 @@ init_prob()
* Get the fortune data file's seek pointer for the next fortune.
*/
void
-get_fort()
+get_fort(void)
{
FILEDESC *fp;
int choice;
@@ -1004,7 +987,7 @@ get_fort()
choice = arc4random_uniform(Noprob_tbl.str_numstr);
DPRINTF(1, (stderr, "choice = %d (of %u) \n", choice,
Noprob_tbl.str_numstr));
- while (choice >= fp->tbl.str_numstr) {
+ while ((unsigned int)choice >= fp->tbl.str_numstr) {
choice -= fp->tbl.str_numstr;
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-user
mailing list