Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Apr 2003 17:02:01 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 28574 for review
Message-ID:  <200304090002.h39021ED011485@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=28574

Change 28574 by marcel@marcel_pluto1 on 2003/04/08 17:01:55

	IFia64

Affected files ...

.. //depot/projects/ia64_epc/bin/cp/cp.1#2 integrate
.. //depot/projects/ia64_epc/bin/cp/cp.c#2 integrate
.. //depot/projects/ia64_epc/bin/cp/extern.h#2 integrate
.. //depot/projects/ia64_epc/bin/cp/utils.c#2 integrate
.. //depot/projects/ia64_epc/etc/Makefile#4 integrate
.. //depot/projects/ia64_epc/etc/newsyslog.conf#3 integrate
.. //depot/projects/ia64_epc/etc/syslog.conf#3 integrate
.. //depot/projects/ia64_epc/include/fstab.h#2 integrate
.. //depot/projects/ia64_epc/include/paths.h#2 integrate
.. //depot/projects/ia64_epc/lib/libc/gen/Makefile.inc#4 integrate
.. //depot/projects/ia64_epc/lib/libc/gen/fstab.c#2 integrate
.. //depot/projects/ia64_epc/lib/libc/gen/getfsent.3#2 integrate
.. //depot/projects/ia64_epc/lib/libc/stdio/vfwprintf.c#4 integrate
.. //depot/projects/ia64_epc/lib/libpam/modules/modules.inc#3 integrate
.. //depot/projects/ia64_epc/lib/libpam/modules/pam_chroot/pam_chroot.8#2 integrate
.. //depot/projects/ia64_epc/lib/libpam/modules/pam_chroot/pam_chroot.c#2 integrate
.. //depot/projects/ia64_epc/lib/libusbhid/usbhid.h#1 branch
.. //depot/projects/ia64_epc/lib/libutil/pw_util.c#3 integrate
.. //depot/projects/ia64_epc/libexec/rtld-elf/Makefile#3 integrate
.. //depot/projects/ia64_epc/libexec/rtld-elf/libmap.c#1 branch
.. //depot/projects/ia64_epc/libexec/rtld-elf/libmap.h#1 branch
.. //depot/projects/ia64_epc/libexec/rtld-elf/rtld.1#3 integrate
.. //depot/projects/ia64_epc/libexec/rtld-elf/rtld.c#4 integrate
.. //depot/projects/ia64_epc/release/doc/en_US.ISO8859-1/early-adopter/article.sgml#2 integrate
.. //depot/projects/ia64_epc/sbin/dump/dump.h#2 integrate
.. //depot/projects/ia64_epc/sbin/dump/main.c#3 integrate
.. //depot/projects/ia64_epc/sbin/dump/optr.c#2 integrate
.. //depot/projects/ia64_epc/sbin/mount/mount.8#3 integrate
.. //depot/projects/ia64_epc/sbin/mount/mount.c#2 integrate
.. //depot/projects/ia64_epc/sbin/ping/ping.c#6 integrate
.. //depot/projects/ia64_epc/sbin/umount/umount.8#2 integrate
.. //depot/projects/ia64_epc/sbin/umount/umount.c#2 integrate
.. //depot/projects/ia64_epc/share/man/man4/polling.4#2 integrate
.. //depot/projects/ia64_epc/share/man/man4/umass.4#2 integrate
.. //depot/projects/ia64_epc/share/man/man5/Makefile#3 integrate
.. //depot/projects/ia64_epc/share/man/man5/libmap.conf.5#1 branch
.. //depot/projects/ia64_epc/share/man/man7/release.7#5 integrate
.. //depot/projects/ia64_epc/sys/alpha/alpha/busdma_machdep.c#4 integrate
.. //depot/projects/ia64_epc/sys/conf/files#8 integrate
.. //depot/projects/ia64_epc/sys/dev/adlink/adlink.c#2 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-all.c#8 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-all.h#4 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-chipset.c#5 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-disk.c#5 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-dma.c#4 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-pci.c#4 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-pci.h#4 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-raid.c#6 integrate
.. //depot/projects/ia64_epc/sys/dev/ata/ata-raid.h#3 integrate
.. //depot/projects/ia64_epc/sys/dev/cardbus/cardbus_cis.c#3 integrate
.. //depot/projects/ia64_epc/sys/dev/fxp/if_fxp.c#7 integrate
.. //depot/projects/ia64_epc/sys/dev/pccard/pccard.c#5 integrate
.. //depot/projects/ia64_epc/sys/dev/pccard/pccardvar.h#2 integrate
.. //depot/projects/ia64_epc/sys/dev/pccbb/pccbb.c#3 integrate
.. //depot/projects/ia64_epc/sys/dev/puc/pucdata.c#4 integrate
.. //depot/projects/ia64_epc/sys/dev/snc/dp83932.c#3 integrate
.. //depot/projects/ia64_epc/sys/dev/stg/tmc18c30.h#1 branch
.. //depot/projects/ia64_epc/sys/dev/stg/tmc18c30_isa.c#2 integrate
.. //depot/projects/ia64_epc/sys/dev/stg/tmc18c30_pccard.c#2 integrate
.. //depot/projects/ia64_epc/sys/dev/stg/tmc18c30_pci.c#1 branch
.. //depot/projects/ia64_epc/sys/dev/stg/tmc18c30_subr.c#1 branch
.. //depot/projects/ia64_epc/sys/dev/usb/if_kue.c#4 integrate
.. //depot/projects/ia64_epc/sys/dev/usb/usbdevs#5 integrate
.. //depot/projects/ia64_epc/sys/dev/usb/usbdevs.h#5 integrate
.. //depot/projects/ia64_epc/sys/dev/usb/usbdevs_data.h#5 integrate
.. //depot/projects/ia64_epc/sys/dev/vx/if_vx.c#3 integrate
.. //depot/projects/ia64_epc/sys/dev/wi/if_wi_pccard.c#5 integrate
.. //depot/projects/ia64_epc/sys/i386/conf/PAE#1 branch
.. //depot/projects/ia64_epc/sys/i386/i386/busdma_machdep.c#5 integrate
.. //depot/projects/ia64_epc/sys/i386/include/pmap.h#5 integrate
.. //depot/projects/ia64_epc/sys/i386/include/vmparam.h#3 integrate
.. //depot/projects/ia64_epc/sys/ia64/conf/GENERIC#4 integrate
.. //depot/projects/ia64_epc/sys/ia64/conf/SKI#4 integrate
.. //depot/projects/ia64_epc/sys/ia64/ia64/busdma_machdep.c#4 integrate
.. //depot/projects/ia64_epc/sys/kern/kern_mac.c#5 integrate
.. //depot/projects/ia64_epc/sys/kern/kern_thr.c#3 integrate
.. //depot/projects/ia64_epc/sys/kern/kern_thread.c#8 integrate
.. //depot/projects/ia64_epc/sys/kern/uipc_cow.c#5 integrate
.. //depot/projects/ia64_epc/sys/kern/uipc_mbuf.c#5 integrate
.. //depot/projects/ia64_epc/sys/modules/stg/Makefile#2 integrate
.. //depot/projects/ia64_epc/sys/net/if_disc.c#3 integrate
.. //depot/projects/ia64_epc/sys/net/if_faith.c#4 integrate
.. //depot/projects/ia64_epc/sys/net/if_loop.c#4 integrate
.. //depot/projects/ia64_epc/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c#3 integrate
.. //depot/projects/ia64_epc/sys/netgraph/ng_base.c#3 integrate
.. //depot/projects/ia64_epc/sys/netgraph/ng_iface.c#4 integrate
.. //depot/projects/ia64_epc/sys/netinet/ip_divert.c#3 integrate
.. //depot/projects/ia64_epc/sys/netinet/ip_input.c#5 integrate
.. //depot/projects/ia64_epc/sys/netinet/ip_mroute.c#4 integrate
.. //depot/projects/ia64_epc/sys/netinet/ip_output.c#4 integrate
.. //depot/projects/ia64_epc/sys/netipsec/keysock.c#3 integrate
.. //depot/projects/ia64_epc/sys/netkey/keysock.c#3 integrate
.. //depot/projects/ia64_epc/sys/netnatm/natm.c#4 integrate
.. //depot/projects/ia64_epc/sys/pci/agp_if.m#2 integrate
.. //depot/projects/ia64_epc/sys/pci/if_rl.c#5 integrate
.. //depot/projects/ia64_epc/sys/pci/if_xl.c#7 integrate
.. //depot/projects/ia64_epc/sys/powerpc/powerpc/busdma_machdep.c#5 integrate
.. //depot/projects/ia64_epc/sys/sparc64/conf/GENERIC#5 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/cache.h#3 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/iommuvar.h#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/kerneldump.h#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/md_var.h#3 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/ofw_mem.h#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/pmap.h#4 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/smp.h#3 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/tsb.h#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/include/watch.h#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/pci/psycho.c#3 integrate
.. //depot/projects/ia64_epc/sys/sparc64/pci/psychovar.h#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/bus_machdep.c#4 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/cheetah.c#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/db_hwwatch.c#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/dump_machdep.c#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/iommu.c#3 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/machdep.c#5 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/mem.c#5 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/mp_machdep.c#4 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/pmap.c#6 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/spitfire.c#2 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/tsb.c#3 integrate
.. //depot/projects/ia64_epc/sys/sparc64/sparc64/vm_machdep.c#5 integrate
.. //depot/projects/ia64_epc/sys/sys/mbuf.h#5 integrate
.. //depot/projects/ia64_epc/usr.bin/su/su.c#4 integrate
.. //depot/projects/ia64_epc/usr.sbin/ctm/ctm/ctm.h#2 integrate
.. //depot/projects/ia64_epc/usr.sbin/ctm/ctm/ctm_input.c#2 integrate
.. //depot/projects/ia64_epc/usr.sbin/jail/jail.c#3 integrate
.. //depot/projects/ia64_epc/usr.sbin/pppd/lcp.c#2 integrate
.. //depot/projects/ia64_epc/usr.sbin/wicontrol/wicontrol.8#4 integrate

Differences ...

==== //depot/projects/ia64_epc/bin/cp/cp.1#2 (text+ko) ====

@@ -33,7 +33,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)cp.1	8.3 (Berkeley) 4/18/94
-.\" $FreeBSD: src/bin/cp/cp.1,v 1.25 2002/08/16 03:13:59 johan Exp $
+.\" $FreeBSD: src/bin/cp/cp.1,v 1.26 2003/04/07 11:00:56 mdodd Exp $
 .\"
 .Dd July 23, 2002
 .Dt CP 1
@@ -225,6 +225,17 @@
 option is specified.
 In addition, these options override each other and the
 command's actions are determined by the last one specified.
+.Pp
+If
+.Nm
+receives a
+.Dv SIGINFO
+(see the
+.Cm status
+argument for
+.Xr stty 1 )
+signal, the current input and output file and the percentage complete
+will be written to the standard output.
 .Sh DIAGNOSTICS
 .Ex -std
 .Sh COMPATIBILITY

==== //depot/projects/ia64_epc/bin/cp/cp.c#2 (text+ko) ====

@@ -46,7 +46,7 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.43 2002/10/18 14:44:59 markm Exp $");
+__FBSDID("$FreeBSD: src/bin/cp/cp.c,v 1.45 2003/04/07 12:09:17 mdodd Exp $");
 
 /*
  * Cp copies source files to target files.
@@ -89,6 +89,9 @@
 int fflag, iflag, nflag, pflag, vflag;
 static int Rflag, rflag;
 
+volatile sig_atomic_t info;
+static void siginfo (int notused __unused);
+
 enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE };
 
 static int copy(char *[], enum op, int);
@@ -173,6 +176,7 @@
 		fts_options &= ~FTS_PHYSICAL;
 		fts_options |= FTS_LOGICAL | FTS_COMFOLLOW;
 	}
+	(void)signal(SIGINFO, siginfo);
 
 	/* Save the target base in "to". */
 	target = argv[--argc];
@@ -501,3 +505,10 @@
 		return (1);
 	return (0);
 }
+
+static void
+siginfo (int notused __unused)
+{
+
+	info = 1;
+}

==== //depot/projects/ia64_epc/bin/cp/extern.h#2 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)extern.h	8.2 (Berkeley) 4/1/94
- * $FreeBSD: src/bin/cp/extern.h,v 1.16 2002/10/18 14:44:59 markm Exp $
+ * $FreeBSD: src/bin/cp/extern.h,v 1.18 2003/04/07 12:09:17 mdodd Exp $
  */
 
 typedef struct {
@@ -42,6 +42,7 @@
 
 extern PATH_T to;
 extern int fflag, iflag, nflag, pflag, vflag;
+extern volatile sig_atomic_t info;
 
 __BEGIN_DECLS
 int	copy_fifo(struct stat *, int);

==== //depot/projects/ia64_epc/bin/cp/utils.c#2 (text+ko) ====

@@ -37,7 +37,7 @@
 #endif
 #endif /* not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.39 2002/10/18 14:45:00 markm Exp $");
+__FBSDID("$FreeBSD: src/bin/cp/utils.c,v 1.40 2003/04/07 11:00:56 mdodd Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -56,6 +56,7 @@
 #include <unistd.h>
 
 #include "extern.h"
+#define	cp_pct(x,y)	(int)(100.0 * (double)(x) / (double)(y))
 
 int
 copy_file(const FTSENT *entp, int dne)
@@ -65,6 +66,7 @@
 	int ch, checkch, from_fd, rcount, rval, to_fd;
 	ssize_t wcount;
 	size_t wresid;
+	size_t wtotal;
 	char *bufp;
 #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
 	char *p;
@@ -137,9 +139,19 @@
 			warn("%s", entp->fts_path);
 			rval = 1;
 		} else {
+			wtotal = 0;
 			for (bufp = p, wresid = fs->st_size; ;
 			    bufp += wcount, wresid -= (size_t)wcount) {
 				wcount = write(to_fd, bufp, wresid);
+				wtotal += wcount;
+				if (info) {
+					info = 0;
+					(void)fprintf(stderr,
+						"%s -> %s %3d%%\n",
+						entp->fts_path, to.p_path,
+						cp_pct(wtotal, fs->st_size));
+						
+				}
 				if (wcount >= (ssize_t)wresid || wcount <= 0)
 					break;
 			}
@@ -156,10 +168,20 @@
 	} else
 #endif
 	{
+		wtotal = 0;
 		while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
 			for (bufp = buf, wresid = rcount; ;
 			    bufp += wcount, wresid -= wcount) {
 				wcount = write(to_fd, bufp, wresid);
+				wtotal += wcount;
+				if (info) {
+					info = 0;
+					(void)fprintf(stderr,
+						"%s -> %s %3d%%\n",
+						entp->fts_path, to.p_path,
+						cp_pct(wtotal, fs->st_size));
+						
+				}
 				if (wcount >= (ssize_t)wresid || wcount <= 0)
 					break;
 			}

==== //depot/projects/ia64_epc/etc/Makefile#4 (text+ko) ====

@@ -1,5 +1,5 @@
 #	from: @(#)Makefile	5.11 (Berkeley) 5/21/91
-# $FreeBSD: src/etc/Makefile,v 1.307 2003/04/02 20:13:59 ru Exp $
+# $FreeBSD: src/etc/Makefile,v 1.308 2003/04/08 16:14:02 des Exp $
 
 .if !defined(NO_SENDMAIL)
 SUBDIR=	sendmail
@@ -129,6 +129,8 @@
 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
 	    ${DESTDIR}/var/log/cron
 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
+	    ${DESTDIR}/var/log/debug.log
+	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 600 /dev/null \
 	    ${DESTDIR}/var/log/xferlog
 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
 	    ${DESTDIR}/var/log/lpd-errs

==== //depot/projects/ia64_epc/etc/newsyslog.conf#3 (text+ko) ====

@@ -1,5 +1,5 @@
 # configuration file for newsyslog
-# $FreeBSD: src/etc/newsyslog.conf,v 1.43 2003/02/16 13:07:20 des Exp $
+# $FreeBSD: src/etc/newsyslog.conf,v 1.44 2003/04/08 16:14:02 des Exp $
 #
 # Note: some sites will want to select more restrictive protections than the
 # defaults.  In particular, it may be desirable to switch many of the 644
@@ -14,6 +14,7 @@
 /var/log/console.log			600  5	   100	*     J
 /var/log/cron				600  3	   100	*     J
 /var/log/daily.log			640  7	   *	@T00  J
+/var/log/debug.log			600  7     100  *     J
 /var/log/kerberos.log			600  7	   100	*     J
 /var/log/lpd-errs			644  7	   100	*     J
 /var/log/maillog			640  7	   *	@T00  J

==== //depot/projects/ia64_epc/etc/syslog.conf#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/syslog.conf,v 1.24 2003/04/03 18:37:49 yar Exp $
+# $FreeBSD: src/etc/syslog.conf,v 1.25 2003/04/08 16:14:02 des Exp $
 #
 #	Spaces ARE valid field separators in this file. However,
 #	other *nix-like systems still insist on using tabs as field
@@ -13,6 +13,7 @@
 lpr.info					/var/log/lpd-errs
 ftp.info					/var/log/xferlog
 cron.*						/var/log/cron
+*.debug						/var/log/debug.log
 *.emerg						*
 # uncomment this to log all writes to /dev/console to /var/log/console.log
 #console.info					/var/log/console.log

==== //depot/projects/ia64_epc/include/fstab.h#2 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)fstab.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/include/fstab.h,v 1.3 2002/03/23 17:24:53 imp Exp $
+ * $FreeBSD: src/include/fstab.h,v 1.4 2003/04/07 12:54:59 mdodd Exp $
  */
 
 #ifndef _FSTAB_H_
@@ -75,6 +75,8 @@
 struct fstab *getfsfile(const char *);
 int setfsent(void);
 void endfsent(void);
+void setfstab(const char *);
+const char *getfstab(void);
 __END_DECLS
 
 #endif /* !_FSTAB_H_ */

==== //depot/projects/ia64_epc/include/paths.h#2 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)paths.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/include/paths.h,v 1.17 2002/07/14 13:04:15 sobomax Exp $
+ * $FreeBSD: src/include/paths.h,v 1.18 2003/04/07 16:21:25 mdodd Exp $
  */
 
 #ifndef _PATHS_H_
@@ -60,6 +60,7 @@
 #define	_PATH_ETC	"/etc"
 #define	_PATH_FTPUSERS	"/etc/ftpusers"
 #define	_PATH_KMEM	"/dev/kmem"
+#define	_PATH_LIBMAP_CONF	"/etc/libmap.conf"
 #define	_PATH_LOGIN	"/usr/bin/login"
 #define	_PATH_MAILDIR	"/var/mail"
 #define	_PATH_MAN	"/usr/share/man"

==== //depot/projects/ia64_epc/lib/libc/gen/Makefile.inc#4 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile.inc	8.6 (Berkeley) 5/4/95
-# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.104 2003/02/15 10:52:46 phantom Exp $
+# $FreeBSD: src/lib/libc/gen/Makefile.inc,v 1.105 2003/04/07 12:55:00 mdodd Exp $
 
 # machine-independent gen sources
 .PATH: ${.CURDIR}/${MACHINE_ARCH}/gen ${.CURDIR}/gen
@@ -84,7 +84,8 @@
 MLINKS+=getcontext.3 setcontext.3
 MLINKS+=getdomainname.3 setdomainname.3
 MLINKS+=getfsent.3 endfsent.3 getfsent.3 getfsfile.3 getfsent.3 getfsspec.3 \
-	getfsent.3 getfstype.3 getfsent.3 setfsent.3
+	getfsent.3 getfstype.3 getfsent.3 setfsent.3 \
+	getfsent.3 setfstab.3 getfsent.3 getfstab.3
 MLINKS+=getgrent.3 endgrent.3 getgrent.3 getgrgid.3 getgrent.3 getgrnam.3 \
 	getgrent.3 setgrent.3 getgrent.3 setgroupent.3
 MLINKS+=gethostname.3 sethostname.3

==== //depot/projects/ia64_epc/lib/libc/gen/fstab.c#2 (text+ko) ====

@@ -35,7 +35,7 @@
 static char sccsid[] = "@(#)fstab.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/fstab.c,v 1.13 2002/02/01 01:32:19 obrien Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/fstab.c,v 1.14 2003/04/07 12:55:00 mdodd Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
@@ -54,11 +54,40 @@
 static FILE *_fs_fp;
 static struct fstab _fs_fstab;
 static int LineNo = 0;
+static char *path_fstab;
+static char fstab_path[PATH_MAX];
+static int fsp_set = 0;
 
 static void error(int);
 static void fixfsfile(void);
 static int fstabscan(void);
 
+void
+setfstab(const char *file)
+{
+
+	if (file == NULL) {
+		path_fstab = _PATH_FSTAB;
+	} else {
+		strncpy(fstab_path, file, PATH_MAX);
+		fstab_path[PATH_MAX - 1] = '\0';
+		path_fstab = fstab_path;
+	}
+	fsp_set = 1;
+
+	return;
+}
+
+const char *
+getfstab (void)
+{
+
+	if (fsp_set)
+		return (path_fstab);
+	else
+		return (_PATH_FSTAB);
+}
+
 static void
 fixfsfile()
 {
@@ -226,7 +255,13 @@
 		LineNo = 0;
 		return(1);
 	}
-	if ((_fs_fp = fopen(_PATH_FSTAB, "r")) != NULL) {
+	if (fsp_set == 0) {
+		if (issetugid())
+			setfstab(NULL);
+		else
+			setfstab(getenv("PATH_FSTAB"));
+	}
+	if ((_fs_fp = fopen(path_fstab, "r")) != NULL) {
 		LineNo = 0;
 		return(1);
 	}
@@ -241,6 +276,8 @@
 		(void)fclose(_fs_fp);
 		_fs_fp = NULL;
 	}
+
+	fsp_set = 0;
 }
 
 static void
@@ -251,7 +288,7 @@
 	char num[30];
 
 	(void)_write(STDERR_FILENO, "fstab: ", 7);
-	(void)_write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1);
+	(void)_write(STDERR_FILENO, path_fstab, strlen(path_fstab));
 	(void)_write(STDERR_FILENO, ":", 1);
 	sprintf(num, "%d: ", LineNo);
 	(void)_write(STDERR_FILENO, num, strlen(num));

==== //depot/projects/ia64_epc/lib/libc/gen/getfsent.3#2 (text+ko) ====

@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)getfsent.3	8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/getfsent.3,v 1.9 2001/10/01 16:08:51 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/getfsent.3,v 1.12 2003/04/07 22:59:12 mdodd Exp $
 .\"
-.Dd June 4, 1993
+.Dd April 7, 2003
 .Dt GETFSENT 3
 .Os
 .Sh NAME
@@ -56,6 +56,10 @@
 .Fn setfsent void
 .Ft void
 .Fn endfsent void
+.Ft void
+.Fn setfstab "const char *file"
+.Ft const char *
+.Fn getfstab void
 .Sh DESCRIPTION
 The
 .Fn getfsent ,
@@ -94,6 +98,18 @@
 closes the file.
 .Pp
 The
+.Fn setfstab
+function sets the file to be used by subsequent operations.
+The value set by
+.Fn setfstab
+does not persist across calls to
+.Fn endfsent
+.Pp
+The
+.Fn getfstab
+function returns the name of the file that that will be used.
+.Pp
+The
 .Fn getfsspec
 and
 .Fn getfsfile
@@ -128,6 +144,20 @@
 .Fn endfsent
 function
 returns nothing.
+.Sh ENVIRONMENT
+.Bl -tag -width PATH_FSTAB
+.It Pa PATH_FSTAB
+If the environment variable
+.Pa PATH_FSTAB
+is set all operations are performed against the specified file.
+.Pa PATH_FSTAB
+will not be honored if the process environment or memory address space is
+considred
+.Dq tainted .
+(See
+.Fn issetugid
+for more information.)
+.El
 .Sh FILES
 .Bl -tag -width /etc/fstab -compact
 .It Pa /etc/fstab
@@ -146,7 +176,13 @@
 and
 .Fn setfsent
 functions appeared in
-.Bx 4.3 .
+.Bx 4.3 ;
+the
+.Fn setfstab
+and
+.Fn getfstab
+functions appeared in
+.Fx 5.1.
 .Sh BUGS
 These functions use static data storage;
 if the data is needed for future use, it should be

==== //depot/projects/ia64_epc/lib/libc/stdio/vfwprintf.c#4 (text+ko) ====

@@ -39,9 +39,9 @@
 #if defined(LIBC_SCCS) && !defined(lint)
 static char sccsid[] = "@(#)vfprintf.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.52 2003/03/14 04:48:09 das Exp");
+__FBSDID("FreeBSD: src/lib/libc/stdio/vfprintf.c,v 1.57 2003/04/07 03:17:39 ache Exp");
 #endif
-__FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.9 2003/04/05 22:08:53 das Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/vfwprintf.c,v 1.10 2003/04/07 06:36:49 tjr Exp $");
 
 /*
  * Actual wprintf innards.
@@ -114,10 +114,10 @@
 };
 
 static int	__sbprintf(FILE *, const wchar_t *, va_list);
-static wchar_t	*__ujtoa(uintmax_t, wchar_t *, int, int, wchar_t *, int, char,
-		    const char *);
-static wchar_t	*__ultoa(u_long, wchar_t *, int, int, wchar_t *, int, char,
-		    const char *);
+static wchar_t	*__ujtoa(uintmax_t, wchar_t *, int, int, const wchar_t *, int,
+		    char, const char *);
+static wchar_t	*__ultoa(u_long, wchar_t *, int, int, const wchar_t *, int,
+		    char, const char *);
 static wchar_t	*__mbsconv(char *, int);
 static void	__find_arguments(const wchar_t *, va_list, union arg **);
 static void	__grow_type_table(int, enum typeid **, int *);
@@ -169,7 +169,7 @@
  * use the given digits.
  */
 static wchar_t *
-__ultoa(u_long val, wchar_t *endp, int base, int octzero, wchar_t *xdigs,
+__ultoa(u_long val, wchar_t *endp, int base, int octzero, const wchar_t *xdigs,
 	int needgrp, char thousep, const char *grp)
 {
 	wchar_t *cp = endp;
@@ -246,8 +246,8 @@
 
 /* Identical to __ultoa, but for intmax_t. */
 static wchar_t *
-__ujtoa(uintmax_t val, wchar_t *endp, int base, int octzero, wchar_t *xdigs, 
-	int needgrp, char thousep, const char *grp)
+__ujtoa(uintmax_t val, wchar_t *endp, int base, int octzero,
+	const wchar_t *xdigs, int needgrp, char thousep, const char *grp)
 {
 	wchar_t *cp = endp;
 	intmax_t sval;
@@ -330,6 +330,9 @@
 	size_t insize, nchars, nconv;
 	mbstate_t mbs;
 
+	if (mbsarg == NULL)
+		return (NULL);
+
 	/*
 	 * Supplied argument is a multibyte string; convert it to wide
 	 * characters first.
@@ -400,16 +403,17 @@
 }
 
 #ifdef FLOATING_POINT
+
+#define	dtoa		__dtoa
+#define	freedtoa	__freedtoa
+
 #include <float.h>
 #include <math.h>
 #include "floatio.h"
+#include "gdtoa.h"
 
 #define	DEFPREC		6
 
-extern char *__dtoa(double, int, int, int *, int *, char **);
-extern void __freedtoa(char *s);
-
-static wchar_t *cvt(double, int, int, char *, int *, wchar_t, int *);
 static int exponent(wchar_t *, int, wchar_t);
 
 #endif /* FLOATING_POINT */
@@ -429,7 +433,6 @@
  * Flags used during conversion.
  */
 #define	ALT		0x001		/* alternate form */
-#define	HEXPREFIX	0x002		/* add 0x or 0X prefix */
 #define	LADJUST		0x004		/* left adjustment */
 #define	LONGDBL		0x008		/* long double */
 #define	LONGINT		0x010		/* long integer */
@@ -452,24 +455,46 @@
 {
 	wchar_t *fmt;		/* format string */
 	wchar_t ch;		/* character from fmt */
-	int n, n2;		/* handy integer (short term usage) */
+	int n, n2, n3;		/* handy integer (short term usage) */
 	wchar_t *cp;		/* handy char pointer (short term usage) */
 	int flags;		/* flags as above */
 	int ret;		/* return value accumulator */
 	int width;		/* width from format (%8d), or 0 */
-	int prec;		/* precision from format (%.3d), or -1 */
+	int prec;		/* precision from format; <0 for N/A */
 	wchar_t sign;		/* sign prefix (' ', '+', '-', or \0) */
 	char thousands_sep;	/* locale specific thousands separator */
 	const char *grouping;	/* locale specific numeric grouping rules */
 #ifdef FLOATING_POINT
+	/*
+	 * We can decompose the printed representation of floating
+	 * point numbers into several parts, some of which may be empty:
+	 *
+	 * [+|-| ] [0x|0X] MMM . NNN [e|E|p|P] [+|-] ZZ
+	 *    A       B     ---C---      D       E   F
+	 *
+	 * A:	'sign' holds this value if present; '\0' otherwise
+	 * B:	ox[1] holds the 'x' or 'X'; '\0' if not hexadecimal
+	 * C:	cp points to the string MMMNNN.  Leading and trailing
+	 *	zeros are not in the string and must be added.
+	 * D:	expchar holds this character; '\0' if no exponent, e.g. %f
+	 * F:	at least two digits for decimal, at least one digit for hex
+	 */
 	char *decimal_point;	/* locale specific decimal point */
-	char softsign;		/* temporary negative sign for floats */
-	double _double;		/* double precision arguments %[eEfgG] */
+	int signflag;		/* true if float is negative */
+	union {			/* floating point arguments %[aAeEfFgG] */
+		double dbl;
+		long double ldbl;
+	} fparg;
 	int expt;		/* integer value of exponent */
+	char expchar;		/* exponent character: [eEpP\0] */
+	char *dtoaend;		/* pointer to end of converted digits */
 	int expsize;		/* character count for expstr */
-	int ndig;		/* actual number of digits returned by cvt */
-	wchar_t expstr[7];	/* buffer for exponent string */
-	wchar_t *dtoaresult;	/* buffer allocated by dtoa */
+	int lead;		/* sig figs before decimal or group sep */
+	int ndig;		/* actual number of digits returned by dtoa */
+	wchar_t expstr[MAXEXPDIG+2];	/* buffer for exponent string: e+ZZZ */
+	char *dtoaresult;	/* buffer allocated by dtoa */
+	int nseps;		/* number of group separators with ' */
+	int nrepeats;		/* number of repeats of the last group */
 #endif
 	u_long	ulval;		/* integer arguments %[diouxX] */
 	uintmax_t ujval;	/* %j, %ll, %q, %t, %z integers */
@@ -478,7 +503,7 @@
 	int realsz;		/* field size expanded by dprec, sign, etc */
 	int size;		/* size of converted field or string */
 	int prsize;             /* max size of printed field */
-	wchar_t *xdigs;		/* digits for [xX] conversion */
+	const wchar_t *xdigs;	/* digits for [xX] conversion */
 	wchar_t buf[BUF];	/* buffer with space for digits of uintmax_t */
 	wchar_t ox[2];		/* space for 0x hex-prefix */
 	union arg *argtable;	/* args, built due to positional arg */
@@ -498,13 +523,16 @@
 	static wchar_t zeroes[PADSIZE] =
 	 {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'};
 
+	static const wchar_t xdigs_lower[16] = L"0123456789abcdef";
+	static const wchar_t xdigs_upper[16] = L"0123456789ABCDEF";
+
 	/*
 	 * BEWARE, these `goto error' on error, PRINT uses `n2' and
 	 * PAD uses `n'.
 	 */
 #define	PRINT(ptr, len)	do {			\
-	for (n2 = 0; n2 < (len); n2++)		\
-		__fputwc((ptr)[n2], fp);	\
+	for (n3 = 0; n3 < (len); n3++)		\
+		__fputwc((ptr)[n3], fp);	\
 } while (0)
 #define	PAD(howmany, with)	do {		\
 	if ((n = (howmany)) > 0) {		\
@@ -515,6 +543,14 @@
 		PRINT(with, n);			\
 	}					\
 } while (0)
+#define	PRINTANDPAD(p, ep, len, with) do {	\
+	n2 = (ep) - (p);       			\
+	if (n2 > (len))				\
+		n2 = (len);			\
+	if (n2 > 0)				\
+		PRINT((p), n2);			\
+	PAD((len) - (n2 > 0 ? n2 : 0), (with));	\
+} while(0)
 
 	/*
 	 * Get the argument indexed by nextarg.   If the argument table is
@@ -580,7 +616,6 @@
 	thousands_sep = '\0';
 	grouping = NULL;
 #ifdef FLOATING_POINT
-	dtoaresult = NULL;
 	decimal_point = localeconv()->decimal_point;
 #endif
 	convbuf = NULL;
@@ -622,6 +657,7 @@
 		width = 0;
 		prec = -1;
 		sign = '\0';
+		ox[1] = '\0';
 
 rflag:		ch = *fmt++;
 reswitch:	switch (ch) {
@@ -662,16 +698,14 @@
 			goto rflag;
 		case '.':
 			if ((ch = *fmt++) == '*') {
-				GETASTER (n);
-				prec = n < 0 ? -1 : n;
+				GETASTER (prec);
 				goto rflag;
 			}
-			n = 0;
+			prec = 0;
 			while (is_digit(ch)) {
-				n = 10 * n + to_digit(ch);
+				prec = 10 * prec + to_digit(ch);
 				ch = *fmt++;
 			}
-			prec = n < 0 ? -1 : n;
 			goto reswitch;
 		case '0':
 			/*-
@@ -765,86 +799,128 @@
 #ifdef HEXFLOAT
 		case 'a':
 		case 'A':
+			if (ch == 'a') {
+				ox[1] = 'x';
+				xdigs = xdigs_lower;
+				expchar = 'p';
+			} else {
+				ox[1] = 'X';
+				xdigs = xdigs_upper;
+				expchar = 'P';
+			}
+			/*
+			 * XXX We don't actually have a conversion
+			 * XXX routine for this yet.
+			 */
+			if (flags & LONGDBL) {
+				fparg.ldbl = (double)GETARG(long double);
+				dtoaresult =
+				    __hldtoa(fparg.ldbl, xdigs, prec,
+				        &expt, &signflag, &dtoaend);
+			} else {
+				fparg.dbl = GETARG(double);
+				dtoaresult =
+				    __hdtoa(fparg.dbl, xdigs, prec,
+				        &expt, &signflag, &dtoaend);
+			}
+			if (convbuf != NULL)
+				free(convbuf);
+			cp = convbuf = __mbsconv(dtoaresult, -1);
+			freedtoa(dtoaresult);
+			goto fp_begin;
 #endif
 		case 'e':
 		case 'E':
-			/*-
-			 * Grouping apply to %i, %d, %u, %f, %F, %g, %G
-			 * conversion specifiers only. For other conversions
-			 * behavior is undefined.
-			 *	-- POSIX
-			 */
-			flags &= ~GROUPING;
-			/*FALLTHROUGH*/
+			expchar = ch;
+			if (prec < 0)	/* account for digit before decpt */
+				prec = DEFPREC + 1;
+			else
+				prec++;
+			goto fp_begin;
 		case 'f':
 		case 'F':
+			expchar = '\0';
 			goto fp_begin;
 		case 'g':
 		case 'G':
+			expchar = ch - ('g' - 'e');
 			if (prec == 0)
 				prec = 1;
-fp_begin:		if (prec == -1)
+fp_begin:
+			if (prec < 0)
 				prec = DEFPREC;
-			if (flags & LONGDBL)
-				/* XXX this loses precision. */
-				_double = (double)GETARG(long double);
-			else
-				_double = GETARG(double);
-			/* do this before tricky precision changes */
-			if (isinf(_double)) {
-				if (_double < 0)
-					sign = '-';
-				if (iswupper(ch))
-					cp = L"INF";
-				else
-					cp = L"inf";
-				size = 3;
-				break;
+			if (convbuf != NULL)
+				free(convbuf);
+			if (flags & LONGDBL) {
+				fparg.ldbl = GETARG(long double);
+				dtoaresult =
+				    __ldtoa(&fparg.ldbl, expchar ? 2 : 3, prec,
+				    &expt, &signflag, &dtoaend);
+			} else {
+				fparg.dbl = GETARG(double);
+				dtoaresult =
+				    dtoa(fparg.dbl, expchar ? 2 : 3, prec,
+				    &expt, &signflag, &dtoaend);
+				if (expt == 9999)
+					expt = INT_MAX;
 			}
-			if (isnan(_double)) {
-				if (iswupper(ch))
-					cp = L"NAN";
-				else
-					cp = L"nan";
+			ndig = dtoaend - dtoaresult;
+			cp = convbuf = __mbsconv(dtoaresult, -1);
+			freedtoa(dtoaresult);
+			if (signflag)
+				sign = '-';
+			if (expt == INT_MAX) {	/* inf or nan */
+				if (*cp == 'N') {
+					cp = (ch >= 'a') ? L"nan" : L"NAN";
+					sign = '\0';
+				} else
+					cp = (ch >= 'a') ? L"inf" : L"INF";
 				size = 3;
 				break;
 			}
 			flags |= FPT;
-			if (dtoaresult != NULL) {
-				free(dtoaresult);
-				dtoaresult = NULL;
-			}
-			dtoaresult = cp = cvt(_double, prec, flags, &softsign,
-				&expt, ch, &ndig);
 			if (ch == 'g' || ch == 'G') {
-				if (expt <= -4 || expt > prec)
-					ch = (ch == 'g') ? 'e' : 'E';
-				else
-					ch = 'g';
+				if (expt > -4 && expt <= prec) {
+					/* Make %[gG] smell like %[fF] */
+					expchar = '\0';
+					if (flags & ALT)
+						prec -= expt;
+					else
+						prec = ndig - expt;
+					if (prec < 0)
+						prec = 0;
+				}
 			}
-			if (ch == 'e' || ch == 'E') {
-				--expt;
-				expsize = exponent(expstr, expt, ch);
-				size = expsize + ndig;
-				if (ndig > 1 || flags & ALT)
+			if (expchar) {
+				expsize = exponent(expstr, expt - 1, expchar);
+				size = expsize + prec;
+				if (prec > 1 || flags & ALT)
 					++size;
-			} else if (ch == 'f' || ch == 'F') {
+			} else {
 				if (expt > 0) {
 					size = expt;
 					if (prec || flags & ALT)
 						size += prec + 1;
 				} else	/* "0.X" */
 					size = prec + 2;
-			} else if (expt >= ndig) {	/* fixed g fmt */
-				size = expt;
-				if (flags & ALT)
-					++size;
-			} else
-				size = ndig + (expt > 0 ?
-					1 : 2 - expt);
-
-			if (softsign)
-				sign = '-';
+				if (grouping && expt > 0) {
+					/* space for thousands' grouping */
+					nseps = nrepeats = 0;
+					lead = expt;
+					while (*grouping != CHAR_MAX) {
+						if (lead <= *grouping)
+							break;
+						lead -= *grouping;
+						if (*(grouping+1)) {
+							nseps++;
+							grouping++;
+						} else
+							nrepeats++;
+					}
+					size += nseps + nrepeats;
+				} else
+					lead = expt;
+			}
 			break;
 #endif /* FLOATING_POINT */
 		case 'n':
@@ -890,9 +966,9 @@
 			 */
 			ujval = (uintmax_t)(uintptr_t)GETARG(void *);
 			base = 16;
-			xdigs = L"0123456789abcdef";
-			flags = flags | INTMAXT | HEXPREFIX;
-			ch = 'x';
+			xdigs = xdigs_lower;
+			flags = flags | INTMAXT;
+			ox[1] = 'x';
 			goto nosign;
 		case 'S':
 			flags |= LONGINT;
@@ -947,10 +1023,10 @@
 			base = 10;

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304090002.h39021ED011485>