mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-31 21:06:18 +01:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0d351b26b | ||
|
|
fcc0587080 |
No files matched your search
@@ -1,15 +1,16 @@
|
||||
#
|
||||
# $Id: Makefile,v 1.109.2.24 1998/03/09 14:18:02 jkh Exp $
|
||||
# $Id: Makefile,v 1.109.2.4 1997/05/13 16:09:59 jdp Exp $
|
||||
#
|
||||
# Make command line options:
|
||||
# -DCLOBBER will remove /usr/include
|
||||
# -DMAKE_KERBEROS4 to build KerberosIV
|
||||
# -DMAKE_LOCAL to add ./local to the SUBDIR list
|
||||
# -DMAKE_PORTS to add ./ports to the SUBDIR list
|
||||
# -DMAKE_EBONES to build eBones (KerberosIV)
|
||||
# -DALLLANG to build documentation for all languages
|
||||
# (where available -- see share/doc/Makefile)
|
||||
#
|
||||
# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir
|
||||
# -DNOCLEAN do not clean at all
|
||||
# -DNOTOOLS do not rebuild any tools first
|
||||
# -DNOCRYPT will prevent building of crypt versions
|
||||
# -DNOLKM do not build loadable kernel modules
|
||||
# -DNOOBJDIR do not run ``${MAKE} obj''
|
||||
@@ -18,14 +19,11 @@
|
||||
# -DNOGAMES do not go into games subdir
|
||||
# -DNOSHARE do not go into share subdir
|
||||
# -DNOINFO do not make or install info files
|
||||
# -DNOPERL do not make or install perl
|
||||
# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
|
||||
|
||||
#
|
||||
# The intended user-driven targets are:
|
||||
# buildworld - rebuild *everything*, including glue to help do upgrades
|
||||
# installworld- install everything built by "buildworld"
|
||||
# world - buildworld + installworld
|
||||
# world - rebuild *everything*, including glue to help do upgrades.
|
||||
# reinstall - use an existing (eg: NFS mounted) build to do an update.
|
||||
# update - convenient way to update your source tree (eg: sup/cvs)
|
||||
# most - build user commands, no libraries or include files
|
||||
# installmost - install user commands, no libraries or include files
|
||||
@@ -34,20 +32,10 @@
|
||||
# /usr/share/mk. These include:
|
||||
# obj depend all install clean cleandepend cleanobj
|
||||
|
||||
.if (!make(world)) && (!make(buildworld)) && (!make(installworld))
|
||||
.MAKEFLAGS:= ${.MAKEFLAGS} -m ${.CURDIR}/share/mk
|
||||
.endif
|
||||
|
||||
# Put initial settings here.
|
||||
SUBDIR=
|
||||
|
||||
# We must do share/info early so that installation of info `dir'
|
||||
# entries works correctly. Do it first since it is less likely to
|
||||
# grow dependencies on include and lib than vice versa.
|
||||
.if exists(share/info)
|
||||
SUBDIR+= share/info
|
||||
.endif
|
||||
|
||||
# We must do include and lib first so that the perl *.ph generation
|
||||
# works correctly as it uses the header files installed by this.
|
||||
.if exists(include)
|
||||
@@ -66,8 +54,8 @@ SUBDIR+= games
|
||||
.if exists(gnu)
|
||||
SUBDIR+= gnu
|
||||
.endif
|
||||
.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
SUBDIR+= kerberosIV
|
||||
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
|
||||
SUBDIR+= eBones
|
||||
.endif
|
||||
.if exists(libexec)
|
||||
SUBDIR+= libexec
|
||||
@@ -101,12 +89,11 @@ SUBDIR+= etc
|
||||
|
||||
# These are last, since it is nice to at least get the base system
|
||||
# rebuilt before you do them.
|
||||
.if defined(LOCAL_DIRS)
|
||||
.for _DIR in ${LOCAL_DIRS}
|
||||
.if exists(${_DIR}) & exists(${_DIR}/Makefile)
|
||||
SUBDIR+= ${_DIR}
|
||||
.if defined(MAKE_LOCAL) & exists(local) & exists(local/Makefile)
|
||||
SUBDIR+= local
|
||||
.endif
|
||||
.endfor
|
||||
.if defined(MAKE_PORTS) & exists(ports) & exists(ports/Makefile)
|
||||
SUBDIR+= ports
|
||||
.endif
|
||||
|
||||
# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR
|
||||
@@ -126,8 +113,8 @@ CLEANDIR= cleandir
|
||||
.endif
|
||||
.endif
|
||||
|
||||
SUP?= sup
|
||||
SUPFLAGS?= -v
|
||||
SUP?= sup
|
||||
SUPFLAGS?= -v
|
||||
|
||||
#
|
||||
# While building tools for bootstrapping, we dont need to waste time on
|
||||
@@ -148,14 +135,87 @@ world:
|
||||
@echo "make world started on `LC_TIME=C date`"
|
||||
@echo "--------------------------------------------------------------"
|
||||
.if target(pre-world)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Making 'pre-world' target"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} pre-world
|
||||
@echo
|
||||
.endif
|
||||
cd ${.CURDIR} && ${MAKE} buildworld
|
||||
cd ${.CURDIR} && ${MAKE} -B installworld
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Making hierarchy"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} hierarchy
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/share/mk"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} mk
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Cleaning up the source tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
.if defined(NOCLEAN)
|
||||
@echo "Not cleaning anything! I sure hope you know what you are doing!"
|
||||
.else
|
||||
cd ${.CURDIR} && ${MAKE} ${CLEANDIR}
|
||||
.endif
|
||||
@echo
|
||||
.if !defined(NOOBJDIR)
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding the obj tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} obj
|
||||
@echo
|
||||
.endif
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding bootstrap tools"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} bootstrap
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding tools necessary to build the include files"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} include-tools
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/include"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} includes
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding tools needed to build the libraries"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} lib-tools
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/lib"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} libraries
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding sgml tools, symorder, groff and zic(8)"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} build-tools
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding dependencies"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} depend
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Building everything.."
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} all
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Installing everything.."
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} install
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding man page indexes"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}/share/man && ${MAKE} makedb
|
||||
.if target(post-world)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@@ -168,146 +228,6 @@ world:
|
||||
@echo "make world completed on `LC_TIME=C date`"
|
||||
@echo "--------------------------------------------------------------"
|
||||
|
||||
.if defined(MAKEOBJDIRPREFIX)
|
||||
WORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
|
||||
.else
|
||||
WORLDTMP= /usr/obj${.CURDIR}/tmp
|
||||
.endif
|
||||
STRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin
|
||||
TMPPATH= ${STRICTTMPPATH}:${PATH}
|
||||
|
||||
# XXX COMPILER_PATH is needed for finding cc1, ld and as
|
||||
# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecssary now
|
||||
# tbat LIBRARY_PATH is set. We still can't use -nostdlib, since gcc
|
||||
# wouldn't link *crt.o or libgcc if it were used.
|
||||
# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't
|
||||
# want that - all compile-time library paths should be resolved by gcc.
|
||||
# It fails for set[ug]id executables (are any used?).
|
||||
COMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \
|
||||
COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \
|
||||
GCC_EXEC_PREFIX=${WORLDTMP}/usr/lib/ \
|
||||
LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \
|
||||
LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib
|
||||
|
||||
BMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t
|
||||
XMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \
|
||||
CC='cc -nostdinc' # XXX -nostdlib
|
||||
|
||||
# used to compile and install 'make' in temporary build tree
|
||||
IBMAKE= ${BMAKEENV} ${MAKE} DESTDIR=${WORLDTMP}
|
||||
# bootstrap make
|
||||
BMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
|
||||
# cross make used for compilation
|
||||
XMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE} DESTDIR=${WORLDTMP}
|
||||
# cross make used for final installation
|
||||
IXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/${MAKE}
|
||||
|
||||
#
|
||||
# buildworld
|
||||
#
|
||||
# Attempt to rebuild the entire system, with reasonable chance of
|
||||
# success, regardless of how old your existing system is.
|
||||
#
|
||||
buildworld:
|
||||
.if !defined(NOCLEAN)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Cleaning up the temporary build tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
mkdir -p ${WORLDTMP}
|
||||
chflags -R noschg ${WORLDTMP}/
|
||||
rm -rf ${WORLDTMP}
|
||||
.endif
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Making make"
|
||||
@echo "--------------------------------------------------------------"
|
||||
mkdir -p ${WORLDTMP}/usr/bin
|
||||
.if !defined(NOCLEAN) || !defined(NOOBJDIR)
|
||||
cd ${.CURDIR}/usr.bin/make && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
cd ${.CURDIR}/usr.bin/make && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk depend && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install && \
|
||||
${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean cleandepend
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Making hierarchy"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} hierarchy
|
||||
.if !defined(NOCLEAN)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Cleaning up the obj tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} par-${CLEANDIR}
|
||||
.endif
|
||||
.if !defined(NOOBJDIR)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding the obj tree"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} par-obj
|
||||
.endif
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding bootstrap tools"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} bootstrap
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding tools necessary to build the include files"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} include-tools
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/include"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && SHARED=symlinks ${BMAKE} includes
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding tools needed to build the libraries"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} lib-tools
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/lib"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} libraries
|
||||
.if !defined(NOTOOLS)
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding all other tools needed to build the world"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${BMAKE} build-tools
|
||||
.endif
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding dependencies"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${XMAKE} ${.MAKEFLAGS} par-depend
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Building everything.."
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${XMAKE} all
|
||||
|
||||
#
|
||||
# installworld
|
||||
#
|
||||
# Installs everything compiled by a 'buildworld'.
|
||||
#
|
||||
installworld:
|
||||
cd ${.CURDIR} && ${IXMAKE} reinstall
|
||||
|
||||
#
|
||||
# reinstall
|
||||
#
|
||||
@@ -322,20 +242,21 @@ reinstall:
|
||||
cd ${.CURDIR} && ${MAKE} hierarchy
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding /usr/share/mk"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} mk
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Installing everything.."
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ${MAKE} install
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Re-scanning the shared libraries.."
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && ldconfig -R
|
||||
@echo
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo " Rebuilding man page indexes"
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR}/share/man && ${MAKE} makedb
|
||||
|
||||
|
||||
#
|
||||
# update
|
||||
#
|
||||
@@ -359,9 +280,10 @@ update:
|
||||
@echo "--------------------------------------------------------------"
|
||||
@echo "Updating /usr/src from cvs repository" ${CVSROOT}
|
||||
@echo "--------------------------------------------------------------"
|
||||
cd ${.CURDIR} && cvs -q update -P -d -r RELENG_2_2
|
||||
cd ${.CURDIR} && cvs -q update -P -d
|
||||
.endif
|
||||
|
||||
|
||||
#
|
||||
# most
|
||||
#
|
||||
@@ -379,8 +301,8 @@ most:
|
||||
cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} all
|
||||
cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} all
|
||||
cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} all
|
||||
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/kerberosIV && ${MAKE} ${.MAKEFLAGS} most
|
||||
#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} most
|
||||
#.endif
|
||||
#.if !defined(NOSECURE) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} most
|
||||
@@ -404,8 +326,8 @@ installmost:
|
||||
cd ${.CURDIR}/gnu/libexec && ${MAKE} ${.MAKEFLAGS} install
|
||||
cd ${.CURDIR}/gnu/usr.bin && ${MAKE} ${.MAKEFLAGS} install
|
||||
cd ${.CURDIR}/gnu/usr.sbin && ${MAKE} ${.MAKEFLAGS} install
|
||||
#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/kerberos4 && ${MAKE} ${.MAKEFLAGS} installmost
|
||||
#.if defined(MAKE_EBONES) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/eBones && ${MAKE} ${.MAKEFLAGS} installmost
|
||||
#.endif
|
||||
#.if !defined(NOSECURE) && !defined(NOCRYPT)
|
||||
# cd ${.CURDIR}/secure && ${MAKE} ${.MAKEFLAGS} installmost
|
||||
@@ -428,43 +350,34 @@ installmost:
|
||||
hierarchy:
|
||||
cd ${.CURDIR}/etc && ${MAKE} distrib-dirs
|
||||
|
||||
#
|
||||
# mk - update the /usr/share/mk makefiles.
|
||||
#
|
||||
mk:
|
||||
cd ${.CURDIR}/share/mk && ${MAKE} install
|
||||
|
||||
#
|
||||
# bootstrap - [re]build tools needed to run the actual build, this includes
|
||||
# tools needed by 'make depend', as some tools are needed to generate source
|
||||
# for the dependency information to be gathered from.
|
||||
#
|
||||
bootstrap:
|
||||
.if defined(DESTDIR)
|
||||
rm -f ${DESTDIR}/usr/src/sys
|
||||
ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src
|
||||
cd ${.CURDIR}/include && find -dx . | cpio -dump ${DESTDIR}/usr/include
|
||||
cd ${.CURDIR}/include && make symlinks
|
||||
.endif
|
||||
cd ${.CURDIR}/usr.bin/make && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/xinstall && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/lex && ${MAKE} bootstrap && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} -DNOLIB all && \
|
||||
${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR}
|
||||
.if !defined(NOOBJDIR)
|
||||
cd ${.CURDIR}/usr.bin/lex && ${MAKE} obj
|
||||
.endif
|
||||
${MAKE} ${MK_FLAGS} -DNOLIB all install ${CLEANDIR} ${OBJDIR}
|
||||
|
||||
#
|
||||
# include-tools - generally the same as 'bootstrap', except that it's for
|
||||
# things that are specifically needed to generate include files.
|
||||
#
|
||||
# XXX should be merged with bootstrap, it's not worth keeeping them separate.
|
||||
# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies
|
||||
# on cleaned away headers in ${WORLDTMP}.
|
||||
# XXX should be merged with bootstrap, it's not worth keeeping them seperate
|
||||
#
|
||||
include-tools:
|
||||
cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} -B cleandepend depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/rpcgen && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} depend all install ${CLEANDIR} ${OBJDIR}
|
||||
|
||||
#
|
||||
# includes - possibly generate and install the include files.
|
||||
@@ -475,31 +388,25 @@ includes:
|
||||
mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \
|
||||
-p ${DESTDIR}/usr/include
|
||||
.endif
|
||||
cd ${.CURDIR}/include && ${MAKE} -B all install
|
||||
cd ${.CURDIR}/include/rpcsvc && ${MAKE} all
|
||||
cd ${.CURDIR}/include && ${MAKE} install
|
||||
cd ${.CURDIR}/gnu/include && ${MAKE} install
|
||||
cd ${.CURDIR}/gnu/lib/libreadline && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libregex && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libstdc++ && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall
|
||||
.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
cd ${.CURDIR}/kerberosIV/lib/libacl && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkadm && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkafs && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkdb && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libkrb && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/kerberosIV/lib/libtelnet && ${MAKE} beforeinstall
|
||||
.else
|
||||
cd ${.CURDIR}/lib/libtelnet && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libstdc++ && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libg++ && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/gnu/lib/libdialog && ${MAKE} beforeinstall
|
||||
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
|
||||
cd ${.CURDIR}/eBones/include && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/eBones/lib/libkrb && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/eBones/lib/libkadm && ${MAKE} beforeinstall
|
||||
.endif
|
||||
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libalias && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libc && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libcurses && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libedit && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libftpio && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libmd && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libmytinfo && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libmytinfo && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libncurses && ${MAKE} beforeinstall
|
||||
.if !defined(WANT_CSRG_LIBM)
|
||||
cd ${.CURDIR}/lib/msun && ${MAKE} beforeinstall
|
||||
@@ -507,37 +414,42 @@ includes:
|
||||
cd ${.CURDIR}/lib/libpcap && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/librpcsvc && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libskey && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libtcl && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libtermcap && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libcom_err && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libss && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libscsi && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libutil && ${MAKE} beforeinstall
|
||||
cd ${.CURDIR}/lib/libz && ${MAKE} beforeinstall
|
||||
|
||||
#
|
||||
# lib-tools - build tools to compile and install the libraries.
|
||||
#
|
||||
# XXX gperf is required for cc
|
||||
# XXX a new ld and tsort is required for cc
|
||||
lib-tools:
|
||||
.for d in \
|
||||
gnu/usr.bin/gperf \
|
||||
gnu/usr.bin/ld \
|
||||
usr.bin/tsort \
|
||||
gnu/usr.bin/as \
|
||||
gnu/usr.bin/bison \
|
||||
gnu/usr.bin/cc \
|
||||
usr.bin/ar \
|
||||
usr.bin/compile_et \
|
||||
usr.bin/lex/lib \
|
||||
usr.bin/mk_cmds \
|
||||
usr.bin/nm \
|
||||
usr.bin/ranlib \
|
||||
usr.bin/uudecode
|
||||
cd ${.CURDIR}/$d && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endfor
|
||||
cd ${.CURDIR}/usr.bin/tsort && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/gnu/usr.bin/ld && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/gnu/usr.bin/as && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/ar && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/ranlib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/nm && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/usr.bin/compile_et && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR} && \
|
||||
rm -f /usr/sbin/compile_et
|
||||
cd ${.CURDIR}/usr.bin/mk_cmds && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/gnu/usr.bin/bison && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/gnu/usr.bin/gperf && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
cd ${.CURDIR}/gnu/usr.bin/cc && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
|
||||
#
|
||||
# libraries - build and install the libraries
|
||||
@@ -545,142 +457,62 @@ lib-tools:
|
||||
libraries:
|
||||
.if exists(lib/csu/i386)
|
||||
cd ${.CURDIR}/lib/csu/i386 && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib/libcompat)
|
||||
cd ${.CURDIR}/lib/libcompat && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib/libncurses)
|
||||
cd ${.CURDIR}/lib/libncurses && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib/libtermcap)
|
||||
cd ${.CURDIR}/lib/libtermcap && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(gnu)
|
||||
cd ${.CURDIR}/gnu/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE)
|
||||
cd ${.CURDIR}/secure/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(lib)
|
||||
cd ${.CURDIR}/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(usr.bin/lex/lib)
|
||||
cd ${.CURDIR}/usr.bin/lex/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4)
|
||||
cd ${.CURDIR}/kerberosIV/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.if exists(eBones) && !defined(NOCRYPT) && defined(MAKE_EBONES)
|
||||
cd ${.CURDIR}/eBones/lib && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
.if exists(usr.sbin/pcvt/keycap)
|
||||
cd ${.CURDIR}/usr.sbin/pcvt/keycap && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endif
|
||||
|
||||
#
|
||||
# build-tools - build and install any other tools needed to complete the
|
||||
# compile and install.
|
||||
# ifdef stale
|
||||
# bc and cpp are required to build groff. Otherwise, the order here is
|
||||
# mostly historical, i.e., bogus.
|
||||
# chmod is used to build gcc's tmpmultilib[2] at obscure times.
|
||||
# endif stale
|
||||
# XXX uname is a bug - the target should not depend on the host.
|
||||
#
|
||||
build-tools:
|
||||
.for d in \
|
||||
bin/cat \
|
||||
bin/chmod \
|
||||
bin/cp \
|
||||
bin/date \
|
||||
bin/dd \
|
||||
bin/echo \
|
||||
bin/expr \
|
||||
bin/hostname \
|
||||
bin/ln \
|
||||
bin/ls \
|
||||
bin/mkdir \
|
||||
bin/mv \
|
||||
bin/rm \
|
||||
bin/sh \
|
||||
bin/test \
|
||||
gnu/usr.bin/awk \
|
||||
gnu/usr.bin/bc \
|
||||
gnu/usr.bin/grep \
|
||||
gnu/usr.bin/groff \
|
||||
gnu/usr.bin/gzip \
|
||||
gnu/usr.bin/man/makewhatis \
|
||||
gnu/usr.bin/sort \
|
||||
gnu/usr.bin/texinfo \
|
||||
share/info \
|
||||
usr.bin/basename \
|
||||
usr.bin/cap_mkdb \
|
||||
usr.bin/chflags \
|
||||
usr.bin/cmp \
|
||||
usr.bin/col \
|
||||
usr.bin/cpp \
|
||||
usr.bin/expand \
|
||||
usr.bin/file2c \
|
||||
usr.bin/find \
|
||||
usr.bin/gencat \
|
||||
usr.bin/lorder \
|
||||
usr.bin/m4 \
|
||||
usr.bin/mkdep \
|
||||
usr.bin/paste \
|
||||
usr.bin/sed \
|
||||
usr.bin/size \
|
||||
usr.bin/soelim \
|
||||
usr.bin/strip \
|
||||
gnu/usr.bin/texinfo \
|
||||
usr.bin/symorder \
|
||||
usr.bin/touch \
|
||||
usr.bin/tr \
|
||||
usr.bin/true \
|
||||
usr.bin/uname \
|
||||
usr.bin/uuencode \
|
||||
usr.bin/vgrind \
|
||||
usr.bin/vi \
|
||||
usr.bin/wc \
|
||||
usr.bin/yacc \
|
||||
usr.sbin/chown \
|
||||
usr.sbin/mtree \
|
||||
usr.sbin/zic
|
||||
usr.bin/sgmls \
|
||||
usr.bin/sgmlfmt \
|
||||
share/sgml \
|
||||
usr.sbin/zic \
|
||||
gnu/usr.bin/awk \
|
||||
gnu/usr.bin/groff
|
||||
cd ${.CURDIR}/$d && ${MAKE} depend && \
|
||||
${MAKE} ${MK_FLAGS} all && \
|
||||
${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR}
|
||||
.endfor
|
||||
|
||||
.for __target in clean cleandir obj depend
|
||||
.for entry in ${SUBDIR}
|
||||
${entry}.${__target}__D: .PHONY
|
||||
if test -d ${.CURDIR}/${entry}.${MACHINE}; then \
|
||||
${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \
|
||||
edir=${entry}.${MACHINE}; \
|
||||
cd ${.CURDIR}/$${edir}; \
|
||||
else \
|
||||
${ECHODIR} "===> ${DIRPRFX}${entry}"; \
|
||||
edir=${entry}; \
|
||||
cd ${.CURDIR}/$${edir}; \
|
||||
fi; \
|
||||
${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/
|
||||
.endfor
|
||||
par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
|
||||
${MAKE} ${MK_FLAGS} all install ${CLEANDIR} ${OBJDIR}
|
||||
.endfor
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -1,5 +1,5 @@
|
||||
This is the top level of the FreeBSD source directory. This file
|
||||
was last revised on: $Id: README,v 1.7.2.1 1997/08/13 19:49:35 jkh Exp $
|
||||
was last revised on: $Id: README,v 1.7 1997/01/01 14:06:29 jkh Exp $
|
||||
|
||||
For copyright information, please see the file COPYRIGHT in this
|
||||
directory (additional copyright information also exists for some
|
||||
@@ -10,14 +10,13 @@ The Makefile in this directory supports a number of targets for
|
||||
building components (or all) of the FreeBSD source tree, the most
|
||||
commonly used one being ``world'', which rebuilds and installs
|
||||
everything in the FreeBSD system from the source tree except the
|
||||
kernel and the contents of /etc. Please see the top of the Makefile
|
||||
in this directory for more information on the standard build targets
|
||||
and compile-time flags.
|
||||
kernel. Please see the top of the Makefile for more information on
|
||||
the standard build targets and compile-time flags.
|
||||
|
||||
Building a kernel with config(8) is a somewhat more involved process,
|
||||
Building a kernel with config(1) is a somewhat more involved process,
|
||||
documentation for which can be found at:
|
||||
http://www.freebsd.org/handbook/kernelconfig.html
|
||||
And in the config(8) man page.
|
||||
And in the config(1) man page.
|
||||
|
||||
The sample kernel configuration files reside in the sys/i386/conf
|
||||
sub-directory (assuming that you've installed the kernel sources), the
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# From: @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
# $Id: Makefile,v 1.4 1995/10/01 14:24:01 markm Exp $
|
||||
# $Id: Makefile,v 1.4.2.1 1997/03/07 09:39:06 joerg Exp $
|
||||
|
||||
SUBDIR= cat chio chmod cp csh date dd df domainname echo ed expr hostname \
|
||||
kill ln ls mkdir mv pax ps pwd rcp rm rmail rmdir sh sleep \
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile.inc 8.1 (Berkeley) 5/31/93
|
||||
# $Id$
|
||||
# $Id: Makefile.inc,v 1.7 1996/09/22 21:51:04 wosch Exp $
|
||||
|
||||
BINDIR?= /bin
|
||||
NOSHARED?= YES
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:53:25 davidg Exp $
|
||||
|
||||
PROG= cat
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)cat.1 8.3 (Berkeley) 5/2/95
|
||||
.\" $Id: cat.1,v 1.6 1997/02/22 14:01:26 peter Exp $
|
||||
.\" $Id: cat.1,v 1.3.2.1 1997/02/28 07:54:20 mpp Exp $
|
||||
.\"
|
||||
.Dd May 2, 1995
|
||||
.Dt CAT 1
|
||||
|
||||
+3
-3
@@ -37,13 +37,13 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const copyright[] =
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1989, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
|
||||
static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -78,7 +78,7 @@ main(argc, argv)
|
||||
|
||||
setlocale(LC_CTYPE, "");
|
||||
|
||||
while ((ch = getopt(argc, argv, "benstuv")) != -1)
|
||||
while ((ch = getopt(argc, argv, "benstuv")) != EOF)
|
||||
switch (ch) {
|
||||
case 'b':
|
||||
bflag = nflag = 1; /* -b implies -n */
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
|
||||
PROG= chio
|
||||
SRCS= chio.c
|
||||
BINOWN= root
|
||||
BINMODE=4555
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
+1
-2
@@ -124,7 +124,7 @@ specify whether the media units are to be inverted before insertion into
|
||||
.Pa <dst1 ET/EU>
|
||||
and
|
||||
.Pa <dst2 ET/EU>
|
||||
respectively.
|
||||
respecitively.
|
||||
.Pp
|
||||
Note that not all medium changers support the
|
||||
.Nm exchange
|
||||
@@ -194,7 +194,6 @@ Configures the changer to use picker 2 (third picker) for operations.
|
||||
/dev/ch0 - default changer device
|
||||
.Sh SEE ALSO
|
||||
.Xr mt 1 ,
|
||||
.Xr ch 4 ,
|
||||
.Xr mount 8 .
|
||||
.Sh AUTHOR
|
||||
The
|
||||
|
||||
+20
-24
@@ -1,4 +1,4 @@
|
||||
/* $Id: chio.c,v 1.1.1.1.2.2 1997/08/24 10:29:16 jkh Exp $ */
|
||||
/* $Id: chio.c,v 1.1.1.1 1997/03/06 15:30:06 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Jason R. Thorpe <[email protected]>
|
||||
@@ -47,6 +47,8 @@
|
||||
#include "defs.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
extern char *__progname; /* from crt0.o */
|
||||
|
||||
static void usage __P((void));
|
||||
static void cleanup __P((void));
|
||||
static int parse_element_type __P((char *));
|
||||
@@ -101,6 +103,7 @@ main(argc, argv)
|
||||
char **argv;
|
||||
{
|
||||
int ch, i;
|
||||
char *cp;
|
||||
|
||||
while ((ch = getopt(argc, argv, "f:")) != -1) {
|
||||
switch (ch) {
|
||||
@@ -206,8 +209,8 @@ do_move(cname, argc, argv)
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
fprintf(stderr, "usage: chio %s "
|
||||
"<from ET> <from EU> <to ET> <to EU> [inv]\n", cname);
|
||||
fprintf(stderr, "usage: %s %s "
|
||||
"<from ET> <from EU> <to ET> <to EU> [inv]\n", __progname, cname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -299,9 +302,9 @@ do_exchange(cname, argc, argv)
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
fprintf(stderr,
|
||||
"usage: chio %s <src ET> <src EU> <dst1 ET> <dst1 EU>\n"
|
||||
" [<dst2 ET> <dst2 EU>] [inv1] [inv2]\n", cname);
|
||||
fprintf(stderr, "usage: %s %s <src ET> <src EU> <dst1 ET> <dst1 EU>\n"
|
||||
" [<dst2 ET> <dst2 EU>] [inv1] [inv2]\n",
|
||||
__progname, cname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -360,7 +363,8 @@ do_position(cname, argc, argv)
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
fprintf(stderr, "usage: chio %s <to ET> <to EU> [inv]\n", cname);
|
||||
fprintf(stderr, "usage: %s %s <to ET> <to EU> [inv]\n",
|
||||
__progname, cname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -374,7 +378,7 @@ do_params(cname, argc, argv)
|
||||
|
||||
/* No arguments to this command. */
|
||||
if (argc) {
|
||||
warnx("%s: no arguments expected", cname);
|
||||
warnx("%s: no arguements expected", cname);
|
||||
goto usage;
|
||||
}
|
||||
|
||||
@@ -396,7 +400,7 @@ do_params(cname, argc, argv)
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
fprintf(stderr, "usage: chio %s\n", cname);
|
||||
fprintf(stderr, "usage: %s %s\n", __progname, cname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -423,7 +427,7 @@ do_getpicker(cname, argc, argv)
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
fprintf(stderr, "usage: chio %s\n", cname);
|
||||
fprintf(stderr, "usage: %s %s\n", __progname, cname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -452,7 +456,7 @@ do_setpicker(cname, argc, argv)
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
fprintf(stderr, "usage: chio %s <picker>\n", cname);
|
||||
fprintf(stderr, "usage: %s %s <picker>\n", __progname, cname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -466,10 +470,7 @@ do_status(cname, argc, argv)
|
||||
struct changer_params data;
|
||||
u_int8_t *statusp;
|
||||
int i, count, chet, schet, echet;
|
||||
char *description;
|
||||
|
||||
count = 0;
|
||||
description = NULL;
|
||||
char *cmdname, *description;
|
||||
|
||||
/*
|
||||
* On a status command, we expect the following:
|
||||
@@ -561,7 +562,8 @@ do_status(cname, argc, argv)
|
||||
return (0);
|
||||
|
||||
usage:
|
||||
fprintf(stderr, "usage: chio %s [<element type>]\n", cname);
|
||||
fprintf(stderr, "usage: %s %s [<element type>]\n", __progname,
|
||||
cname);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -635,8 +637,7 @@ bits_to_string(v, cp)
|
||||
np++;
|
||||
if ((v & (1 << (f - 1))) == 0)
|
||||
continue;
|
||||
bp += snprintf(bp, sizeof(buf) - (bp - &buf[0]),
|
||||
"%c%.*s", sep, np - cp, cp);
|
||||
bp += sprintf(bp, "%c%.*s", sep, np - cp, cp);
|
||||
sep = ',';
|
||||
}
|
||||
if (sep != '<')
|
||||
@@ -656,12 +657,7 @@ cleanup()
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(stderr, "usage: chio [-f changer] command [args ...]\n");
|
||||
fprintf(stderr, "commands:");
|
||||
for (i = 0; commands[i].cc_name; i++)
|
||||
fprintf(stderr, " %s", commands[i].cc_name);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "usage: %s command arg1 arg2 ...\n", __progname);
|
||||
exit(1);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/* $Id: $ */
|
||||
/* $Id: defs.h,v 1.1.1.1 1997/03/06 15:30:06 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Jason R. Thorpe <[email protected]>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: $ */
|
||||
/* $Id: pathnames.h,v 1.1.1.1 1997/03/06 15:30:06 joerg Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Jason R. Thorpe <[email protected]>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:53:36 davidg Exp $
|
||||
|
||||
PROG= chmod
|
||||
|
||||
|
||||
+1
-5
@@ -110,14 +110,10 @@ the following values:
|
||||
.Bl -tag -width 6n -compact -offset indent
|
||||
.It Li 4000
|
||||
set-user-ID-on-execution
|
||||
( see
|
||||
.Xr chmod 2
|
||||
for directories )
|
||||
.It Li 2000
|
||||
set-group-ID-on-execution
|
||||
.It Li 1000
|
||||
sticky bit, see
|
||||
.Xr chmod 2
|
||||
sticky bit, see chmod(2)
|
||||
.It Li 0400
|
||||
read by owner
|
||||
.It Li 0200
|
||||
|
||||
+4
-4
@@ -30,17 +30,17 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: chmod.c,v 1.5.2.1 1997/08/24 10:30:25 jkh Exp $
|
||||
* $Id: chmod.c,v 1.5 1996/08/10 15:05:26 adam Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const copyright[] =
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1989, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94";
|
||||
static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -73,7 +73,7 @@ main(argc, argv)
|
||||
set = NULL;
|
||||
omode = 0;
|
||||
Hflag = Lflag = Pflag = Rflag = fflag = hflag = 0;
|
||||
while ((ch = getopt(argc, argv, "HLPRXfgorstuwx")) != -1)
|
||||
while ((ch = getopt(argc, argv, "HLPRXfgorstuwx")) != EOF)
|
||||
switch (ch) {
|
||||
case 'H':
|
||||
Hflag = 1;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:53:39 davidg Exp $
|
||||
|
||||
PROG= cp
|
||||
SRCS= cp.c utils.c
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)cp.1 8.3 (Berkeley) 4/18/94
|
||||
.\" $Id: cp.1,v 1.9 1997/02/22 14:01:32 peter Exp $
|
||||
.\" $Id: cp.1,v 1.6.2.1 1997/02/28 07:54:27 mpp Exp $
|
||||
.\"
|
||||
.Dd April 18, 1994
|
||||
.Dt CP 1
|
||||
|
||||
+5
-12
@@ -37,13 +37,13 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const copyright[] =
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1988, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94";
|
||||
static char sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@@ -51,7 +51,7 @@ static char const sccsid[] = "@(#)cp.c 8.2 (Berkeley) 4/1/94";
|
||||
*
|
||||
* The global PATH_T structure "to" always contains the path to the
|
||||
* current target file. Since fts(3) does not change directories,
|
||||
* this path can be either absolute or dot-relative.
|
||||
* this path can be either absolute or dot-realative.
|
||||
*
|
||||
* The basic algorithm is to initialize "to" and use fts(3) to traverse
|
||||
* the file hierarchy rooted in the argument list. A trivial case is the
|
||||
@@ -105,7 +105,7 @@ main(argc, argv)
|
||||
char *target;
|
||||
|
||||
Hflag = Lflag = Pflag = 0;
|
||||
while ((ch = getopt(argc, argv, "HLPRfipr")) != -1)
|
||||
while ((ch = getopt(argc, argv, "HLPRfipr")) != EOF)
|
||||
switch (ch) {
|
||||
case 'H':
|
||||
Hflag = 1;
|
||||
@@ -253,7 +253,7 @@ copy(argv, type, fts_options)
|
||||
struct stat to_stat;
|
||||
FTS *ftsp;
|
||||
FTSENT *curr;
|
||||
int base = 0, dne, nlen, rval;
|
||||
int base, dne, nlen, rval;
|
||||
char *p, *target_mid;
|
||||
|
||||
if ((ftsp = fts_open(argv, fts_options, mastercmp)) == NULL)
|
||||
@@ -341,13 +341,6 @@ copy(argv, type, fts_options)
|
||||
(void)fts_set(ftsp, curr, FTS_SKIP);
|
||||
continue;
|
||||
}
|
||||
if (!S_ISDIR(curr->fts_statp->st_mode) &&
|
||||
S_ISDIR(to_stat.st_mode)) {
|
||||
warnx("cannot overwrite directory %s with non-directory %s",
|
||||
to.p_path, curr->fts_path);
|
||||
rval = 1;
|
||||
continue;
|
||||
}
|
||||
dne = 0;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)extern.h 8.2 (Berkeley) 4/1/94
|
||||
* $Id: extern.h,v 1.3 1996/02/18 18:48:26 wosch Exp $
|
||||
* $Id: extern.h,v 1.5 1996/03/08 06:58:07 wosch Exp $
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
|
||||
+8
-23
@@ -30,11 +30,11 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: utils.c,v 1.9.2.1 1997/08/24 10:34:49 jkh Exp $
|
||||
* $Id: utils.c,v 1.9 1996/03/08 06:58:08 wosch Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94";
|
||||
static char sccsid[] = "@(#)utils.c 8.3 (Berkeley) 4/1/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -60,8 +60,7 @@ copy_file(entp, dne)
|
||||
{
|
||||
static char buf[MAXBSIZE];
|
||||
struct stat to_stat, *fs;
|
||||
int ch, checkch, from_fd, rcount, rval, to_fd, wcount, wresid;
|
||||
char *bufp;
|
||||
int ch, checkch, from_fd, rcount, rval, to_fd, wcount;
|
||||
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
|
||||
char *p;
|
||||
#endif
|
||||
@@ -82,16 +81,13 @@ copy_file(entp, dne)
|
||||
* modified by the umask.)
|
||||
*/
|
||||
if (!dne) {
|
||||
#define YESNO "(y/n [n]) "
|
||||
if (iflag) {
|
||||
(void)fprintf(stderr, "overwrite %s? %s",
|
||||
to.p_path, YESNO);
|
||||
(void)fprintf(stderr, "overwrite %s? ", to.p_path);
|
||||
checkch = ch = getchar();
|
||||
while (ch != '\n' && ch != EOF)
|
||||
ch = getchar();
|
||||
if (checkch != 'y' && checkch != 'Y') {
|
||||
(void)close(from_fd);
|
||||
(void)fprintf(stderr, "not overwritten\n");
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@@ -125,17 +121,11 @@ copy_file(entp, dne)
|
||||
#ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED
|
||||
if (fs->st_size <= 8 * 1048576) {
|
||||
if ((p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
|
||||
MAP_SHARED, from_fd, (off_t)0)) == MAP_FAILED) {
|
||||
0, from_fd, (off_t)0)) == (char *)-1) {
|
||||
warn("%s", entp->fts_path);
|
||||
rval = 1;
|
||||
} else {
|
||||
for (bufp = p, wresid = fs->st_size; ;
|
||||
bufp += wcount, wresid -= wcount) {
|
||||
wcount = write(to_fd, bufp, wresid);
|
||||
if (wcount >= wresid || wcount <= 0)
|
||||
break;
|
||||
}
|
||||
if (wcount != wresid) {
|
||||
if (write(to_fd, p, fs->st_size) != fs->st_size) {
|
||||
warn("%s", to.p_path);
|
||||
rval = 1;
|
||||
}
|
||||
@@ -149,13 +139,8 @@ copy_file(entp, dne)
|
||||
#endif
|
||||
{
|
||||
while ((rcount = read(from_fd, buf, MAXBSIZE)) > 0) {
|
||||
for (bufp = buf, wresid = rcount; ;
|
||||
bufp += wcount, wresid -= wcount) {
|
||||
wcount = write(to_fd, bufp, wresid);
|
||||
if (wcount >= wresid || wcount <= 0)
|
||||
break;
|
||||
}
|
||||
if (wcount != wresid) {
|
||||
wcount = write(to_fd, buf, rcount);
|
||||
if (rcount != wcount || wcount == -1) {
|
||||
warn("%s", to.p_path);
|
||||
rval = 1;
|
||||
break;
|
||||
|
||||
+14
-14
@@ -11,7 +11,7 @@ DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
|
||||
CFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
|
||||
SRCS= alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
|
||||
func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
|
||||
sem.c set.c str.c time.c const.h errnum.h
|
||||
sem.c set.c str.c time.c const.h err.h
|
||||
.PATH: ${.CURDIR}/../../usr.bin/printf
|
||||
|
||||
MAN1= csh.1
|
||||
@@ -19,23 +19,23 @@ MLINKS= csh.1 limit.1 csh.1 alias.1 csh.1 bg.1 csh.1 dirs.1 csh.1 fg.1 \
|
||||
csh.1 foreach.1 csh.1 history.1 csh.1 jobs.1 csh.1 popd.1 \
|
||||
csh.1 pushd.1 csh.1 rehash.1 csh.1 repeat.1 csh.1 suspend.1 \
|
||||
csh.1 stop.1 csh.1 source.1
|
||||
CLEANFILES+=const.h errnum.h
|
||||
CLEANFILES+=err.h const.h
|
||||
|
||||
const.h: errnum.h
|
||||
const.h: err.h
|
||||
|
||||
errnum.h: err.c
|
||||
@rm -f ${.TARGET}
|
||||
@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
|
||||
@echo '#ifndef _h_sh_error' >> ${.TARGET}
|
||||
@echo '#define _h_sh_error' >> ${.TARGET}
|
||||
egrep 'ERR_' ${.ALLSRC} | egrep '^#define' >> ${.TARGET}
|
||||
@echo '#endif /* _h_sh_error */' >> ${.TARGET}
|
||||
err.h: err.c
|
||||
@rm -f $@
|
||||
@echo '/* Do not edit this file, make creates it. */' > $@
|
||||
@echo '#ifndef _h_sh_err' >> $@
|
||||
@echo '#define _h_sh_err' >> $@
|
||||
egrep 'ERR_' ${.CURDIR}/$*.c | egrep '^#define' >> $@
|
||||
@echo '#endif /* _h_sh_err */' >> $@
|
||||
|
||||
const.h: const.c
|
||||
@rm -f ${.TARGET}
|
||||
@echo '/* Do not edit this file, make creates it. */' > ${.TARGET}
|
||||
${CC} -E ${CFLAGS} ${.ALLSRC} | egrep 'Char STR' | \
|
||||
@rm -f $@
|
||||
@echo '/* Do not edit this file, make creates it. */' > $@
|
||||
${CC} -E ${CFLAGS} ${.CURDIR}/$*.c | egrep 'Char STR' | \
|
||||
sed -e 's/Char \([a-zA-Z0-9_]*\)\(.*\)/extern Char \1[];/' | \
|
||||
sort >> ${.TARGET}
|
||||
sort >> $@
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 8/14/93
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:54:22 davidg Exp $
|
||||
|
||||
DIR= usd/04.csh
|
||||
SRCS= tabs csh.1 csh.2 csh.3 csh.4 csh.a csh.g
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)csh.1 8.1 (Berkeley) 6/8/93
|
||||
.\" $Id: csh.1,v 1.2 1994/09/24 02:54:23 davidg Exp $
|
||||
.\" $Id: csh.1,v 1.3 1996/10/05 22:25:45 wosch Exp $
|
||||
.\"
|
||||
.EH 'USD:4-%''An Introduction to the C shell'
|
||||
.OH 'An Introduction to the C shell''USD:4-%'
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)csh.2 8.1 (Berkeley) 6/8/93
|
||||
.\" $Id: csh.2,v 1.2 1994/09/24 02:54:24 davidg Exp $
|
||||
.\" $Id: csh.2,v 1.3 1996/10/05 22:25:46 wosch Exp $
|
||||
.\"
|
||||
.nr H1 1
|
||||
.NH
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)csh.3 8.1 (Berkeley) 6/8/93
|
||||
.\" $Id$
|
||||
.\" $Id: csh.3,v 1.2 1994/09/24 02:54:26 davidg Exp $
|
||||
.\"
|
||||
.nr H1 2
|
||||
.NH
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)csh.4 8.1 (Berkeley) 6/8/93
|
||||
.\" $Id$
|
||||
.\" $Id: csh.4,v 1.2 1994/09/24 02:54:27 davidg Exp $
|
||||
.\"
|
||||
.nr H1 3
|
||||
.NH
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)csh.a 8.1 (Berkeley) 6/8/93
|
||||
.\" $Id$
|
||||
.\" $Id: csh.a,v 1.2 1994/09/24 02:54:28 davidg Exp $
|
||||
.\"
|
||||
.SH
|
||||
Appendix \- Special characters
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)csh.g 8.1 (Berkeley) 6/8/93
|
||||
.\" $Id$
|
||||
.\" $Id: csh.g,v 1.2 1994/09/24 02:54:31 davidg Exp $
|
||||
.\"
|
||||
.SH
|
||||
Glossary
|
||||
|
||||
@@ -30,6 +30,6 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)tabs 8.1 (Berkeley) 6/8/93
|
||||
.\" $Id$
|
||||
.\" $Id: tabs,v 1.2 1994/09/24 02:54:32 davidg Exp $
|
||||
.\"
|
||||
.ta 5n 10n 15n 20n 25n 30n 35n 40n 45n 50n 55n 60n 65n 70n 75n 80n
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: alloc.c,v 1.3 1995/03/19 13:28:10 joerg Exp $
|
||||
* $Id: alloc.c,v 1.4 1995/05/30 00:06:28 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: char.c,v 1.2 1994/09/24 02:53:46 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)char.h 8.1 (Berkeley) 5/31/93
|
||||
* $Id$
|
||||
* $Id: char.h,v 1.2 1994/09/24 02:53:47 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: const.c,v 1.3 1995/05/30 00:06:29 rgrimes Exp $
|
||||
* $Id: const.c,v 1.4 1995/10/23 23:08:24 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)csh.1 8.2 (Berkeley) 1/21/94
|
||||
.\" $Id: csh.1,v 1.8 1997/02/22 14:01:40 peter Exp $
|
||||
.\" $Id: csh.1,v 1.5.2.1 1997/02/28 07:54:29 mpp Exp $
|
||||
.\"
|
||||
.Dd January 21, 1994
|
||||
.Dt CSH 1
|
||||
|
||||
+20
-21
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: csh.c,v 1.6.2.1 1997/08/24 21:41:29 jkh Exp $
|
||||
* $Id: csh.c,v 1.6 1995/10/23 23:08:25 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -46,7 +46,6 @@ static char sccsid[] = "@(#)csh.c 8.2 (Berkeley) 10/12/93";
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <pwd.h>
|
||||
@@ -115,10 +114,10 @@ main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
Char *cp;
|
||||
char *tcp;
|
||||
int f;
|
||||
char **tempv;
|
||||
register Char *cp;
|
||||
register char *tcp;
|
||||
register int f;
|
||||
register char **tempv;
|
||||
struct sigvec osv;
|
||||
|
||||
cshin = stdin;
|
||||
@@ -230,7 +229,7 @@ main(argc, argv)
|
||||
*/
|
||||
set(STRstatus, Strsave(STR0));
|
||||
|
||||
if ((tcp = getenv("HOME")) != NULL && strlen(tcp) < MAXPATHLEN)
|
||||
if ((tcp = getenv("HOME")) != NULL)
|
||||
cp = SAVE(tcp);
|
||||
else
|
||||
cp = NULL;
|
||||
@@ -604,9 +603,9 @@ void
|
||||
importpath(cp)
|
||||
Char *cp;
|
||||
{
|
||||
int i = 0;
|
||||
Char *dp;
|
||||
Char **pv;
|
||||
register int i = 0;
|
||||
register Char *dp;
|
||||
register Char **pv;
|
||||
int c;
|
||||
|
||||
for (dp = cp; *dp; dp++)
|
||||
@@ -624,7 +623,7 @@ importpath(cp)
|
||||
if ((c = *dp) == ':' || c == 0) {
|
||||
*dp = 0;
|
||||
if (*cp != '/' && (euid == 0 || uid == 0) &&
|
||||
(intact || (intty && isatty(SHOUT))))
|
||||
(intact || intty && isatty(SHOUT)))
|
||||
(void) fprintf(csherr,
|
||||
"Warning: imported path contains relative components\n");
|
||||
pv[i++] = Strsave(*cp ? cp : STRdot);
|
||||
@@ -648,7 +647,7 @@ static int
|
||||
srccat(cp, dp)
|
||||
Char *cp, *dp;
|
||||
{
|
||||
Char *ep = Strspl(cp, dp);
|
||||
register Char *ep = Strspl(cp, dp);
|
||||
char *ptr = short2str(ep);
|
||||
|
||||
xfree((ptr_t) ep);
|
||||
@@ -663,7 +662,7 @@ srcfile(f, onlyown, flag)
|
||||
char *f;
|
||||
bool onlyown, flag;
|
||||
{
|
||||
int unit;
|
||||
register int unit;
|
||||
|
||||
if ((unit = open(f, O_RDONLY)) == -1)
|
||||
return 0;
|
||||
@@ -681,7 +680,7 @@ srcfile(f, onlyown, flag)
|
||||
int insource;
|
||||
static void
|
||||
srcunit(unit, onlyown, hflg)
|
||||
int unit;
|
||||
register int unit;
|
||||
bool onlyown, hflg;
|
||||
{
|
||||
/* We have to push down a lot of state here */
|
||||
@@ -732,7 +731,7 @@ srcunit(unit, onlyown, hflg)
|
||||
if (setintr)
|
||||
omask = sigblock(sigmask(SIGINT));
|
||||
/* Setup the new values of the state stuff saved above */
|
||||
memmove((char *) &(saveB), (char *) &B, sizeof(B));
|
||||
bcopy((char *) &B, (char *) &(saveB), sizeof(B));
|
||||
fbuf = NULL;
|
||||
fseekp = feobp = fblocks = 0;
|
||||
oSHIN = SHIN, SHIN = unit, arginp = 0, onelflg = 0;
|
||||
@@ -757,7 +756,7 @@ srcunit(unit, onlyown, hflg)
|
||||
if (setintr)
|
||||
(void) sigsetmask(omask);
|
||||
if (oSHIN >= 0) {
|
||||
int i;
|
||||
register int i;
|
||||
|
||||
/* We made it to the new state... free up its storage */
|
||||
/* This code could get run twice but xfree doesn't care */
|
||||
@@ -766,7 +765,7 @@ srcunit(unit, onlyown, hflg)
|
||||
xfree((ptr_t) fbuf);
|
||||
|
||||
/* Reset input arena */
|
||||
memmove((char *) &B, (char *) &(saveB), sizeof(B));
|
||||
bcopy((char *) &(saveB), (char *) &B, sizeof(B));
|
||||
|
||||
(void) close(SHIN), SHIN = oSHIN;
|
||||
arginp = oarginp, onelflg = oonelflg;
|
||||
@@ -1121,7 +1120,7 @@ dosource(v, t)
|
||||
struct command *t;
|
||||
|
||||
{
|
||||
Char *f;
|
||||
register Char *f;
|
||||
bool hflg = 0;
|
||||
Char buf[BUFSIZ];
|
||||
|
||||
@@ -1151,8 +1150,8 @@ dosource(v, t)
|
||||
static void
|
||||
mailchk()
|
||||
{
|
||||
struct varent *v;
|
||||
Char **vp;
|
||||
register struct varent *v;
|
||||
register Char **vp;
|
||||
time_t t;
|
||||
int intvl, cnt;
|
||||
struct stat stb;
|
||||
@@ -1339,7 +1338,7 @@ defaultpath()
|
||||
void
|
||||
printprompt()
|
||||
{
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
|
||||
if (!whyles) {
|
||||
for (cp = value(STRprompt); *cp; cp++)
|
||||
|
||||
+5
-3
@@ -84,7 +84,7 @@ typedef void *ptr_t;
|
||||
|
||||
#include "const.h"
|
||||
#include "char.h"
|
||||
#include "errnum.h"
|
||||
#include "err.h"
|
||||
|
||||
#define xmalloc(i) Malloc(i)
|
||||
#define xrealloc(p, i) Realloc(p, i)
|
||||
@@ -187,8 +187,8 @@ jmp_buf reslab;
|
||||
#define setexit() (setjmp(reslab))
|
||||
#define reset() longjmp(reslab, 1)
|
||||
/* Should use structure assignment here */
|
||||
#define getexit(a) memmove((char *)(a), (char *)reslab, sizeof reslab)
|
||||
#define resexit(a) memmove((char *)reslab, (char *)(a), sizeof reslab)
|
||||
#define getexit(a) bcopy((char *)reslab, ((char *)(a)), sizeof reslab)
|
||||
#define resexit(a) bcopy((char *)(a), (char *)reslab, sizeof reslab)
|
||||
|
||||
Char *gointr; /* Label for an onintr transfer */
|
||||
|
||||
@@ -421,6 +421,8 @@ struct varent {
|
||||
#define v_right v_link[1]
|
||||
#define v_parent v_link[2]
|
||||
|
||||
struct varent *adrof1();
|
||||
|
||||
#define adrof(v) adrof1(v, &shvhed)
|
||||
#define value(v) value1(v, &shvhed)
|
||||
|
||||
|
||||
+24
-24
@@ -75,9 +75,9 @@ void
|
||||
dinit(hp)
|
||||
Char *hp;
|
||||
{
|
||||
char *tcp;
|
||||
Char *cp;
|
||||
struct directory *dp;
|
||||
register char *tcp;
|
||||
register Char *cp;
|
||||
register struct directory *dp;
|
||||
char path[MAXPATHLEN];
|
||||
static char *emsg = "csh: Trying to start from \"%s\"\n";
|
||||
|
||||
@@ -145,7 +145,7 @@ Char *dp;
|
||||
* Don't call set() directly cause if the directory contains ` or
|
||||
* other junk characters glob will fail.
|
||||
*/
|
||||
Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||
register Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||
|
||||
vec[0] = Strsave(dp);
|
||||
vec[1] = 0;
|
||||
@@ -203,7 +203,7 @@ dodirs(v, t)
|
||||
static void
|
||||
printdirs()
|
||||
{
|
||||
struct directory *dp;
|
||||
register struct directory *dp;
|
||||
Char *s, *hp = value(STRhome);
|
||||
int idx, len, cur;
|
||||
|
||||
@@ -240,7 +240,7 @@ printdirs()
|
||||
|
||||
void
|
||||
dtildepr(home, dir)
|
||||
Char *home, *dir;
|
||||
register Char *home, *dir;
|
||||
{
|
||||
|
||||
if (!eq(home, STRslash) && prefix(home, dir))
|
||||
@@ -340,8 +340,8 @@ dochngd(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *cp;
|
||||
struct directory *dp;
|
||||
register Char *cp;
|
||||
register struct directory *dp;
|
||||
|
||||
skipargs(&v, " [<dir>]");
|
||||
printd = 0;
|
||||
@@ -389,7 +389,7 @@ dgoto(cp)
|
||||
Char *dp;
|
||||
|
||||
if (*cp != '/') {
|
||||
Char *p, *q;
|
||||
register Char *p, *q;
|
||||
int cwdlen;
|
||||
|
||||
for (p = dcwd->di_name; *p++;)
|
||||
@@ -423,9 +423,9 @@ dgoto(cp)
|
||||
*/
|
||||
static Char *
|
||||
dfollow(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
Char *dp;
|
||||
register Char *dp;
|
||||
struct varent *c;
|
||||
char ebuf[MAXPATHLEN];
|
||||
int serrno;
|
||||
@@ -449,7 +449,7 @@ dfollow(cp)
|
||||
if (cp[0] != '/' && !prefix(STRdotsl, cp) && !prefix(STRdotdotsl, cp)
|
||||
&& (c = adrof(STRcdpath))) {
|
||||
Char **cdp;
|
||||
Char *p;
|
||||
register Char *p;
|
||||
Char buf[MAXPATHLEN];
|
||||
|
||||
for (cdp = c->vec; *cdp; cdp++) {
|
||||
@@ -491,7 +491,7 @@ dopushd(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct directory *dp;
|
||||
register struct directory *dp;
|
||||
|
||||
skipargs(&v, " [<dir>|+<n>]");
|
||||
printd = 1;
|
||||
@@ -523,7 +523,7 @@ dopushd(v, t)
|
||||
stderror(ERR_SYSTEM, tmp, strerror(errno));
|
||||
}
|
||||
else {
|
||||
Char *ccp;
|
||||
register Char *ccp;
|
||||
|
||||
ccp = dfollow(*v);
|
||||
dp = (struct directory *) xcalloc(sizeof(struct directory), 1);
|
||||
@@ -542,11 +542,11 @@ dopushd(v, t)
|
||||
*/
|
||||
static struct directory *
|
||||
dfind(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
struct directory *dp;
|
||||
int i;
|
||||
Char *ep;
|
||||
register struct directory *dp;
|
||||
register int i;
|
||||
register Char *ep;
|
||||
|
||||
if (*cp++ != '+')
|
||||
return (0);
|
||||
@@ -576,7 +576,7 @@ dopopd(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct directory *dp, *p = NULL;
|
||||
register struct directory *dp, *p = NULL;
|
||||
|
||||
skipargs(&v, " [+<n>]");
|
||||
printd = 1;
|
||||
@@ -614,7 +614,7 @@ dopopd(v, t)
|
||||
*/
|
||||
void
|
||||
dfree(dp)
|
||||
struct directory *dp;
|
||||
register struct directory *dp;
|
||||
{
|
||||
|
||||
if (dp->di_count != 0) {
|
||||
@@ -633,10 +633,10 @@ dfree(dp)
|
||||
*/
|
||||
Char *
|
||||
dcanon(cp, p)
|
||||
Char *cp, *p;
|
||||
register Char *cp, *p;
|
||||
{
|
||||
Char *sp;
|
||||
Char *p1, *p2; /* general purpose */
|
||||
register Char *sp;
|
||||
register Char *p1, *p2; /* general purpose */
|
||||
bool slash;
|
||||
|
||||
Char link[MAXPATHLEN];
|
||||
@@ -923,7 +923,7 @@ dcanon(cp, p)
|
||||
*/
|
||||
static void
|
||||
dnewcwd(dp)
|
||||
struct directory *dp;
|
||||
register struct directory *dp;
|
||||
{
|
||||
dcwd = dp;
|
||||
dset(dcwd->di_name);
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)dir.h 8.1 (Berkeley) 5/31/93
|
||||
* $Id$
|
||||
* $Id: dir.h,v 1.2 1994/09/24 02:53:55 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
+22
-22
@@ -105,10 +105,10 @@ static void Dtestq __P((int));
|
||||
*/
|
||||
void
|
||||
Dfix(t)
|
||||
struct command *t;
|
||||
register struct command *t;
|
||||
{
|
||||
Char **pp;
|
||||
Char *p;
|
||||
register Char **pp;
|
||||
register Char *p;
|
||||
|
||||
if (noexec)
|
||||
return;
|
||||
@@ -130,7 +130,7 @@ Dfix(t)
|
||||
*/
|
||||
Char *
|
||||
Dfix1(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
Char *Dv[2];
|
||||
|
||||
@@ -173,8 +173,8 @@ static Char *
|
||||
Dpack(wbuf, wp)
|
||||
Char *wbuf, *wp;
|
||||
{
|
||||
int c;
|
||||
int i = MAXWLEN - (wp - wbuf);
|
||||
register int c;
|
||||
register int i = MAXWLEN - (wp - wbuf);
|
||||
|
||||
for (;;) {
|
||||
c = DgetC(DODOL);
|
||||
@@ -220,11 +220,11 @@ Dpack(wbuf, wp)
|
||||
static int
|
||||
Dword()
|
||||
{
|
||||
int c, c1;
|
||||
register int c, c1;
|
||||
Char wbuf[BUFSIZ];
|
||||
Char *wp = wbuf;
|
||||
int i = MAXWLEN;
|
||||
bool dolflg;
|
||||
register Char *wp = wbuf;
|
||||
register int i = MAXWLEN;
|
||||
register bool dolflg;
|
||||
bool sofar = 0, done = 0;
|
||||
|
||||
while (!done) {
|
||||
@@ -340,9 +340,9 @@ Dword()
|
||||
*/
|
||||
static int
|
||||
DgetC(flag)
|
||||
int flag;
|
||||
register int flag;
|
||||
{
|
||||
int c;
|
||||
register int c;
|
||||
|
||||
top:
|
||||
if ((c = Dpeekc) != '\0') {
|
||||
@@ -401,8 +401,8 @@ dolerror(s)
|
||||
static void
|
||||
Dgetdol()
|
||||
{
|
||||
Char *np;
|
||||
struct varent *vp = NULL;
|
||||
register Char *np;
|
||||
register struct varent *vp = NULL;
|
||||
Char name[4 * MAXVARLEN + 1];
|
||||
int c, sc;
|
||||
int subscr = 0, lwb = 1, upb = 0;
|
||||
@@ -574,7 +574,7 @@ Dgetdol()
|
||||
else if (*np != '-')
|
||||
stderror(ERR_MISSING, '-');
|
||||
else {
|
||||
int i = upb;
|
||||
register int i = upb;
|
||||
|
||||
np++;
|
||||
if (Isdigit(*np)) {
|
||||
@@ -632,7 +632,7 @@ eatbrac:
|
||||
static void
|
||||
fixDolMod()
|
||||
{
|
||||
int c;
|
||||
register int c;
|
||||
|
||||
c = DgetC(0);
|
||||
if (c == ':') {
|
||||
@@ -691,9 +691,9 @@ fixDolMod()
|
||||
|
||||
static void
|
||||
setDolp(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
Char *dp;
|
||||
register Char *dp;
|
||||
int i;
|
||||
|
||||
if (dolnmod == 0 || dolmcnt == 0) {
|
||||
@@ -804,7 +804,7 @@ unDredc(c)
|
||||
static int
|
||||
Dredc()
|
||||
{
|
||||
int c;
|
||||
register int c;
|
||||
|
||||
if ((c = Dpeekrd) != '\0') {
|
||||
Dpeekrd = 0;
|
||||
@@ -822,7 +822,7 @@ Dredc()
|
||||
|
||||
static void
|
||||
Dtestq(c)
|
||||
int c;
|
||||
register int c;
|
||||
{
|
||||
|
||||
if (cmap(c, QUOTES))
|
||||
@@ -839,11 +839,11 @@ void
|
||||
heredoc(term)
|
||||
Char *term;
|
||||
{
|
||||
int c;
|
||||
register int c;
|
||||
Char *Dv[2];
|
||||
Char obuf[BUFSIZ], lbuf[BUFSIZ], mbuf[BUFSIZ];
|
||||
int ocnt, lcnt, mcnt;
|
||||
Char *lbp, *obp, *mbp;
|
||||
register Char *lbp, *obp, *mbp;
|
||||
Char **vp;
|
||||
bool quoted;
|
||||
char *tmp;
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: err.c,v 1.2.8.1 1997/08/24 21:41:31 jkh Exp $
|
||||
* $Id: err.c,v 1.2 1994/09/24 02:53:57 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -307,7 +307,7 @@ seterror(id, va_alist)
|
||||
#endif
|
||||
if (id < 0 || id > sizeof(errorlist) / sizeof(errorlist[0]))
|
||||
id = ERR_INVALID;
|
||||
vsnprintf(berr, sizeof(berr), errorlist[id], va);
|
||||
vsprintf(berr, errorlist[id], va);
|
||||
va_end(va);
|
||||
|
||||
seterr = strsave(berr);
|
||||
@@ -342,7 +342,7 @@ stderror(id, va_alist)
|
||||
#endif
|
||||
{
|
||||
va_list va;
|
||||
Char **v;
|
||||
register Char **v;
|
||||
int flags = id & ERR_FLAGS;
|
||||
|
||||
id &= ~ERR_FLAGS;
|
||||
|
||||
+25
-25
@@ -113,10 +113,10 @@ doexec(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *dp, **pv, **av, *sav;
|
||||
struct varent *pathv;
|
||||
bool slash;
|
||||
int hashval = 0, hashval1, i;
|
||||
register Char *dp, **pv, **av, *sav;
|
||||
register struct varent *pathv;
|
||||
register bool slash;
|
||||
register int hashval = 0, hashval1, i;
|
||||
Char *blk[2];
|
||||
|
||||
/*
|
||||
@@ -265,12 +265,12 @@ pexerr()
|
||||
static void
|
||||
texec(sf, st)
|
||||
Char *sf;
|
||||
Char **st;
|
||||
register Char **st;
|
||||
{
|
||||
char **t;
|
||||
char *f;
|
||||
struct varent *v;
|
||||
Char **vp;
|
||||
register char **t;
|
||||
register char *f;
|
||||
register struct varent *v;
|
||||
register Char **vp;
|
||||
Char *lastsh[2];
|
||||
int fd;
|
||||
unsigned char c;
|
||||
@@ -361,7 +361,7 @@ texec(sf, st)
|
||||
void
|
||||
execash(t, kp)
|
||||
Char **t;
|
||||
struct command *kp;
|
||||
register struct command *kp;
|
||||
{
|
||||
int saveIN, saveOUT, saveDIAG, saveSTD;
|
||||
int oSHIN;
|
||||
@@ -446,8 +446,8 @@ dohash(v, t)
|
||||
struct command *t;
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
int cnt;
|
||||
register struct dirent *dp;
|
||||
register int cnt;
|
||||
int i = 0;
|
||||
struct varent *pathv = adrof(STRpath);
|
||||
Char **pv;
|
||||
@@ -504,9 +504,9 @@ hashstat(v, t)
|
||||
*/
|
||||
static int
|
||||
hashname(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
long h = 0;
|
||||
register long h = 0;
|
||||
|
||||
while (*cp)
|
||||
h = hash(h, *cp++);
|
||||
@@ -517,11 +517,11 @@ static int
|
||||
iscommand(name)
|
||||
Char *name;
|
||||
{
|
||||
Char **pv;
|
||||
Char *sav;
|
||||
struct varent *v;
|
||||
bool slash = any(short2str(name), '/');
|
||||
int hashval = 0, hashval1, i;
|
||||
register Char **pv;
|
||||
register Char *sav;
|
||||
register struct varent *v;
|
||||
register bool slash = any(short2str(name), '/');
|
||||
register int hashval = 0, hashval1, i;
|
||||
|
||||
v = adrof(STRpath);
|
||||
if (v == 0 || v->vec[0] == 0 || slash)
|
||||
@@ -618,7 +618,7 @@ executable(dir, name, dir_ok)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
dowhich(v, c)
|
||||
Char **v;
|
||||
register Char **v;
|
||||
struct command *c;
|
||||
{
|
||||
struct wordent lex[3];
|
||||
@@ -652,9 +652,9 @@ static void
|
||||
tellmewhat(lex)
|
||||
struct wordent *lex;
|
||||
{
|
||||
int i;
|
||||
struct biltins *bptr;
|
||||
struct wordent *sp = lex->next;
|
||||
register int i;
|
||||
register struct biltins *bptr;
|
||||
register struct wordent *sp = lex->next;
|
||||
bool aliased = 0;
|
||||
Char *s0, *s1, *s2, *cmd;
|
||||
Char qc;
|
||||
@@ -706,8 +706,8 @@ tellmewhat(lex)
|
||||
sp->word = cmd = globone(sp->word, G_IGNORE);
|
||||
|
||||
if ((i = iscommand(strip(sp->word))) != 0) {
|
||||
Char **pv;
|
||||
struct varent *v;
|
||||
register Char **pv;
|
||||
register struct varent *v;
|
||||
bool slash = any(short2str(sp->word), '/');
|
||||
|
||||
v = adrof(STRpath);
|
||||
|
||||
+44
-44
@@ -91,23 +91,23 @@ static void etraci __P((char *, int, Char ***));
|
||||
|
||||
int
|
||||
expr(vp)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
{
|
||||
return (exp0(vp, 0));
|
||||
}
|
||||
|
||||
int
|
||||
exp0(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
int p1 = exp1(vp, ignore);
|
||||
register int p1 = exp1(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp0 p1", p1, vp);
|
||||
#endif
|
||||
if (**vp && eq(**vp, STRor2)) {
|
||||
int p2;
|
||||
register int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp0(vp, (ignore & IGNORE) || p1);
|
||||
@@ -121,16 +121,16 @@ exp0(vp, ignore)
|
||||
|
||||
static int
|
||||
exp1(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
int p1 = exp2(vp, ignore);
|
||||
register int p1 = exp2(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp1 p1", p1, vp);
|
||||
#endif
|
||||
if (**vp && eq(**vp, STRand2)) {
|
||||
int p2;
|
||||
register int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp1(vp, (ignore & IGNORE) || !p1);
|
||||
@@ -144,16 +144,16 @@ exp1(vp, ignore)
|
||||
|
||||
static int
|
||||
exp2(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
int p1 = exp2a(vp, ignore);
|
||||
register int p1 = exp2a(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp3 p1", p1, vp);
|
||||
#endif
|
||||
if (**vp && eq(**vp, STRor)) {
|
||||
int p2;
|
||||
register int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp2(vp, ignore);
|
||||
@@ -167,16 +167,16 @@ exp2(vp, ignore)
|
||||
|
||||
static int
|
||||
exp2a(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
int p1 = exp2b(vp, ignore);
|
||||
register int p1 = exp2b(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp2a p1", p1, vp);
|
||||
#endif
|
||||
if (**vp && eq(**vp, STRcaret)) {
|
||||
int p2;
|
||||
register int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp2a(vp, ignore);
|
||||
@@ -190,16 +190,16 @@ exp2a(vp, ignore)
|
||||
|
||||
static int
|
||||
exp2b(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
int p1 = exp2c(vp, ignore);
|
||||
register int p1 = exp2c(vp, ignore);
|
||||
|
||||
#ifdef EDEBUG
|
||||
etraci("exp2b p1", p1, vp);
|
||||
#endif
|
||||
if (**vp && eq(**vp, STRand)) {
|
||||
int p2;
|
||||
register int p2;
|
||||
|
||||
(*vp)++;
|
||||
p2 = exp2b(vp, ignore);
|
||||
@@ -213,12 +213,12 @@ exp2b(vp, ignore)
|
||||
|
||||
static int
|
||||
exp2c(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
Char *p1 = exp3(vp, ignore);
|
||||
Char *p2;
|
||||
int i;
|
||||
register Char *p1 = exp3(vp, ignore);
|
||||
register Char *p2;
|
||||
register int i;
|
||||
|
||||
#ifdef EDEBUG
|
||||
etracc("exp2c p1", p1, vp);
|
||||
@@ -261,11 +261,11 @@ exp2c(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp3(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
Char *p1, *p2;
|
||||
int i;
|
||||
register Char *p1, *p2;
|
||||
register int i;
|
||||
|
||||
p1 = exp3a(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@@ -307,11 +307,11 @@ exp3(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp3a(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
Char *p1, *p2, *op;
|
||||
int i;
|
||||
register Char *p1, *p2, *op;
|
||||
register int i;
|
||||
|
||||
p1 = exp4(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@@ -337,18 +337,18 @@ exp3a(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp4(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
Char *p1, *p2;
|
||||
int i = 0;
|
||||
register Char *p1, *p2;
|
||||
register int i = 0;
|
||||
|
||||
p1 = exp5(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
etracc("exp4 p1", p1, vp);
|
||||
#endif
|
||||
if (isa(**vp, ADDOP)) {
|
||||
Char *op = *(*vp)++;
|
||||
register Char *op = *(*vp)++;
|
||||
|
||||
p2 = exp4(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@@ -374,18 +374,18 @@ exp4(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp5(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
Char *p1, *p2;
|
||||
int i = 0;
|
||||
register Char *p1, *p2;
|
||||
register int i = 0;
|
||||
|
||||
p1 = exp6(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
etracc("exp5 p1", p1, vp);
|
||||
#endif
|
||||
if (isa(**vp, MULOP)) {
|
||||
Char *op = *(*vp)++;
|
||||
register Char *op = *(*vp)++;
|
||||
|
||||
p2 = exp5(vp, ignore);
|
||||
#ifdef EDEBUG
|
||||
@@ -421,11 +421,11 @@ exp5(vp, ignore)
|
||||
|
||||
static Char *
|
||||
exp6(vp, ignore)
|
||||
Char ***vp;
|
||||
register Char ***vp;
|
||||
bool ignore;
|
||||
{
|
||||
int ccode, i = 0;
|
||||
Char *cp, *dp, *ep;
|
||||
register Char *cp, *dp, *ep;
|
||||
|
||||
if (**vp == 0)
|
||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||
@@ -461,7 +461,7 @@ exp6(vp, ignore)
|
||||
return (putn(ccode));
|
||||
}
|
||||
if (eq(**vp, STRLbrace)) {
|
||||
Char **v;
|
||||
register Char **v;
|
||||
struct command faket;
|
||||
Char *fakecom[2];
|
||||
|
||||
@@ -600,18 +600,18 @@ exp6(vp, ignore)
|
||||
|
||||
static void
|
||||
evalav(v)
|
||||
Char **v;
|
||||
register Char **v;
|
||||
{
|
||||
struct wordent paraml1;
|
||||
struct wordent *hp = ¶ml1;
|
||||
register struct wordent *hp = ¶ml1;
|
||||
struct command *t;
|
||||
struct wordent *wdp = hp;
|
||||
register struct wordent *wdp = hp;
|
||||
|
||||
set(STRstatus, Strsave(STR0));
|
||||
hp->prev = hp->next = hp;
|
||||
hp->word = STRNULL;
|
||||
while (*v) {
|
||||
struct wordent *new =
|
||||
register struct wordent *new =
|
||||
(struct wordent *) xcalloc(1, sizeof *wdp);
|
||||
|
||||
new->prev = wdp;
|
||||
@@ -631,8 +631,8 @@ evalav(v)
|
||||
|
||||
static int
|
||||
isa(cp, what)
|
||||
Char *cp;
|
||||
int what;
|
||||
register Char *cp;
|
||||
register int what;
|
||||
{
|
||||
if (cp == 0)
|
||||
return ((what & RESTOP) != 0);
|
||||
@@ -680,7 +680,7 @@ isa(cp, what)
|
||||
|
||||
static int
|
||||
egetn(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
if (*cp && *cp != '-' && !Isdigit(*cp))
|
||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ Char *globone __P((Char *, int));
|
||||
int Gmatch __P((Char *, Char *));
|
||||
void ginit __P((void));
|
||||
Char **globall __P((Char **));
|
||||
void rscan __P((Char **, void (*)(int)));
|
||||
void rscan __P((Char **, void (*)()));
|
||||
void tglob __P((Char **));
|
||||
void trim __P((Char **));
|
||||
#ifdef FILEC
|
||||
|
||||
+29
-29
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: file.c,v 1.4.2.1 1997/08/24 21:41:33 jkh Exp $
|
||||
* $Id: file.c,v 1.4 1995/06/18 14:08:44 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -160,7 +160,7 @@ static void
|
||||
pushback(string)
|
||||
Char *string;
|
||||
{
|
||||
Char *p;
|
||||
register Char *p;
|
||||
struct termios tty, tty_normal;
|
||||
int omask;
|
||||
char c;
|
||||
@@ -184,8 +184,8 @@ pushback(string)
|
||||
*/
|
||||
static void
|
||||
catn(des, src, count)
|
||||
Char *des, *src;
|
||||
int count;
|
||||
register Char *des, *src;
|
||||
register int count;
|
||||
{
|
||||
while (--count >= 0 && *des)
|
||||
des++;
|
||||
@@ -201,8 +201,8 @@ catn(des, src, count)
|
||||
*/
|
||||
static void
|
||||
copyn(des, src, count)
|
||||
Char *des, *src;
|
||||
int count;
|
||||
register Char *des, *src;
|
||||
register int count;
|
||||
{
|
||||
while (--count >= 0)
|
||||
if ((*des++ = *src++) == 0)
|
||||
@@ -251,7 +251,7 @@ print_by_column(dir, items, count)
|
||||
Char *dir, *items[];
|
||||
int count;
|
||||
{
|
||||
int i, rows, r, c, maxwidth = 0, columns;
|
||||
register int i, rows, r, c, maxwidth = 0, columns;
|
||||
|
||||
if (ioctl(SHOUT, TIOCGWINSZ, (ioctl_t) & win) < 0 || win.ws_col == 0)
|
||||
win.ws_col = 80;
|
||||
@@ -266,7 +266,7 @@ print_by_column(dir, items, count)
|
||||
for (c = 0; c < columns; c++) {
|
||||
i = c * rows + r;
|
||||
if (i < count) {
|
||||
int w;
|
||||
register int w;
|
||||
|
||||
(void) fprintf(cshout, "%s", vis_str(items[i]));
|
||||
(void) fputc(dir ? filetype(dir, items[i]) : ' ', cshout);
|
||||
@@ -292,8 +292,8 @@ static Char *
|
||||
tilde(new, old)
|
||||
Char *new, *old;
|
||||
{
|
||||
Char *o, *p;
|
||||
struct passwd *pw;
|
||||
register Char *o, *p;
|
||||
register struct passwd *pw;
|
||||
static Char person[40];
|
||||
|
||||
if (old[0] != '~')
|
||||
@@ -375,7 +375,7 @@ static void
|
||||
extract_dir_and_name(path, dir, name)
|
||||
Char *path, *dir, *name;
|
||||
{
|
||||
Char *p;
|
||||
register Char *p;
|
||||
|
||||
p = Strrchr(path, '/');
|
||||
if (p == NULL) {
|
||||
@@ -393,8 +393,8 @@ getentry(dir_fd, looking_for_lognames)
|
||||
DIR *dir_fd;
|
||||
int looking_for_lognames;
|
||||
{
|
||||
struct passwd *pw;
|
||||
struct dirent *dirp;
|
||||
register struct passwd *pw;
|
||||
register struct dirent *dirp;
|
||||
|
||||
if (looking_for_lognames) {
|
||||
if ((pw = getpwent()) == NULL)
|
||||
@@ -408,9 +408,9 @@ getentry(dir_fd, looking_for_lognames)
|
||||
|
||||
static void
|
||||
free_items(items)
|
||||
Char **items;
|
||||
register Char **items;
|
||||
{
|
||||
int i;
|
||||
register int i;
|
||||
|
||||
for (i = 0; items[i]; i++)
|
||||
xfree((ptr_t) items[i]);
|
||||
@@ -436,9 +436,9 @@ tsearch(word, command, max_word_length)
|
||||
int max_word_length;
|
||||
{
|
||||
static Char **items = NULL;
|
||||
DIR *dir_fd;
|
||||
int numitems = 0, ignoring = TRUE, nignored = 0;
|
||||
int name_length, looking_for_lognames;
|
||||
register DIR *dir_fd;
|
||||
register numitems = 0, ignoring = TRUE, nignored = 0;
|
||||
register name_length, looking_for_lognames;
|
||||
Char tilded_dir[MAXPATHLEN + 1], dir[MAXPATHLEN + 1];
|
||||
Char name[MAXNAMLEN + 1], extended_name[MAXNAMLEN + 1];
|
||||
Char *entry;
|
||||
@@ -450,7 +450,7 @@ tsearch(word, command, max_word_length)
|
||||
|
||||
looking_for_lognames = (*word == '~') && (Strchr(word, '/') == NULL);
|
||||
if (looking_for_lognames) {
|
||||
setpwent();
|
||||
(void) setpwent();
|
||||
copyn(name, &word[1], MAXNAMLEN); /* name sans ~ */
|
||||
dir_fd = NULL;
|
||||
}
|
||||
@@ -498,7 +498,7 @@ again: /* search for matches */
|
||||
ignoring = FALSE;
|
||||
nignored = 0;
|
||||
if (looking_for_lognames)
|
||||
setpwent();
|
||||
(void) setpwent();
|
||||
else
|
||||
rewinddir(dir_fd);
|
||||
goto again;
|
||||
@@ -547,8 +547,8 @@ recognize(extended_name, entry, name_length, numitems)
|
||||
if (numitems == 1) /* 1st match */
|
||||
copyn(extended_name, entry, MAXNAMLEN);
|
||||
else { /* 2nd & subsequent matches */
|
||||
Char *x, *ent;
|
||||
int len = 0;
|
||||
register Char *x, *ent;
|
||||
register int len = 0;
|
||||
|
||||
x = extended_name;
|
||||
for (ent = entry; *x && *x == *ent++; x++, len++)
|
||||
@@ -567,7 +567,7 @@ recognize(extended_name, entry, name_length, numitems)
|
||||
*/
|
||||
static int
|
||||
is_prefix(check, template)
|
||||
Char *check, *template;
|
||||
register Char *check, *template;
|
||||
{
|
||||
do
|
||||
if (*check == 0)
|
||||
@@ -584,7 +584,7 @@ static int
|
||||
is_suffix(check, template)
|
||||
Char *check, *template;
|
||||
{
|
||||
Char *c, *t;
|
||||
register Char *c, *t;
|
||||
|
||||
for (c = check; *c++;)
|
||||
continue;
|
||||
@@ -603,7 +603,7 @@ tenex(inputline, inputline_size)
|
||||
Char *inputline;
|
||||
int inputline_size;
|
||||
{
|
||||
int numitems, num_read;
|
||||
register int numitems, num_read;
|
||||
char tinputline[BUFSIZ];
|
||||
|
||||
|
||||
@@ -613,8 +613,8 @@ tenex(inputline, inputline_size)
|
||||
int i;
|
||||
static Char delims[] = {' ', '\'', '"', '\t', ';', '&', '<',
|
||||
'>', '(', ')', '|', '^', '%', '\0'};
|
||||
Char *str_end, *word_start, last_Char, should_retype;
|
||||
int space_left;
|
||||
register Char *str_end, *word_start, last_Char, should_retype;
|
||||
register int space_left;
|
||||
COMMAND command;
|
||||
|
||||
for (i = 0; i < num_read; i++)
|
||||
@@ -671,10 +671,10 @@ tenex(inputline, inputline_size)
|
||||
|
||||
static int
|
||||
ignored(entry)
|
||||
Char *entry;
|
||||
register Char *entry;
|
||||
{
|
||||
struct varent *vp;
|
||||
Char **cp;
|
||||
register Char **cp;
|
||||
|
||||
if ((vp = adrof(STRfignore)) == NULL || (cp = vp->vec) == NULL)
|
||||
return (FALSE);
|
||||
|
||||
+51
-50
@@ -72,8 +72,8 @@ struct biltins *
|
||||
isbfunc(t)
|
||||
struct command *t;
|
||||
{
|
||||
Char *cp = t->t_dcom[0];
|
||||
struct biltins *bp, *bp1, *bp2;
|
||||
register Char *cp = t->t_dcom[0];
|
||||
register struct biltins *bp, *bp1, *bp2;
|
||||
static struct biltins label = {"", dozip, 0, 0};
|
||||
static struct biltins foregnd = {"%job", dofg1, 0, 0};
|
||||
static struct biltins backgnd = {"%job &", dobg1, 0, 0};
|
||||
@@ -96,7 +96,7 @@ isbfunc(t)
|
||||
* one past the end.
|
||||
*/
|
||||
for (bp1 = bfunc, bp2 = bfunc + nbfunc; bp1 < bp2;) {
|
||||
int i;
|
||||
register i;
|
||||
|
||||
bp = bp1 + ((bp2 - bp1) >> 1);
|
||||
if ((i = *cp - *bp->bname) == 0 &&
|
||||
@@ -112,8 +112,8 @@ isbfunc(t)
|
||||
|
||||
void
|
||||
func(t, bp)
|
||||
struct command *t;
|
||||
struct biltins *bp;
|
||||
register struct command *t;
|
||||
register struct biltins *bp;
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -133,8 +133,8 @@ doonintr(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *cp;
|
||||
Char *vv = v[1];
|
||||
register Char *cp;
|
||||
register Char *vv = v[1];
|
||||
|
||||
if (parintr == SIG_IGN)
|
||||
return;
|
||||
@@ -194,8 +194,8 @@ doalias(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct varent *vp;
|
||||
Char *p;
|
||||
register struct varent *vp;
|
||||
register Char *p;
|
||||
|
||||
v++;
|
||||
p = *v++;
|
||||
@@ -265,8 +265,8 @@ doif(v, kp)
|
||||
Char **v;
|
||||
struct command *kp;
|
||||
{
|
||||
int i;
|
||||
Char **vv;
|
||||
register int i;
|
||||
register Char **vv;
|
||||
|
||||
v++;
|
||||
i = expr(&v);
|
||||
@@ -302,7 +302,7 @@ doif(v, kp)
|
||||
*/
|
||||
static void
|
||||
reexecute(kp)
|
||||
struct command *kp;
|
||||
register struct command *kp;
|
||||
{
|
||||
kp->t_dflg &= F_SAVE;
|
||||
kp->t_dflg |= F_REPEAT;
|
||||
@@ -339,7 +339,7 @@ void
|
||||
gotolab(lab)
|
||||
Char *lab;
|
||||
{
|
||||
struct whyle *wp;
|
||||
register struct whyle *wp;
|
||||
/*
|
||||
* While we still can, locate any unknown ends of existing loops. This
|
||||
* obscure code is the WORST result of the fact that we don't really parse.
|
||||
@@ -365,7 +365,7 @@ doswitch(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *cp, *lp;
|
||||
register Char *cp, *lp;
|
||||
|
||||
v++;
|
||||
if (!*v || *(*v++) != '(')
|
||||
@@ -419,8 +419,8 @@ doforeach(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *cp, *sp;
|
||||
struct whyle *nwp;
|
||||
register Char *cp, *sp;
|
||||
register struct whyle *nwp;
|
||||
|
||||
v++;
|
||||
sp = cp = strip(*v);
|
||||
@@ -463,8 +463,8 @@ dowhile(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
int status;
|
||||
bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) &&
|
||||
register int status;
|
||||
register bool again = whyles != 0 && SEEKEQ(&whyles->w_start, &lineloc) &&
|
||||
whyles->w_fename == 0;
|
||||
|
||||
v++;
|
||||
@@ -479,7 +479,7 @@ dowhile(v, t)
|
||||
if (*v)
|
||||
stderror(ERR_NAME | ERR_EXPRESSION);
|
||||
if (!again) {
|
||||
struct whyle *nwp =
|
||||
register struct whyle *nwp =
|
||||
(struct whyle *) xcalloc(1, sizeof(*nwp));
|
||||
|
||||
nwp->w_start = lineloc;
|
||||
@@ -564,8 +564,8 @@ dorepeat(v, kp)
|
||||
Char **v;
|
||||
struct command *kp;
|
||||
{
|
||||
int i;
|
||||
sigset_t omask = 0;
|
||||
register int i;
|
||||
register sigset_t omask = 0;
|
||||
|
||||
i = getn(v[1]);
|
||||
if (setintr)
|
||||
@@ -593,10 +593,10 @@ doswbrk(v, t)
|
||||
|
||||
int
|
||||
srchx(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
struct srch *sp, *sp1, *sp2;
|
||||
int i;
|
||||
register struct srch *sp, *sp1, *sp2;
|
||||
register i;
|
||||
|
||||
/*
|
||||
* Binary search Sp1 is the beginning of the current search range. Sp2 is
|
||||
@@ -622,12 +622,12 @@ static Char *Sgoal;
|
||||
static void
|
||||
search(type, level, goal)
|
||||
int type;
|
||||
int level;
|
||||
register int level;
|
||||
Char *goal;
|
||||
{
|
||||
Char wordbuf[BUFSIZ];
|
||||
Char *aword = wordbuf;
|
||||
Char *cp;
|
||||
register Char *aword = wordbuf;
|
||||
register Char *cp;
|
||||
|
||||
Stype = type;
|
||||
Sgoal = goal;
|
||||
@@ -722,10 +722,10 @@ search(type, level, goal)
|
||||
|
||||
static int
|
||||
getword(wp)
|
||||
Char *wp;
|
||||
register Char *wp;
|
||||
{
|
||||
int found = 0;
|
||||
int c, d;
|
||||
register int found = 0;
|
||||
register int c, d;
|
||||
int kwd = 0;
|
||||
Char *owp = wp;
|
||||
|
||||
@@ -851,7 +851,7 @@ wfree()
|
||||
btell(&o);
|
||||
|
||||
for (; whyles; whyles = nwp) {
|
||||
struct whyle *wp = whyles;
|
||||
register struct whyle *wp = whyles;
|
||||
nwp = wp->w_next;
|
||||
|
||||
/*
|
||||
@@ -901,9 +901,9 @@ doglob(v, t)
|
||||
static void
|
||||
xecho(sep, v)
|
||||
int sep;
|
||||
Char **v;
|
||||
register Char **v;
|
||||
{
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
int nonl = 0;
|
||||
|
||||
if (setintr)
|
||||
@@ -924,7 +924,7 @@ xecho(sep, v)
|
||||
if (sep == ' ' && *v && eq(*v, STRmn))
|
||||
nonl++, v++;
|
||||
while ((cp = *v++) != NULL) {
|
||||
int c;
|
||||
register int c;
|
||||
|
||||
while ((c = *cp++) != '\0')
|
||||
(void) vis_fputc(c | QUOTE, cshout);
|
||||
@@ -952,7 +952,7 @@ dosetenv(v, t)
|
||||
|
||||
v++;
|
||||
if ((vp = *v++) == 0) {
|
||||
Char **ep;
|
||||
register Char **ep;
|
||||
|
||||
if (setintr)
|
||||
(void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
|
||||
@@ -1045,8 +1045,8 @@ void
|
||||
Setenv(name, val)
|
||||
Char *name, *val;
|
||||
{
|
||||
Char **ep = STR_environ;
|
||||
Char *cp, *dp;
|
||||
register Char **ep = STR_environ;
|
||||
register Char *cp, *dp;
|
||||
Char *blk[2];
|
||||
Char **oep = ep;
|
||||
|
||||
@@ -1078,8 +1078,8 @@ static void
|
||||
Unsetenv(name)
|
||||
Char *name;
|
||||
{
|
||||
Char **ep = STR_environ;
|
||||
Char *cp, *dp;
|
||||
register Char **ep = STR_environ;
|
||||
register Char *cp, *dp;
|
||||
Char **oep = ep;
|
||||
|
||||
for (; *ep; ep++) {
|
||||
@@ -1104,8 +1104,8 @@ doumask(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *cp = v[1];
|
||||
int i;
|
||||
register Char *cp = v[1];
|
||||
register int i;
|
||||
|
||||
if (cp == 0) {
|
||||
i = umask(0);
|
||||
@@ -1151,7 +1151,7 @@ static struct limits *
|
||||
findlim(cp)
|
||||
Char *cp;
|
||||
{
|
||||
struct limits *lp, *res;
|
||||
register struct limits *lp, *res;
|
||||
|
||||
res = (struct limits *) NULL;
|
||||
for (lp = limits; lp->limconst >= 0; lp++)
|
||||
@@ -1173,8 +1173,8 @@ dolimit(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct limits *lp;
|
||||
RLIM_TYPE limit;
|
||||
register struct limits *lp;
|
||||
register RLIM_TYPE limit;
|
||||
char hard = 0;
|
||||
|
||||
v++;
|
||||
@@ -1199,10 +1199,11 @@ dolimit(v, t)
|
||||
|
||||
static RLIM_TYPE
|
||||
getval(lp, v)
|
||||
struct limits *lp;
|
||||
register struct limits *lp;
|
||||
Char **v;
|
||||
{
|
||||
float f;
|
||||
register float f;
|
||||
double atof();
|
||||
Char *cp = *v++;
|
||||
|
||||
f = atof(short2str(cp));
|
||||
@@ -1282,7 +1283,7 @@ limtail(cp, str)
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
plim(lp, hard)
|
||||
struct limits *lp;
|
||||
register struct limits *lp;
|
||||
Char hard;
|
||||
{
|
||||
struct rlimit rlim;
|
||||
@@ -1309,7 +1310,7 @@ dounlimit(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct limits *lp;
|
||||
register struct limits *lp;
|
||||
int lerr = 0;
|
||||
Char hard = 0;
|
||||
|
||||
@@ -1335,7 +1336,7 @@ dounlimit(v, t)
|
||||
|
||||
static int
|
||||
setlim(lp, hard, limit)
|
||||
struct limits *lp;
|
||||
register struct limits *lp;
|
||||
Char hard;
|
||||
RLIM_TYPE limit;
|
||||
{
|
||||
@@ -1367,7 +1368,7 @@ dosuspend(v, t)
|
||||
{
|
||||
int ctpgrp;
|
||||
|
||||
void (*old) __P((int));
|
||||
void (*old) ();
|
||||
|
||||
if (loginsh)
|
||||
stderror(ERR_SUSPLOG);
|
||||
|
||||
+14
-14
@@ -553,10 +553,10 @@ ginit()
|
||||
|
||||
void
|
||||
rscan(t, f)
|
||||
Char **t;
|
||||
void (*f) __P((int));
|
||||
register Char **t;
|
||||
void (*f) ();
|
||||
{
|
||||
Char *p;
|
||||
register Char *p;
|
||||
|
||||
while ((p = *t++) != NULL)
|
||||
while (*p)
|
||||
@@ -565,9 +565,9 @@ rscan(t, f)
|
||||
|
||||
void
|
||||
trim(t)
|
||||
Char **t;
|
||||
register Char **t;
|
||||
{
|
||||
Char *p;
|
||||
register Char *p;
|
||||
|
||||
while ((p = *t++) != NULL)
|
||||
while (*p)
|
||||
@@ -576,9 +576,9 @@ trim(t)
|
||||
|
||||
void
|
||||
tglob(t)
|
||||
Char **t;
|
||||
register Char **t;
|
||||
{
|
||||
Char *p, c;
|
||||
register Char *p, c;
|
||||
|
||||
while ((p = *t++) != NULL) {
|
||||
if (*p == '~' || *p == '=')
|
||||
@@ -622,7 +622,7 @@ dobackp(cp, literal)
|
||||
Char *cp;
|
||||
bool literal;
|
||||
{
|
||||
Char *lp, *rp;
|
||||
register Char *lp, *rp;
|
||||
Char *ep, word[MAXPATHLEN];
|
||||
|
||||
if (pargv) {
|
||||
@@ -667,8 +667,8 @@ backeval(cp, literal)
|
||||
Char *cp;
|
||||
bool literal;
|
||||
{
|
||||
int icnt, c;
|
||||
Char *ip;
|
||||
register int icnt, c;
|
||||
register Char *ip;
|
||||
struct command faket;
|
||||
bool hadnl;
|
||||
int pvec[2], quoted;
|
||||
@@ -851,9 +851,9 @@ Gmatch(string, pattern)
|
||||
|
||||
static int
|
||||
pmatch(string, pattern)
|
||||
Char *string, *pattern;
|
||||
register Char *string, *pattern;
|
||||
{
|
||||
Char stringc, patternc;
|
||||
register Char stringc, patternc;
|
||||
int match, negate_range;
|
||||
Char rangec;
|
||||
|
||||
@@ -910,7 +910,7 @@ void
|
||||
Gcat(s1, s2)
|
||||
Char *s1, *s2;
|
||||
{
|
||||
Char *p, *q;
|
||||
register Char *p, *q;
|
||||
int n;
|
||||
|
||||
for (p = s1; *p++;)
|
||||
@@ -934,7 +934,7 @@ Gcat(s1, s2)
|
||||
#ifdef FILEC
|
||||
int
|
||||
sortscmp(a, b)
|
||||
const ptr_t a, b;
|
||||
register const ptr_t a, b;
|
||||
{
|
||||
#if defined(NLS) && !defined(NOSTRCOLL)
|
||||
char buf[2048];
|
||||
|
||||
+7
-7
@@ -56,8 +56,8 @@ void
|
||||
savehist(sp)
|
||||
struct wordent *sp;
|
||||
{
|
||||
struct Hist *hp, *np;
|
||||
int histlen = 0;
|
||||
register struct Hist *hp, *np;
|
||||
register int histlen = 0;
|
||||
Char *cp;
|
||||
|
||||
/* throw away null lines */
|
||||
@@ -65,7 +65,7 @@ savehist(sp)
|
||||
return;
|
||||
cp = value(STRhistory);
|
||||
if (*cp) {
|
||||
Char *p = cp;
|
||||
register Char *p = cp;
|
||||
|
||||
while (*p) {
|
||||
if (!Isdigit(*p)) {
|
||||
@@ -86,10 +86,10 @@ savehist(sp)
|
||||
struct Hist *
|
||||
enthist(event, lp, docopy)
|
||||
int event;
|
||||
struct wordent *lp;
|
||||
register struct wordent *lp;
|
||||
bool docopy;
|
||||
{
|
||||
struct Hist *np;
|
||||
register struct Hist *np;
|
||||
|
||||
np = (struct Hist *) xmalloc((size_t) sizeof(*np));
|
||||
np->Hnum = np->Href = event;
|
||||
@@ -109,7 +109,7 @@ enthist(event, lp, docopy)
|
||||
|
||||
static void
|
||||
hfree(hp)
|
||||
struct Hist *hp;
|
||||
register struct Hist *hp;
|
||||
{
|
||||
|
||||
freelex(&hp->Hlex);
|
||||
@@ -177,7 +177,7 @@ dohist1(hp, np, rflg, hflg)
|
||||
|
||||
static void
|
||||
phist(hp, hflg)
|
||||
struct Hist *hp;
|
||||
register struct Hist *hp;
|
||||
int hflg;
|
||||
{
|
||||
if (hflg == 0)
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: init.c,v 1.2 1994/09/24 02:54:07 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+46
-46
@@ -142,9 +142,9 @@ static Char getCtmp;
|
||||
|
||||
int
|
||||
lex(hp)
|
||||
struct wordent *hp;
|
||||
register struct wordent *hp;
|
||||
{
|
||||
struct wordent *wdp;
|
||||
register struct wordent *wdp;
|
||||
int c;
|
||||
|
||||
btell(&lineloc);
|
||||
@@ -165,7 +165,7 @@ lex(hp)
|
||||
* be ready and rarin to go even if it is interrupted.
|
||||
*/
|
||||
do {
|
||||
struct wordent *new;
|
||||
register struct wordent *new;
|
||||
|
||||
new = (struct wordent *) xmalloc((size_t) sizeof(*wdp));
|
||||
new->word = 0;
|
||||
@@ -184,7 +184,7 @@ prlex(fp, sp0)
|
||||
FILE *fp;
|
||||
struct wordent *sp0;
|
||||
{
|
||||
struct wordent *sp = sp0->next;
|
||||
register struct wordent *sp = sp0->next;
|
||||
|
||||
for (;;) {
|
||||
(void) fprintf(fp, "%s", vis_str(sp->word));
|
||||
@@ -198,15 +198,15 @@ prlex(fp, sp0)
|
||||
|
||||
void
|
||||
copylex(hp, fp)
|
||||
struct wordent *hp;
|
||||
struct wordent *fp;
|
||||
register struct wordent *hp;
|
||||
register struct wordent *fp;
|
||||
{
|
||||
struct wordent *wdp;
|
||||
register struct wordent *wdp;
|
||||
|
||||
wdp = hp;
|
||||
fp = fp->next;
|
||||
do {
|
||||
struct wordent *new;
|
||||
register struct wordent *new;
|
||||
|
||||
new = (struct wordent *) xmalloc((size_t) sizeof(*wdp));
|
||||
new->prev = wdp;
|
||||
@@ -221,9 +221,9 @@ copylex(hp, fp)
|
||||
|
||||
void
|
||||
freelex(vp)
|
||||
struct wordent *vp;
|
||||
register struct wordent *vp;
|
||||
{
|
||||
struct wordent *fp;
|
||||
register struct wordent *fp;
|
||||
|
||||
while (vp->next != vp) {
|
||||
fp = vp->next;
|
||||
@@ -237,11 +237,11 @@ freelex(vp)
|
||||
static Char *
|
||||
word()
|
||||
{
|
||||
Char c, c1;
|
||||
Char *wp;
|
||||
register Char c, c1;
|
||||
register Char *wp;
|
||||
Char wbuf[BUFSIZ];
|
||||
bool dolflg;
|
||||
int i;
|
||||
register bool dolflg;
|
||||
register int i;
|
||||
|
||||
wp = wbuf;
|
||||
i = BUFSIZ - 4;
|
||||
@@ -358,9 +358,9 @@ ret:
|
||||
|
||||
static int
|
||||
getC1(flag)
|
||||
int flag;
|
||||
register int flag;
|
||||
{
|
||||
Char c;
|
||||
register Char c;
|
||||
|
||||
while (1) {
|
||||
if ((c = peekc) != '\0') {
|
||||
@@ -416,9 +416,9 @@ getC1(flag)
|
||||
static void
|
||||
getdol()
|
||||
{
|
||||
Char *np, *ep;
|
||||
register Char *np, *ep;
|
||||
Char name[4 * MAXVARLEN + 1];
|
||||
int c;
|
||||
register int c;
|
||||
int sc;
|
||||
bool special = 0, toolong;
|
||||
|
||||
@@ -650,9 +650,9 @@ static void
|
||||
getexcl(sc)
|
||||
int sc;
|
||||
{
|
||||
struct wordent *hp, *ip;
|
||||
register struct wordent *hp, *ip;
|
||||
int left, right, dol;
|
||||
int c;
|
||||
register int c;
|
||||
|
||||
if (sc == 0) {
|
||||
sc = getC(0);
|
||||
@@ -727,9 +727,9 @@ static struct wordent *
|
||||
getsub(en)
|
||||
struct wordent *en;
|
||||
{
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
int delim;
|
||||
int c;
|
||||
register int c;
|
||||
int sc;
|
||||
bool global;
|
||||
Char orhsb[sizeof(rhsb) / sizeof(Char)];
|
||||
@@ -872,12 +872,12 @@ dosub(sc, en, global)
|
||||
struct wordent lexi;
|
||||
bool didsub = 0, didone = 0;
|
||||
struct wordent *hp = &lexi;
|
||||
struct wordent *wdp;
|
||||
int i = exclc;
|
||||
register struct wordent *wdp;
|
||||
register int i = exclc;
|
||||
|
||||
wdp = hp;
|
||||
while (--i >= 0) {
|
||||
struct wordent *new =
|
||||
register struct wordent *new =
|
||||
(struct wordent *) xcalloc(1, sizeof *wdp);
|
||||
|
||||
new->word = 0;
|
||||
@@ -924,8 +924,8 @@ subword(cp, type, adid)
|
||||
bool *adid;
|
||||
{
|
||||
Char wbuf[BUFSIZ];
|
||||
Char *wp, *mp, *np;
|
||||
int i;
|
||||
register Char *wp, *mp, *np;
|
||||
register int i;
|
||||
|
||||
*adid = 0;
|
||||
switch (type) {
|
||||
@@ -996,8 +996,8 @@ domod(cp, type)
|
||||
Char *cp;
|
||||
int type;
|
||||
{
|
||||
Char *wp, *xp;
|
||||
int c;
|
||||
register Char *wp, *xp;
|
||||
register int c;
|
||||
|
||||
switch (type) {
|
||||
|
||||
@@ -1042,7 +1042,7 @@ domod(cp, type)
|
||||
|
||||
static int
|
||||
matchs(str, pat)
|
||||
Char *str, *pat;
|
||||
register Char *str, *pat;
|
||||
{
|
||||
while (*str && *pat && *str == *pat)
|
||||
str++, pat++;
|
||||
@@ -1051,11 +1051,11 @@ matchs(str, pat)
|
||||
|
||||
static int
|
||||
getsel(al, ar, dol)
|
||||
int *al, *ar;
|
||||
register int *al, *ar;
|
||||
int dol;
|
||||
{
|
||||
int c = getC(0);
|
||||
int i;
|
||||
register int c = getC(0);
|
||||
register int i;
|
||||
bool first = *al < 0;
|
||||
|
||||
switch (c) {
|
||||
@@ -1139,9 +1139,9 @@ static struct wordent *
|
||||
gethent(sc)
|
||||
int sc;
|
||||
{
|
||||
struct Hist *hp;
|
||||
Char *np;
|
||||
int c;
|
||||
register struct Hist *hp;
|
||||
register Char *np;
|
||||
register int c;
|
||||
int event;
|
||||
bool back = 0;
|
||||
|
||||
@@ -1258,12 +1258,12 @@ findev(cp, anyarg)
|
||||
Char *cp;
|
||||
bool anyarg;
|
||||
{
|
||||
struct Hist *hp;
|
||||
register struct Hist *hp;
|
||||
|
||||
for (hp = Histlist.Hnext; hp; hp = hp->Hnext) {
|
||||
Char *dp;
|
||||
Char *p, *q;
|
||||
struct wordent *lp = hp->Hlex.next;
|
||||
register Char *p, *q;
|
||||
register struct wordent *lp = hp->Hlex.next;
|
||||
int argno = 0;
|
||||
|
||||
/*
|
||||
@@ -1307,7 +1307,7 @@ findev(cp, anyarg)
|
||||
|
||||
static void
|
||||
setexclp(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
if (cp && cp[0] == '\n')
|
||||
return;
|
||||
@@ -1325,7 +1325,7 @@ int
|
||||
readc(wanteof)
|
||||
bool wanteof;
|
||||
{
|
||||
int c;
|
||||
register int c;
|
||||
static sincereal;
|
||||
|
||||
aret = F_SEEK;
|
||||
@@ -1440,10 +1440,10 @@ reread:
|
||||
static int
|
||||
bgetc()
|
||||
{
|
||||
int buf, off, c;
|
||||
register int buf, off, c;
|
||||
|
||||
#ifdef FILEC
|
||||
int numleft = 0, roomleft;
|
||||
register int numleft = 0, roomleft;
|
||||
Char ttyline[BUFSIZ];
|
||||
#endif
|
||||
char tbuf[BUFSIZ + 1];
|
||||
@@ -1474,7 +1474,7 @@ bgetc()
|
||||
again:
|
||||
buf = (int) fseekp / BUFSIZ;
|
||||
if (buf >= fblocks) {
|
||||
Char **nfbuf =
|
||||
register Char **nfbuf =
|
||||
(Char **) xcalloc((size_t) (fblocks + 2),
|
||||
sizeof(Char **));
|
||||
|
||||
@@ -1505,7 +1505,7 @@ again:
|
||||
goto again;
|
||||
}
|
||||
if (c > 0)
|
||||
memmove(fbuf[buf] + off, ttyline, c * sizeof(Char));
|
||||
bcopy(ttyline, fbuf[buf] + off, c * sizeof(Char));
|
||||
numleft = 0;
|
||||
}
|
||||
else {
|
||||
@@ -1549,7 +1549,7 @@ again:
|
||||
static void
|
||||
bfree()
|
||||
{
|
||||
int sb, i;
|
||||
register int sb, i;
|
||||
|
||||
if (cantell)
|
||||
return;
|
||||
|
||||
+32
-32
@@ -53,8 +53,8 @@ static int renum __P((int, int));
|
||||
|
||||
int
|
||||
any(s, c)
|
||||
char *s;
|
||||
int c;
|
||||
register char *s;
|
||||
register int c;
|
||||
{
|
||||
if (!s)
|
||||
return (0); /* Check for nil pointer */
|
||||
@@ -77,10 +77,10 @@ setzero(cp, i)
|
||||
|
||||
char *
|
||||
strsave(s)
|
||||
char *s;
|
||||
register char *s;
|
||||
{
|
||||
char *n;
|
||||
char *p;
|
||||
register char *p;
|
||||
|
||||
if (s == NULL)
|
||||
s = "";
|
||||
@@ -94,7 +94,7 @@ strsave(s)
|
||||
|
||||
Char **
|
||||
blkend(up)
|
||||
Char **up;
|
||||
register Char **up;
|
||||
{
|
||||
|
||||
while (*up)
|
||||
@@ -106,7 +106,7 @@ blkend(up)
|
||||
void
|
||||
blkpr(fp, av)
|
||||
FILE *fp;
|
||||
Char **av;
|
||||
register Char **av;
|
||||
{
|
||||
|
||||
for (; *av; av++) {
|
||||
@@ -118,9 +118,9 @@ blkpr(fp, av)
|
||||
|
||||
int
|
||||
blklen(av)
|
||||
Char **av;
|
||||
register Char **av;
|
||||
{
|
||||
int i = 0;
|
||||
register int i = 0;
|
||||
|
||||
while (*av++)
|
||||
i++;
|
||||
@@ -130,9 +130,9 @@ blklen(av)
|
||||
Char **
|
||||
blkcpy(oav, bv)
|
||||
Char **oav;
|
||||
Char **bv;
|
||||
register Char **bv;
|
||||
{
|
||||
Char **av = oav;
|
||||
register Char **av = oav;
|
||||
|
||||
while ((*av++ = *bv++) != NULL)
|
||||
continue;
|
||||
@@ -152,7 +152,7 @@ void
|
||||
blkfree(av0)
|
||||
Char **av0;
|
||||
{
|
||||
Char **av = av0;
|
||||
register Char **av = av0;
|
||||
|
||||
if (!av0)
|
||||
return;
|
||||
@@ -163,9 +163,9 @@ blkfree(av0)
|
||||
|
||||
Char **
|
||||
saveblk(v)
|
||||
Char **v;
|
||||
register Char **v;
|
||||
{
|
||||
Char **newv =
|
||||
register Char **newv =
|
||||
(Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
||||
Char **onewv = newv;
|
||||
|
||||
@@ -177,11 +177,11 @@ saveblk(v)
|
||||
#ifdef NOTUSED
|
||||
char *
|
||||
strstr(s, t)
|
||||
char *s, *t;
|
||||
register char *s, *t;
|
||||
{
|
||||
do {
|
||||
char *ss = s;
|
||||
char *tt = t;
|
||||
register char *ss = s;
|
||||
register char *tt = t;
|
||||
|
||||
do
|
||||
if (*tt == '\0')
|
||||
@@ -199,7 +199,7 @@ strspl(cp, dp)
|
||||
char *cp, *dp;
|
||||
{
|
||||
char *ep;
|
||||
char *p, *q;
|
||||
register char *p, *q;
|
||||
|
||||
if (!cp)
|
||||
cp = "";
|
||||
@@ -221,9 +221,9 @@ strspl(cp, dp)
|
||||
|
||||
Char **
|
||||
blkspl(up, vp)
|
||||
Char **up, **vp;
|
||||
register Char **up, **vp;
|
||||
{
|
||||
Char **wp =
|
||||
register Char **wp =
|
||||
(Char **) xcalloc((size_t) (blklen(up) + blklen(vp) + 1),
|
||||
sizeof(Char **));
|
||||
|
||||
@@ -233,7 +233,7 @@ blkspl(up, vp)
|
||||
|
||||
Char
|
||||
lastchr(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
|
||||
if (!cp)
|
||||
@@ -252,7 +252,7 @@ lastchr(cp)
|
||||
void
|
||||
closem()
|
||||
{
|
||||
int f, flimit;
|
||||
register int f, flimit;
|
||||
|
||||
for (f = 0, flimit = getdtablesize(); f < flimit; f++)
|
||||
if (f != SHIN && f != SHOUT && f != SHERR && f != OLDSTD &&
|
||||
@@ -277,7 +277,7 @@ donefds()
|
||||
*/
|
||||
int
|
||||
dmove(i, j)
|
||||
int i, j;
|
||||
register int i, j;
|
||||
{
|
||||
|
||||
if (i == j || i < 0)
|
||||
@@ -296,7 +296,7 @@ dmove(i, j)
|
||||
|
||||
int
|
||||
dcopy(i, j)
|
||||
int i, j;
|
||||
register int i, j;
|
||||
{
|
||||
|
||||
if (i == j || i < 0 || (j < 0 && i > 2))
|
||||
@@ -311,9 +311,9 @@ dcopy(i, j)
|
||||
|
||||
static int
|
||||
renum(i, j)
|
||||
int i, j;
|
||||
register int i, j;
|
||||
{
|
||||
int k = dup(i);
|
||||
register int k = dup(i);
|
||||
|
||||
if (k < 0)
|
||||
return (-1);
|
||||
@@ -334,10 +334,10 @@ renum(i, j)
|
||||
*/
|
||||
void
|
||||
lshift(v, c)
|
||||
Char **v;
|
||||
int c;
|
||||
register Char **v;
|
||||
register int c;
|
||||
{
|
||||
Char **u;
|
||||
register Char **u;
|
||||
|
||||
for (u = v; *u && --c >= 0; u++)
|
||||
xfree((ptr_t) *u);
|
||||
@@ -363,7 +363,7 @@ number(cp)
|
||||
|
||||
Char **
|
||||
copyblk(v)
|
||||
Char **v;
|
||||
register Char **v;
|
||||
{
|
||||
Char **nv = (Char **) xcalloc((size_t) (blklen(v) + 1), sizeof(Char **));
|
||||
|
||||
@@ -373,7 +373,7 @@ copyblk(v)
|
||||
#ifndef SHORT_STRINGS
|
||||
char *
|
||||
strend(cp)
|
||||
char *cp;
|
||||
register char *cp;
|
||||
{
|
||||
if (!cp)
|
||||
return (cp);
|
||||
@@ -388,7 +388,7 @@ Char *
|
||||
strip(cp)
|
||||
Char *cp;
|
||||
{
|
||||
Char *dp = cp;
|
||||
register Char *dp = cp;
|
||||
|
||||
if (!cp)
|
||||
return (cp);
|
||||
@@ -408,7 +408,7 @@ udvar(name)
|
||||
|
||||
int
|
||||
prefix(sub, str)
|
||||
Char *sub, *str;
|
||||
register Char *sub, *str;
|
||||
{
|
||||
|
||||
for (;;) {
|
||||
|
||||
+29
-29
@@ -79,7 +79,7 @@ static int aleft;
|
||||
extern int hleft;
|
||||
void
|
||||
alias(lex)
|
||||
struct wordent *lex;
|
||||
register struct wordent *lex;
|
||||
{
|
||||
jmp_buf osetexit;
|
||||
|
||||
@@ -99,7 +99,7 @@ alias(lex)
|
||||
|
||||
static void
|
||||
asyntax(p1, p2)
|
||||
struct wordent *p1, *p2;
|
||||
register struct wordent *p1, *p2;
|
||||
{
|
||||
while (p1 != p2)
|
||||
if (any(";&\n", p1->word[0]))
|
||||
@@ -113,10 +113,10 @@ asyntax(p1, p2)
|
||||
static void
|
||||
asyn0(p1, p2)
|
||||
struct wordent *p1;
|
||||
struct wordent *p2;
|
||||
register struct wordent *p2;
|
||||
{
|
||||
struct wordent *p;
|
||||
int l = 0;
|
||||
register struct wordent *p;
|
||||
register int l = 0;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
switch (p->word[0]) {
|
||||
@@ -153,11 +153,11 @@ asyn0(p1, p2)
|
||||
static void
|
||||
asyn3(p1, p2)
|
||||
struct wordent *p1;
|
||||
struct wordent *p2;
|
||||
register struct wordent *p2;
|
||||
{
|
||||
struct varent *ap;
|
||||
register struct varent *ap;
|
||||
struct wordent alout;
|
||||
bool redid;
|
||||
register bool redid;
|
||||
|
||||
if (p1 == p2)
|
||||
return;
|
||||
@@ -203,9 +203,9 @@ asyn3(p1, p2)
|
||||
|
||||
static struct wordent *
|
||||
freenod(p1, p2)
|
||||
struct wordent *p1, *p2;
|
||||
register struct wordent *p1, *p2;
|
||||
{
|
||||
struct wordent *retp = p1->prev;
|
||||
register struct wordent *retp = p1->prev;
|
||||
|
||||
while (p1 != p2) {
|
||||
xfree((ptr_t) p1->word);
|
||||
@@ -229,7 +229,7 @@ freenod(p1, p2)
|
||||
*/
|
||||
struct command *
|
||||
syntax(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
register struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
|
||||
@@ -251,8 +251,8 @@ syn0(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
struct wordent *p;
|
||||
struct command *t, *t1;
|
||||
register struct wordent *p;
|
||||
register struct command *t, *t1;
|
||||
int l;
|
||||
|
||||
l = 0;
|
||||
@@ -319,8 +319,8 @@ syn1(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
struct wordent *p;
|
||||
struct command *t;
|
||||
register struct wordent *p;
|
||||
register struct command *t;
|
||||
int l;
|
||||
|
||||
l = 0;
|
||||
@@ -360,9 +360,9 @@ syn1a(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
struct wordent *p;
|
||||
struct command *t;
|
||||
int l = 0;
|
||||
register struct wordent *p;
|
||||
register struct command *t;
|
||||
register int l = 0;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
switch (p->word[0]) {
|
||||
@@ -401,9 +401,9 @@ syn1b(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
struct wordent *p;
|
||||
struct command *t;
|
||||
int l = 0;
|
||||
register struct wordent *p;
|
||||
register struct command *t;
|
||||
register int l = 0;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
switch (p->word[0]) {
|
||||
@@ -441,9 +441,9 @@ syn2(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
struct wordent *p, *pn;
|
||||
struct command *t;
|
||||
int l = 0;
|
||||
register struct wordent *p, *pn;
|
||||
register struct command *t;
|
||||
register int l = 0;
|
||||
int f;
|
||||
|
||||
for (p = p1; p != p2; p = p->next)
|
||||
@@ -492,10 +492,10 @@ syn3(p1, p2, flags)
|
||||
struct wordent *p1, *p2;
|
||||
int flags;
|
||||
{
|
||||
struct wordent *p;
|
||||
register struct wordent *p;
|
||||
struct wordent *lp, *rp;
|
||||
struct command *t;
|
||||
int l;
|
||||
register struct command *t;
|
||||
register int l;
|
||||
Char **av;
|
||||
int n, c;
|
||||
bool specp = 0;
|
||||
@@ -668,9 +668,9 @@ again:
|
||||
|
||||
void
|
||||
freesyn(t)
|
||||
struct command *t;
|
||||
register struct command *t;
|
||||
{
|
||||
Char **v;
|
||||
register Char **v;
|
||||
|
||||
if (t == 0)
|
||||
return;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/*-
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
|
||||
+44
-46
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: proc.c,v 1.2.8.1 1997/08/24 21:41:37 jkh Exp $
|
||||
* $Id: proc.c,v 1.2 1994/09/24 02:54:13 davidg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -82,11 +82,10 @@ void
|
||||
pchild(notused)
|
||||
int notused;
|
||||
{
|
||||
struct process *pp;
|
||||
struct process *fp;
|
||||
int pid;
|
||||
register struct process *pp;
|
||||
register struct process *fp;
|
||||
register int pid;
|
||||
extern int insource;
|
||||
int save_errno = errno;
|
||||
union wait w;
|
||||
int jobflags;
|
||||
struct rusage ru;
|
||||
@@ -102,7 +101,6 @@ loop:
|
||||
goto loop;
|
||||
}
|
||||
pnoprocesses = pid == -1;
|
||||
errno = save_errno;
|
||||
return;
|
||||
}
|
||||
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
|
||||
@@ -203,7 +201,7 @@ found:
|
||||
void
|
||||
pnote()
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
int flags;
|
||||
sigset_t omask;
|
||||
|
||||
@@ -227,7 +225,7 @@ pnote()
|
||||
void
|
||||
pwait()
|
||||
{
|
||||
struct process *fp, *pp;
|
||||
register struct process *fp, *pp;
|
||||
sigset_t omask;
|
||||
|
||||
/*
|
||||
@@ -255,9 +253,9 @@ pwait()
|
||||
*/
|
||||
void
|
||||
pjwait(pp)
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
{
|
||||
struct process *fp;
|
||||
register struct process *fp;
|
||||
int jobflags, reason;
|
||||
sigset_t omask;
|
||||
|
||||
@@ -347,7 +345,7 @@ dowait(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
sigset_t omask;
|
||||
|
||||
pjobs++;
|
||||
@@ -369,7 +367,7 @@ loop:
|
||||
static void
|
||||
pflushall()
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
|
||||
for (pp = proclist.p_next; pp != NULL; pp = pp->p_next)
|
||||
if (pp->p_pid)
|
||||
@@ -383,10 +381,10 @@ pflushall()
|
||||
*/
|
||||
static void
|
||||
pflush(pp)
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
{
|
||||
struct process *np;
|
||||
int idx;
|
||||
register struct process *np;
|
||||
register int idx;
|
||||
|
||||
if (pp->p_pid == 0) {
|
||||
(void) fprintf(csherr, "BUG: process flushed twice");
|
||||
@@ -417,7 +415,7 @@ pflush(pp)
|
||||
*/
|
||||
static void
|
||||
pclrcurr(pp)
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
{
|
||||
|
||||
if (pp == pcurrent)
|
||||
@@ -445,9 +443,9 @@ static Char *cmdp;
|
||||
void
|
||||
palloc(pid, t)
|
||||
int pid;
|
||||
struct command *t;
|
||||
register struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
int i;
|
||||
|
||||
pp = (struct process *) xcalloc(1, (size_t) sizeof(struct process));
|
||||
@@ -511,7 +509,7 @@ palloc(pid, t)
|
||||
|
||||
static void
|
||||
padd(t)
|
||||
struct command *t;
|
||||
register struct command *t;
|
||||
{
|
||||
Char **argp;
|
||||
|
||||
@@ -572,7 +570,7 @@ static void
|
||||
pads(cp)
|
||||
Char *cp;
|
||||
{
|
||||
int i;
|
||||
register int i;
|
||||
|
||||
/*
|
||||
* Avoid the Quoted Space alias hack! Reported by:
|
||||
@@ -628,7 +626,7 @@ prestjob()
|
||||
void
|
||||
pendjob()
|
||||
{
|
||||
struct process *pp, *tp;
|
||||
register struct process *pp, *tp;
|
||||
|
||||
if (pcurrjob && (pcurrjob->p_flags & (PFOREGND | PSTOPPED)) == 0) {
|
||||
pp = pcurrjob;
|
||||
@@ -650,10 +648,10 @@ pendjob()
|
||||
*/
|
||||
static int
|
||||
pprint(pp, flag)
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
bool flag;
|
||||
{
|
||||
int status, reason;
|
||||
register status, reason;
|
||||
struct process *tp;
|
||||
int jobflags, pstatus;
|
||||
bool hadnl = 1; /* did we just have a newline */
|
||||
@@ -816,13 +814,13 @@ prcomd:
|
||||
|
||||
static void
|
||||
ptprint(tp)
|
||||
struct process *tp;
|
||||
register struct process *tp;
|
||||
{
|
||||
struct timeval tetime, diff;
|
||||
static struct timeval ztime;
|
||||
struct rusage ru;
|
||||
static struct rusage zru;
|
||||
struct process *pp = tp;
|
||||
register struct process *pp = tp;
|
||||
|
||||
ru = zru;
|
||||
tetime = ztime;
|
||||
@@ -844,8 +842,8 @@ dojobs(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
int flag = NUMBER | NAME | REASON;
|
||||
register struct process *pp;
|
||||
register int flag = NUMBER | NAME | REASON;
|
||||
int i;
|
||||
|
||||
if (chkstop)
|
||||
@@ -874,7 +872,7 @@ dofg(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
|
||||
okpcntl();
|
||||
++v;
|
||||
@@ -894,7 +892,7 @@ dofg1(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
|
||||
okpcntl();
|
||||
pp = pfind(v[0]);
|
||||
@@ -911,7 +909,7 @@ dobg(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
|
||||
okpcntl();
|
||||
++v;
|
||||
@@ -930,7 +928,7 @@ dobg1(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
|
||||
pp = pfind(v[0]);
|
||||
pstart(pp, 0);
|
||||
@@ -957,8 +955,8 @@ dokill(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
int signum = SIGTERM;
|
||||
char *name;
|
||||
register int signum = SIGTERM;
|
||||
register char *name;
|
||||
|
||||
v++;
|
||||
if (v[0] && v[0][0] == '-') {
|
||||
@@ -1000,8 +998,8 @@ pkill(v, signum)
|
||||
Char **v;
|
||||
int signum;
|
||||
{
|
||||
struct process *pp, *np;
|
||||
int jobflags = 0;
|
||||
register struct process *pp, *np;
|
||||
register int jobflags = 0;
|
||||
int pid, err1 = 0;
|
||||
sigset_t omask;
|
||||
Char *cp;
|
||||
@@ -1083,10 +1081,10 @@ cont:
|
||||
*/
|
||||
void
|
||||
pstart(pp, foregnd)
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
int foregnd;
|
||||
{
|
||||
struct process *np;
|
||||
register struct process *np;
|
||||
sigset_t omask;
|
||||
long jobflags = 0;
|
||||
|
||||
@@ -1117,7 +1115,7 @@ void
|
||||
panystop(neednl)
|
||||
bool neednl;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
|
||||
chkstop = 2;
|
||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||
@@ -1129,7 +1127,7 @@ struct process *
|
||||
pfind(cp)
|
||||
Char *cp;
|
||||
{
|
||||
struct process *pp, *np;
|
||||
register struct process *pp, *np;
|
||||
|
||||
if (cp == 0 || cp[1] == 0 || eq(cp, STRcent2) || eq(cp, STRcentplus)) {
|
||||
if (pcurrent == NULL)
|
||||
@@ -1153,7 +1151,7 @@ pfind(cp)
|
||||
for (pp = proclist.p_next; pp; pp = pp->p_next)
|
||||
if (pp->p_pid == pp->p_jobid) {
|
||||
if (cp[1] == '?') {
|
||||
Char *dp;
|
||||
register Char *dp;
|
||||
|
||||
for (dp = pp->p_command; *dp; dp++) {
|
||||
if (*dp != cp[2])
|
||||
@@ -1171,7 +1169,7 @@ pfind(cp)
|
||||
}
|
||||
if (np)
|
||||
return (np);
|
||||
stderror(ERR_NAME | (cp[1] == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB));
|
||||
stderror(ERR_NAME | cp[1] == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB);
|
||||
/* NOTREACHED */
|
||||
return (0);
|
||||
}
|
||||
@@ -1182,10 +1180,10 @@ pfind(cp)
|
||||
*/
|
||||
static struct process *
|
||||
pgetcurr(pp)
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
{
|
||||
struct process *np;
|
||||
struct process *xp = NULL;
|
||||
register struct process *np;
|
||||
register struct process *xp = NULL;
|
||||
|
||||
for (np = proclist.p_next; np; np = np->p_next)
|
||||
if (np != pcurrent && np != pp && np->p_pid &&
|
||||
@@ -1207,7 +1205,7 @@ donotify(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct process *pp;
|
||||
register struct process *pp;
|
||||
|
||||
pp = pfind(*++v);
|
||||
pp->p_flags |= PNOTIFY;
|
||||
@@ -1230,7 +1228,7 @@ pfork(t, wanttty)
|
||||
struct command *t; /* command we are forking for */
|
||||
int wanttty;
|
||||
{
|
||||
int pid;
|
||||
register int pid;
|
||||
bool ignint = 0;
|
||||
int pgrp;
|
||||
sigset_t omask;
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)proc.h 8.1 (Berkeley) 5/31/93
|
||||
* $Id$
|
||||
* $Id: proc.h,v 1.2 1994/09/24 02:54:14 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
+9
-9
@@ -62,7 +62,7 @@ static void chkclob __P((char *));
|
||||
|
||||
void
|
||||
execute(t, wanttty, pipein, pipeout)
|
||||
struct command *t;
|
||||
register struct command *t;
|
||||
int wanttty, *pipein, *pipeout;
|
||||
{
|
||||
bool forked = 0;
|
||||
@@ -451,7 +451,7 @@ static void
|
||||
vffree(i)
|
||||
int i;
|
||||
{
|
||||
Char **v;
|
||||
register Char **v;
|
||||
|
||||
if ((v = gargv) != NULL) {
|
||||
gargv = 0;
|
||||
@@ -481,7 +481,7 @@ int i;
|
||||
*/
|
||||
static Char *
|
||||
splicepipe(t, cp)
|
||||
struct command *t;
|
||||
register struct command *t;
|
||||
Char *cp; /* word after < or > */
|
||||
{
|
||||
Char *blk[2];
|
||||
@@ -524,12 +524,12 @@ splicepipe(t, cp)
|
||||
*/
|
||||
static void
|
||||
doio(t, pipein, pipeout)
|
||||
struct command *t;
|
||||
register struct command *t;
|
||||
int *pipein, *pipeout;
|
||||
{
|
||||
int fd;
|
||||
Char *cp;
|
||||
int flags = t->t_dflg;
|
||||
register int fd;
|
||||
register Char *cp;
|
||||
register int flags = t->t_dflg;
|
||||
|
||||
if (didfds || (flags & F_REPEAT))
|
||||
return;
|
||||
@@ -620,7 +620,7 @@ doio(t, pipein, pipeout)
|
||||
|
||||
void
|
||||
mypipe(pv)
|
||||
int *pv;
|
||||
register int *pv;
|
||||
{
|
||||
|
||||
if (pipe(pv) < 0)
|
||||
@@ -635,7 +635,7 @@ oops:
|
||||
|
||||
static void
|
||||
chkclob(cp)
|
||||
char *cp;
|
||||
register char *cp;
|
||||
{
|
||||
struct stat stb;
|
||||
|
||||
|
||||
+45
-46
@@ -47,7 +47,6 @@ static char sccsid[] = "@(#)set.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#include "csh.h"
|
||||
#include "extern.h"
|
||||
@@ -76,7 +75,7 @@ doset(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *p;
|
||||
register Char *p;
|
||||
Char *vp, op;
|
||||
Char **vecp;
|
||||
bool hadsub;
|
||||
@@ -117,7 +116,7 @@ doset(v, t)
|
||||
if (op && op != '=')
|
||||
stderror(ERR_NAME | ERR_SYNTAX);
|
||||
if (eq(p, STRLparen)) {
|
||||
Char **e = v;
|
||||
register Char **e = v;
|
||||
|
||||
if (hadsub)
|
||||
stderror(ERR_NAME | ERR_SYNTAX);
|
||||
@@ -144,7 +143,7 @@ doset(v, t)
|
||||
dohash(NULL, NULL);
|
||||
}
|
||||
else if (eq(vp, STRhistchars)) {
|
||||
Char *pn = value(STRhistchars);
|
||||
register Char *pn = value(STRhistchars);
|
||||
|
||||
HIST = *pn++;
|
||||
HISTSUB = *pn;
|
||||
@@ -159,7 +158,7 @@ doset(v, t)
|
||||
else if (eq(vp, STRterm))
|
||||
Setenv(STRTERM, value(vp));
|
||||
else if (eq(vp, STRhome)) {
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
|
||||
cp = Strsave(value(vp)); /* get the old value back */
|
||||
|
||||
@@ -185,8 +184,8 @@ doset(v, t)
|
||||
|
||||
static Char *
|
||||
getinx(cp, ip)
|
||||
Char *cp;
|
||||
int *ip;
|
||||
register Char *cp;
|
||||
register int *ip;
|
||||
{
|
||||
|
||||
*ip = 0;
|
||||
@@ -204,7 +203,7 @@ asx(vp, subscr, p)
|
||||
int subscr;
|
||||
Char *p;
|
||||
{
|
||||
struct varent *v = getvx(vp, subscr);
|
||||
register struct varent *v = getvx(vp, subscr);
|
||||
|
||||
xfree((ptr_t) v->vec[subscr - 1]);
|
||||
v->vec[subscr - 1] = globone(p, G_APPEND);
|
||||
@@ -215,7 +214,7 @@ getvx(vp, subscr)
|
||||
Char *vp;
|
||||
int subscr;
|
||||
{
|
||||
struct varent *v = adrof(vp);
|
||||
register struct varent *v = adrof(vp);
|
||||
|
||||
if (v == 0)
|
||||
udvar(vp);
|
||||
@@ -230,7 +229,7 @@ dolet(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *p;
|
||||
register Char *p;
|
||||
Char *vp, c, op;
|
||||
bool hadsub;
|
||||
int subscr;
|
||||
@@ -315,7 +314,7 @@ static Char *
|
||||
xset(cp, vp)
|
||||
Char *cp, ***vp;
|
||||
{
|
||||
Char *dp;
|
||||
register Char *dp;
|
||||
|
||||
if (*cp) {
|
||||
dp = Strsave(cp);
|
||||
@@ -333,9 +332,9 @@ operate(op, vp, p)
|
||||
{
|
||||
Char opr[2];
|
||||
Char *vec[5];
|
||||
Char **v = vec;
|
||||
register Char **v = vec;
|
||||
Char **vecp = v;
|
||||
int i;
|
||||
register int i;
|
||||
|
||||
if (op != '=') {
|
||||
if (*vp)
|
||||
@@ -358,7 +357,7 @@ static Char *putp;
|
||||
|
||||
Char *
|
||||
putn(n)
|
||||
int n;
|
||||
register int n;
|
||||
{
|
||||
int num;
|
||||
static Char number[15];
|
||||
@@ -391,7 +390,7 @@ putn(n)
|
||||
|
||||
static void
|
||||
putn1(n)
|
||||
int n;
|
||||
register int n;
|
||||
{
|
||||
if (n > 9)
|
||||
putn1(n / 10);
|
||||
@@ -400,9 +399,9 @@ putn1(n)
|
||||
|
||||
int
|
||||
getn(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
int n;
|
||||
register int n;
|
||||
int sign;
|
||||
|
||||
sign = 0;
|
||||
@@ -427,7 +426,7 @@ value1(var, head)
|
||||
Char *var;
|
||||
struct varent *head;
|
||||
{
|
||||
struct varent *vp;
|
||||
register struct varent *vp;
|
||||
|
||||
vp = adrof1(var, head);
|
||||
return (vp == 0 || vp->vec[0] == 0 ? STRNULL : vp->vec[0]);
|
||||
@@ -436,9 +435,9 @@ value1(var, head)
|
||||
static struct varent *
|
||||
madrof(pat, vp)
|
||||
Char *pat;
|
||||
struct varent *vp;
|
||||
register struct varent *vp;
|
||||
{
|
||||
struct varent *vp1;
|
||||
register struct varent *vp1;
|
||||
|
||||
for (; vp; vp = vp->v_right) {
|
||||
if (vp->v_left && (vp1 = madrof(pat, vp->v_left)))
|
||||
@@ -451,10 +450,10 @@ madrof(pat, vp)
|
||||
|
||||
struct varent *
|
||||
adrof1(name, v)
|
||||
Char *name;
|
||||
struct varent *v;
|
||||
register Char *name;
|
||||
register struct varent *v;
|
||||
{
|
||||
int cmp;
|
||||
register cmp;
|
||||
|
||||
v = v->v_left;
|
||||
while (v && ((cmp = *name - *v->v_name) ||
|
||||
@@ -473,7 +472,7 @@ void
|
||||
set(var, val)
|
||||
Char *var, *val;
|
||||
{
|
||||
Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||
register Char **vec = (Char **) xmalloc((size_t) (2 * sizeof(Char **)));
|
||||
|
||||
vec[0] = val;
|
||||
vec[1] = 0;
|
||||
@@ -485,7 +484,7 @@ set1(var, vec, head)
|
||||
Char *var, **vec;
|
||||
struct varent *head;
|
||||
{
|
||||
Char **oldv = vec;
|
||||
register Char **oldv = vec;
|
||||
|
||||
gflag = 0;
|
||||
tglob(oldv);
|
||||
@@ -506,10 +505,10 @@ set1(var, vec, head)
|
||||
void
|
||||
setq(name, vec, p)
|
||||
Char *name, **vec;
|
||||
struct varent *p;
|
||||
register struct varent *p;
|
||||
{
|
||||
struct varent *c;
|
||||
int f;
|
||||
register struct varent *c;
|
||||
register f;
|
||||
|
||||
f = 0; /* tree hangs off the header's left link */
|
||||
while ((c = p->v_link[f]) != NULL) {
|
||||
@@ -552,11 +551,11 @@ unset(v, t)
|
||||
|
||||
void
|
||||
unset1(v, head)
|
||||
Char *v[];
|
||||
register Char *v[];
|
||||
struct varent *head;
|
||||
{
|
||||
struct varent *vp;
|
||||
int cnt;
|
||||
register struct varent *vp;
|
||||
register int cnt;
|
||||
|
||||
while (*++v) {
|
||||
cnt = 0;
|
||||
@@ -571,7 +570,7 @@ void
|
||||
unsetv(var)
|
||||
Char *var;
|
||||
{
|
||||
struct varent *vp;
|
||||
register struct varent *vp;
|
||||
|
||||
if ((vp = adrof1(var, &shvhed)) == 0)
|
||||
udvar(var);
|
||||
@@ -580,10 +579,10 @@ unsetv(var)
|
||||
|
||||
static void
|
||||
unsetv1(p)
|
||||
struct varent *p;
|
||||
register struct varent *p;
|
||||
{
|
||||
struct varent *c, *pp;
|
||||
int f;
|
||||
register struct varent *c, *pp;
|
||||
register f;
|
||||
|
||||
/*
|
||||
* Free associated memory first to avoid complications.
|
||||
@@ -634,8 +633,8 @@ shift(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
struct varent *argv;
|
||||
Char *name;
|
||||
register struct varent *argv;
|
||||
register Char *name;
|
||||
|
||||
v++;
|
||||
name = *v;
|
||||
@@ -666,7 +665,7 @@ exportpath(val)
|
||||
break;
|
||||
}
|
||||
if (**val != '/' && (euid == 0 || uid == 0) &&
|
||||
(intact || (intty && isatty(SHOUT))))
|
||||
(intact || intty && isatty(SHOUT)))
|
||||
(void) fprintf(csherr,
|
||||
"Warning: exported path contains relative components.\n");
|
||||
(void) Strcat(exppath, *val++);
|
||||
@@ -718,16 +717,16 @@ rright(p)
|
||||
*/
|
||||
static void
|
||||
balance(p, f, d)
|
||||
struct varent *p;
|
||||
int f, d;
|
||||
register struct varent *p;
|
||||
register int f, d;
|
||||
{
|
||||
struct varent *pp;
|
||||
register struct varent *pp;
|
||||
|
||||
#ifndef lint
|
||||
struct varent *t; /* used by the rotate macros */
|
||||
register struct varent *t; /* used by the rotate macros */
|
||||
|
||||
#endif
|
||||
int ff;
|
||||
register ff;
|
||||
|
||||
/*
|
||||
* Ok, from here on, p is the node we're operating on; pp is it's parent; f
|
||||
@@ -813,10 +812,10 @@ balance(p, f, d)
|
||||
|
||||
void
|
||||
plist(p)
|
||||
struct varent *p;
|
||||
register struct varent *p;
|
||||
{
|
||||
struct varent *c;
|
||||
int len;
|
||||
register struct varent *c;
|
||||
register len;
|
||||
|
||||
if (setintr)
|
||||
(void) sigsetmask(sigblock((sigset_t) 0) & ~sigmask(SIGINT));
|
||||
|
||||
+35
-35
@@ -59,10 +59,10 @@ static char sccsid[] = "@(#)str.c 8.1 (Berkeley) 5/31/93";
|
||||
|
||||
Char **
|
||||
blk2short(src)
|
||||
char **src;
|
||||
register char **src;
|
||||
{
|
||||
size_t n;
|
||||
Char **sdst, **dst;
|
||||
register Char **sdst, **dst;
|
||||
|
||||
/*
|
||||
* Count
|
||||
@@ -79,10 +79,10 @@ blk2short(src)
|
||||
|
||||
char **
|
||||
short2blk(src)
|
||||
Char **src;
|
||||
register Char **src;
|
||||
{
|
||||
size_t n;
|
||||
char **sdst, **dst;
|
||||
register char **sdst, **dst;
|
||||
|
||||
/*
|
||||
* Count
|
||||
@@ -99,11 +99,11 @@ short2blk(src)
|
||||
|
||||
Char *
|
||||
str2short(src)
|
||||
char *src;
|
||||
register char *src;
|
||||
{
|
||||
static Char *sdst;
|
||||
static size_t dstsize = 0;
|
||||
Char *dst, *edst;
|
||||
register Char *dst, *edst;
|
||||
|
||||
if (src == NULL)
|
||||
return (NULL);
|
||||
@@ -131,11 +131,11 @@ str2short(src)
|
||||
|
||||
char *
|
||||
short2str(src)
|
||||
Char *src;
|
||||
register Char *src;
|
||||
{
|
||||
static char *sdst = NULL;
|
||||
static size_t dstsize = 0;
|
||||
char *dst, *edst;
|
||||
register char *dst, *edst;
|
||||
|
||||
if (src == NULL)
|
||||
return (NULL);
|
||||
@@ -162,9 +162,9 @@ short2str(src)
|
||||
|
||||
Char *
|
||||
s_strcpy(dst, src)
|
||||
Char *dst, *src;
|
||||
register Char *dst, *src;
|
||||
{
|
||||
Char *sdst;
|
||||
register Char *sdst;
|
||||
|
||||
sdst = dst;
|
||||
while ((*dst++ = *src++) != '\0')
|
||||
@@ -174,10 +174,10 @@ s_strcpy(dst, src)
|
||||
|
||||
Char *
|
||||
s_strncpy(dst, src, n)
|
||||
Char *dst, *src;
|
||||
size_t n;
|
||||
register Char *dst, *src;
|
||||
register size_t n;
|
||||
{
|
||||
Char *sdst;
|
||||
register Char *sdst;
|
||||
|
||||
if (n == 0)
|
||||
return(dst);
|
||||
@@ -195,9 +195,9 @@ s_strncpy(dst, src, n)
|
||||
|
||||
Char *
|
||||
s_strcat(dst, src)
|
||||
Char *dst, *src;
|
||||
register Char *dst, *src;
|
||||
{
|
||||
short *sdst;
|
||||
register short *sdst;
|
||||
|
||||
sdst = dst;
|
||||
while (*dst++)
|
||||
@@ -211,10 +211,10 @@ s_strcat(dst, src)
|
||||
#ifdef NOTUSED
|
||||
Char *
|
||||
s_strncat(dst, src, n)
|
||||
Char *dst, *src;
|
||||
size_t n;
|
||||
register Char *dst, *src;
|
||||
register size_t n;
|
||||
{
|
||||
Char *sdst;
|
||||
register Char *sdst;
|
||||
|
||||
if (n == 0)
|
||||
return (dst);
|
||||
@@ -239,7 +239,7 @@ s_strncat(dst, src, n)
|
||||
|
||||
Char *
|
||||
s_strchr(str, ch)
|
||||
Char *str;
|
||||
register Char *str;
|
||||
int ch;
|
||||
{
|
||||
do
|
||||
@@ -251,10 +251,10 @@ s_strchr(str, ch)
|
||||
|
||||
Char *
|
||||
s_strrchr(str, ch)
|
||||
Char *str;
|
||||
register Char *str;
|
||||
int ch;
|
||||
{
|
||||
Char *rstr;
|
||||
register Char *rstr;
|
||||
|
||||
rstr = NULL;
|
||||
do
|
||||
@@ -266,9 +266,9 @@ s_strrchr(str, ch)
|
||||
|
||||
size_t
|
||||
s_strlen(str)
|
||||
Char *str;
|
||||
register Char *str;
|
||||
{
|
||||
size_t n;
|
||||
register size_t n;
|
||||
|
||||
for (n = 0; *str++; n++)
|
||||
continue;
|
||||
@@ -277,7 +277,7 @@ s_strlen(str)
|
||||
|
||||
int
|
||||
s_strcmp(str1, str2)
|
||||
Char *str1, *str2;
|
||||
register Char *str1, *str2;
|
||||
{
|
||||
for (; *str1 && *str1 == *str2; str1++, str2++)
|
||||
continue;
|
||||
@@ -298,8 +298,8 @@ s_strcmp(str1, str2)
|
||||
|
||||
int
|
||||
s_strncmp(str1, str2, n)
|
||||
Char *str1, *str2;
|
||||
size_t n;
|
||||
register Char *str1, *str2;
|
||||
register size_t n;
|
||||
{
|
||||
if (n == 0)
|
||||
return (0);
|
||||
@@ -327,10 +327,10 @@ s_strncmp(str1, str2, n)
|
||||
|
||||
Char *
|
||||
s_strsave(s)
|
||||
Char *s;
|
||||
register Char *s;
|
||||
{
|
||||
Char *n;
|
||||
Char *p;
|
||||
register Char *p;
|
||||
|
||||
if (s == 0)
|
||||
s = STRNULL;
|
||||
@@ -347,7 +347,7 @@ s_strspl(cp, dp)
|
||||
Char *cp, *dp;
|
||||
{
|
||||
Char *ep;
|
||||
Char *p, *q;
|
||||
register Char *p, *q;
|
||||
|
||||
if (!cp)
|
||||
cp = STRNULL;
|
||||
@@ -368,7 +368,7 @@ s_strspl(cp, dp)
|
||||
|
||||
Char *
|
||||
s_strend(cp)
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
{
|
||||
if (!cp)
|
||||
return (cp);
|
||||
@@ -379,11 +379,11 @@ s_strend(cp)
|
||||
|
||||
Char *
|
||||
s_strstr(s, t)
|
||||
Char *s, *t;
|
||||
register Char *s, *t;
|
||||
{
|
||||
do {
|
||||
Char *ss = s;
|
||||
Char *tt = t;
|
||||
register Char *ss = s;
|
||||
register Char *tt = t;
|
||||
|
||||
do
|
||||
if (*tt == '\0')
|
||||
@@ -396,11 +396,11 @@ s_strstr(s, t)
|
||||
|
||||
char *
|
||||
short2qstr(src)
|
||||
Char *src;
|
||||
register Char *src;
|
||||
{
|
||||
static char *sdst = NULL;
|
||||
static size_t dstsize = 0;
|
||||
char *dst, *edst;
|
||||
register char *dst, *edst;
|
||||
|
||||
if (src == NULL)
|
||||
return (NULL);
|
||||
|
||||
+9
-9
@@ -92,7 +92,7 @@ donice(v, t)
|
||||
Char **v;
|
||||
struct command *t;
|
||||
{
|
||||
Char *cp;
|
||||
register Char *cp;
|
||||
int nval = 0;
|
||||
|
||||
v++, cp = *v++;
|
||||
@@ -105,7 +105,7 @@ donice(v, t)
|
||||
|
||||
void
|
||||
ruadd(ru, ru2)
|
||||
struct rusage *ru, *ru2;
|
||||
register struct rusage *ru, *ru2;
|
||||
{
|
||||
tvadd(&ru->ru_utime, &ru2->ru_utime);
|
||||
tvadd(&ru->ru_stime, &ru2->ru_stime);
|
||||
@@ -129,17 +129,17 @@ ruadd(ru, ru2)
|
||||
|
||||
void
|
||||
prusage(r0, r1, e, b)
|
||||
struct rusage *r0, *r1;
|
||||
register struct rusage *r0, *r1;
|
||||
struct timeval *e, *b;
|
||||
{
|
||||
time_t t =
|
||||
register time_t t =
|
||||
(r1->ru_utime.tv_sec - r0->ru_utime.tv_sec) * 100 +
|
||||
(r1->ru_utime.tv_usec - r0->ru_utime.tv_usec) / 10000 +
|
||||
(r1->ru_stime.tv_sec - r0->ru_stime.tv_sec) * 100 +
|
||||
(r1->ru_stime.tv_usec - r0->ru_stime.tv_usec) / 10000;
|
||||
char *cp;
|
||||
long i;
|
||||
struct varent *vp = adrof(STRtime);
|
||||
register char *cp;
|
||||
register long i;
|
||||
register struct varent *vp = adrof(STRtime);
|
||||
|
||||
int ms =
|
||||
(e->tv_sec - b->tv_sec) * 100 + (e->tv_usec - b->tv_usec) / 10000;
|
||||
@@ -277,7 +277,7 @@ void
|
||||
psecs(l)
|
||||
long l;
|
||||
{
|
||||
int i;
|
||||
register int i;
|
||||
|
||||
i = l / 3600;
|
||||
if (i) {
|
||||
@@ -298,7 +298,7 @@ void
|
||||
pcsecs(l) /* PWP: print mm:ss.dd, l is in sec*100 */
|
||||
long l;
|
||||
{
|
||||
int i;
|
||||
register int i;
|
||||
|
||||
i = l / 360000;
|
||||
if (i) {
|
||||
|
||||
+1
-2
@@ -2,8 +2,7 @@
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:54:33 davidg Exp $
|
||||
|
||||
PROG= date
|
||||
SRCS= date.c netdate.c vary.c
|
||||
CFLAGS+=-Wall
|
||||
SRCS= date.c netdate.c
|
||||
DPADD= ${LIBUTIL}
|
||||
LDADD= -lutil
|
||||
|
||||
|
||||
+9
-93
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)date.1 8.3 (Berkeley) 4/28/95
|
||||
.\" $Id: date.1,v 1.8.2.6 1997/10/03 12:54:28 danny Exp $
|
||||
.\" $Id: date.1,v 1.8.2.1 1997/02/28 07:54:32 mpp Exp $
|
||||
.\"
|
||||
.Dd November 17, 1993
|
||||
.Dt DATE 1
|
||||
@@ -43,14 +43,12 @@
|
||||
.Nd display or set date and time
|
||||
.Sh SYNOPSIS
|
||||
.Nm date
|
||||
.Op Fl nu
|
||||
.Op Fl d Ar dst
|
||||
.Op Fl r Ar seconds
|
||||
.Op Fl t Ar minutes_west
|
||||
.Op Fl v Ns Ar [+|-]val Ns Op ymwdHM
|
||||
.Ar ...
|
||||
.Op Fl f Ar fmt Ar date | [[[[yy]mm]dd]HH]MM[\&.ss]
|
||||
.Op Fl nu
|
||||
.Op Cm + Ns Ar format
|
||||
.Op [yy[mm[dd[hh]]]]mm[\&.ss]
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
displays the current date and time when invoked without arguments.
|
||||
@@ -69,14 +67,6 @@ to
|
||||
.Xr gettimeofday 2
|
||||
will return a non-zero
|
||||
.Ql tz_dsttime .
|
||||
.It Fl f
|
||||
Use
|
||||
.Ar fmt
|
||||
as the format string to parse the date provided rather than using
|
||||
the default
|
||||
.Ar [[[[yy]mm]dd]HH]MM[.ss]
|
||||
format. Parsing is done using
|
||||
.Xr strptime 3 .
|
||||
.It Fl n
|
||||
The utility
|
||||
.Xr timed 8
|
||||
@@ -107,40 +97,6 @@ by future calls to
|
||||
Display or set the date in
|
||||
.Tn UCT
|
||||
(universal) time.
|
||||
.It Fl v
|
||||
Adjust the minute, hour, month day, week day, month or year according to
|
||||
.Ar val .
|
||||
If
|
||||
.Ar val
|
||||
is preceeded with a plus or minus sign, the date is adjusted forwards
|
||||
or backwards according to the remaining string, otherwise the relevant
|
||||
part of the date is set. The date can be adjusted as many times as
|
||||
required using these flags. Flags are processed in the order given.
|
||||
.Pp
|
||||
Minutes are in the range 0-59, hours are in the range 1-12, month days
|
||||
are in the range 1-31, week days are in the range 0-6 (sun-sat), months
|
||||
are in the range 1-12 (jan-dec) and years are in the range 80-38 or
|
||||
1980-2038.
|
||||
.Pp
|
||||
If
|
||||
.Ar val
|
||||
is numeric, one of either
|
||||
.Ar y ,
|
||||
.Ar m ,
|
||||
.Ar w ,
|
||||
.Ar d ,
|
||||
.Ar H
|
||||
or
|
||||
.Ar M
|
||||
must be used to specify which part of the date is to be adjusted.
|
||||
.Pp
|
||||
The week day or month may be specified using a name rather than a
|
||||
number. If a name is used with the plus (or minus) sign, the date
|
||||
will be put forwards (or backwards) to the next (previous) date that
|
||||
matches the given week day or month. This will not adjust the date
|
||||
if the given week day or month is the same as the current one.
|
||||
.Pp
|
||||
Refer to the examples below for further details.
|
||||
.El
|
||||
.Pp
|
||||
An operand with a leading plus (``+'') sign signals a user-defined format
|
||||
@@ -162,15 +118,15 @@ The canonical representation for setting the date and time is:
|
||||
.Pp
|
||||
.Bl -tag -width Ds -compact -offset indent
|
||||
.It Ar yy
|
||||
Year in abbreviated form (e.g. 89 for 1989, 06 for 2006).
|
||||
Year in abbreviated form (.e.g 89 for 1989).
|
||||
.It Ar mm
|
||||
Numeric month.
|
||||
A number from 1 to 12.
|
||||
.It Ar dd
|
||||
Day, a number from 1 to 31.
|
||||
.It Ar HH
|
||||
.It Ar hh
|
||||
Hour, a number from 0 to 23.
|
||||
.It Ar MM
|
||||
.It Ar mm
|
||||
Minutes, a number from 0 to 59.
|
||||
.It Ar .ss
|
||||
Seconds, a number from 0 to 61 (59 plus a maximum of two leap seconds).
|
||||
@@ -183,51 +139,17 @@ and years are handled automatically.
|
||||
.Sh EXAMPLES
|
||||
The command:
|
||||
.Bd -literal -offset indent
|
||||
date "+DATE: 19%y-%m-%d%nTIME: %H:%M:%S"
|
||||
date ``+DATE: %m/%d/%y%nTIME: %H:%M:%S''
|
||||
.Ed
|
||||
.Pp
|
||||
will display:
|
||||
.Bd -literal -offset indent
|
||||
DATE: 1987-11-21
|
||||
DATE: 11/21/87
|
||||
TIME: 13:36:16
|
||||
.Ed
|
||||
.Pp
|
||||
The command:
|
||||
.Bd -literal -offset indent
|
||||
date -v1m -v+1y
|
||||
.Ed
|
||||
.Pp
|
||||
will display:
|
||||
.Bd -literal -offset indent
|
||||
Sun Jan 4 03:15:24 GMT 1998
|
||||
.Ed
|
||||
.Pp
|
||||
(where it is currently Mon Aug 4 04:15:24 BST 1997).
|
||||
.Pp
|
||||
The command:
|
||||
.Bd -literal -offset indent
|
||||
date -v1d -v3m -v0y -v-1d
|
||||
.Ed
|
||||
.Pp
|
||||
will display the last day of February in the year 2000:
|
||||
.Bd -literal -offset indent
|
||||
Tue Feb 29 03:18:00 GMT 2000
|
||||
.Ed
|
||||
.Pp
|
||||
The command:
|
||||
.Bd -literal -offset indent
|
||||
date -v1d -v+1m -v-1d -v-fri
|
||||
.Ed
|
||||
.Pp
|
||||
will display the last friday of the month:
|
||||
.Bd -literal -offset indent
|
||||
Fri Aug 29 04:31:11 BST 1997
|
||||
.Ed
|
||||
.Pp
|
||||
(where it is currently Mon Aug 4 04:31:11 BST 1997).
|
||||
.Pp
|
||||
The command:
|
||||
.Bd -literal -offset indent
|
||||
date 8506131627
|
||||
.Ed
|
||||
.Pp
|
||||
@@ -245,15 +167,10 @@ without modifying the date.
|
||||
.Sh ENVIRONMENT VARIABLES
|
||||
The execution of
|
||||
.Nm
|
||||
is affected by the following environment variables:
|
||||
is affected by the following evironment variables:
|
||||
.Bl -tag -width Ds
|
||||
.It Ev TZ
|
||||
The timezone to use when displaying dates.
|
||||
The normal format is a pathname relative to
|
||||
.Dq Pa /usr/share/zoneinfo .
|
||||
For example, the command
|
||||
.Dq TZ=America/Los_Angeles date
|
||||
displays the current time in California.
|
||||
See
|
||||
.Xr environ 7
|
||||
for more information.
|
||||
@@ -268,7 +185,6 @@ A record of the user setting the time.
|
||||
.Sh SEE ALSO
|
||||
.Xr gettimeofday 2 ,
|
||||
.Xr strftime 3 ,
|
||||
.Xr strptime 3 ,
|
||||
.Xr utmp 5 ,
|
||||
.Xr timed 8
|
||||
.Rs
|
||||
|
||||
+66
-105
@@ -30,17 +30,17 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: date.c,v 1.7.2.6 1997/10/03 12:54:30 danny Exp $
|
||||
* $Id: date.c,v 1.7 1996/04/06 01:42:09 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const copyright[] =
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1985, 1987, 1988, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95";
|
||||
static char sccsid[] = "@(#)date.c 8.1 (Berkeley) 5/31/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -57,12 +57,11 @@ static char const sccsid[] = "@(#)date.c 8.2 (Berkeley) 4/28/95";
|
||||
#include <locale.h>
|
||||
|
||||
#include "extern.h"
|
||||
#include "vary.h"
|
||||
|
||||
time_t tval;
|
||||
int retval, nflag;
|
||||
|
||||
static void setthetime __P((const char *, const char *));
|
||||
static void setthetime __P((char *));
|
||||
static void badformat __P((void));
|
||||
static void usage __P((void));
|
||||
|
||||
@@ -78,19 +77,14 @@ main(argc, argv)
|
||||
struct timezone tz;
|
||||
int ch, rflag;
|
||||
char *format, buf[1024];
|
||||
char *endptr, *fmt;
|
||||
char *endptr;
|
||||
int set_timezone;
|
||||
struct vary *v;
|
||||
const struct vary *badv;
|
||||
struct tm lt;
|
||||
|
||||
v = NULL;
|
||||
fmt = NULL;
|
||||
(void) setlocale(LC_TIME, "");
|
||||
tz.tz_dsttime = tz.tz_minuteswest = 0;
|
||||
rflag = 0;
|
||||
set_timezone = 0;
|
||||
while ((ch = getopt(argc, argv, "d:f:nr:t:uv:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "d:nr:ut:")) != EOF)
|
||||
switch((char)ch) {
|
||||
case 'd': /* daylight savings time */
|
||||
tz.tz_dsttime = strtol(optarg, &endptr, 10) ? 1 : 0;
|
||||
@@ -98,9 +92,6 @@ main(argc, argv)
|
||||
usage();
|
||||
set_timezone = 1;
|
||||
break;
|
||||
case 'f':
|
||||
fmt = optarg;
|
||||
break;
|
||||
case 'n': /* don't set network */
|
||||
nflag = 1;
|
||||
break;
|
||||
@@ -108,6 +99,9 @@ main(argc, argv)
|
||||
rflag = 1;
|
||||
tval = atol(optarg);
|
||||
break;
|
||||
case 'u': /* do everything in GMT */
|
||||
(void)setenv("TZ", "GMT0", 1);
|
||||
break;
|
||||
case 't': /* minutes west of GMT */
|
||||
/* error check; don't allow "PST" */
|
||||
tz.tz_minuteswest = strtol(optarg, &endptr, 10);
|
||||
@@ -115,12 +109,6 @@ main(argc, argv)
|
||||
usage();
|
||||
set_timezone = 1;
|
||||
break;
|
||||
case 'u': /* do everything in GMT */
|
||||
(void)setenv("TZ", "GMT0", 1);
|
||||
break;
|
||||
case 'v':
|
||||
v = vary_append(v, optarg);
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@@ -129,7 +117,7 @@ main(argc, argv)
|
||||
|
||||
/*
|
||||
* If -d or -t, set the timezone or daylight savings time; this
|
||||
* doesn't belong here; the kernel should not know about either.
|
||||
* doesn't belong here, there kernel should not know about either.
|
||||
*/
|
||||
if (set_timezone && settimeofday((struct timeval *)NULL, &tz))
|
||||
err(1, "settimeofday (timezone)");
|
||||
@@ -146,104 +134,78 @@ main(argc, argv)
|
||||
}
|
||||
|
||||
if (*argv) {
|
||||
setthetime(fmt, *argv);
|
||||
setthetime(*argv);
|
||||
++argv;
|
||||
} else if (fmt != NULL)
|
||||
usage();
|
||||
}
|
||||
|
||||
if (*argv && **argv == '+')
|
||||
format = *argv + 1;
|
||||
|
||||
lt = *localtime(&tval);
|
||||
badv = vary_apply(v, <);
|
||||
if (badv) {
|
||||
fprintf(stderr, "%s: Cannot apply date adjustment\n",
|
||||
badv->arg);
|
||||
vary_destroy(v);
|
||||
usage();
|
||||
}
|
||||
vary_destroy(v);
|
||||
(void)strftime(buf, sizeof(buf), format, <);
|
||||
(void)strftime(buf, sizeof(buf), format, localtime(&tval));
|
||||
(void)printf("%s\n", buf);
|
||||
exit(retval);
|
||||
}
|
||||
|
||||
#define ATOI2(ar) ((ar)[0] - '0') * 10 + ((ar)[1] - '0'); (ar) += 2;
|
||||
void
|
||||
setthetime(fmt, p)
|
||||
const char *fmt;
|
||||
register const char *p;
|
||||
setthetime(p)
|
||||
register char *p;
|
||||
{
|
||||
register struct tm *lt;
|
||||
struct timeval tv;
|
||||
const char *dot, *t;
|
||||
char *dot, *t;
|
||||
|
||||
if (fmt != NULL) {
|
||||
lt = localtime(&tval);
|
||||
t = strptime(p, fmt, lt);
|
||||
if (t == NULL) {
|
||||
fprintf(stderr, "Failed conversion of ``%s''"
|
||||
" using format ``%s''\n", p, fmt);
|
||||
lt = localtime(&tval);
|
||||
return;
|
||||
} else if (*t != '\0')
|
||||
fprintf(stderr, "Warning: Ignoring %ld extraneous"
|
||||
" characters in date string (%s)\n",
|
||||
(long) strlen(t), t);
|
||||
} else {
|
||||
for (t = p, dot = NULL; *t; ++t) {
|
||||
if (isdigit(*t))
|
||||
continue;
|
||||
if (*t == '.' && dot == NULL) {
|
||||
dot = t;
|
||||
continue;
|
||||
}
|
||||
badformat();
|
||||
for (t = p, dot = NULL; *t; ++t) {
|
||||
if (isdigit(*t))
|
||||
continue;
|
||||
if (*t == '.' && dot == NULL) {
|
||||
dot = t;
|
||||
continue;
|
||||
}
|
||||
badformat();
|
||||
}
|
||||
|
||||
lt = localtime(&tval);
|
||||
lt = localtime(&tval);
|
||||
|
||||
if (dot != NULL) { /* .ss */
|
||||
dot++; /* *dot++ = '\0'; */
|
||||
if (strlen(dot) != 2)
|
||||
badformat();
|
||||
lt->tm_sec = ATOI2(dot);
|
||||
if (lt->tm_sec > 61)
|
||||
badformat();
|
||||
} else
|
||||
lt->tm_sec = 0;
|
||||
|
||||
/* if p has a ".ss" field then let's pretend it's not there */
|
||||
switch (strlen(p) - ((dot != NULL) ? 3 : 0)) {
|
||||
case 10: /* yy */
|
||||
lt->tm_year = ATOI2(p);
|
||||
if (lt->tm_year < 69) /* hack for 2000 ;-} */
|
||||
lt->tm_year += 100;
|
||||
/* FALLTHROUGH */
|
||||
case 8: /* mm */
|
||||
lt->tm_mon = ATOI2(p);
|
||||
if (lt->tm_mon > 12)
|
||||
badformat();
|
||||
--lt->tm_mon; /* time struct is 0 - 11 */
|
||||
/* FALLTHROUGH */
|
||||
case 6: /* dd */
|
||||
lt->tm_mday = ATOI2(p);
|
||||
if (lt->tm_mday > 31)
|
||||
badformat();
|
||||
/* FALLTHROUGH */
|
||||
case 4: /* HH */
|
||||
lt->tm_hour = ATOI2(p);
|
||||
if (lt->tm_hour > 23)
|
||||
badformat();
|
||||
/* FALLTHROUGH */
|
||||
case 2: /* MM */
|
||||
lt->tm_min = ATOI2(p);
|
||||
if (lt->tm_min > 59)
|
||||
badformat();
|
||||
break;
|
||||
default:
|
||||
if (dot != NULL) { /* .ss */
|
||||
*dot++ = '\0';
|
||||
if (strlen(dot) != 2)
|
||||
badformat();
|
||||
}
|
||||
lt->tm_sec = ATOI2(dot);
|
||||
if (lt->tm_sec > 61)
|
||||
badformat();
|
||||
} else
|
||||
lt->tm_sec = 0;
|
||||
|
||||
switch (strlen(p)) {
|
||||
case 10: /* yy */
|
||||
lt->tm_year = ATOI2(p);
|
||||
if (lt->tm_year < 69) /* hack for 2000 ;-} */
|
||||
lt->tm_year += 100;
|
||||
/* FALLTHROUGH */
|
||||
case 8: /* mm */
|
||||
lt->tm_mon = ATOI2(p);
|
||||
if (lt->tm_mon > 12)
|
||||
badformat();
|
||||
--lt->tm_mon; /* time struct is 0 - 11 */
|
||||
/* FALLTHROUGH */
|
||||
case 6: /* dd */
|
||||
lt->tm_mday = ATOI2(p);
|
||||
if (lt->tm_mday > 31)
|
||||
badformat();
|
||||
/* FALLTHROUGH */
|
||||
case 4: /* hh */
|
||||
lt->tm_hour = ATOI2(p);
|
||||
if (lt->tm_hour > 23)
|
||||
badformat();
|
||||
/* FALLTHROUGH */
|
||||
case 2: /* mm */
|
||||
lt->tm_min = ATOI2(p);
|
||||
if (lt->tm_min > 59)
|
||||
badformat();
|
||||
break;
|
||||
default:
|
||||
badformat();
|
||||
}
|
||||
|
||||
/* convert broken-down time to GMT clock time */
|
||||
@@ -275,9 +237,8 @@ badformat()
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "%s\n%s\n",
|
||||
"usage: date [-nu] [-d dst] [-r seconds] [-t west] "
|
||||
"[-v[+|-]val[ymwdHM]] ... ",
|
||||
" [-f fmt date | [[[[yy]mm]dd]HH]MM[.ss]] [+format]");
|
||||
(void)fprintf(stderr,
|
||||
"usage: date [-nu] [-d dst] [-r seconds] [-t west] [+format]\n");
|
||||
(void)fprintf(stderr, " [yy[mm[dd[hh]]]]mm[.ss]]\n");
|
||||
exit(1);
|
||||
}
|
||||
+1
-1
@@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)extern.h 8.1 (Berkeley) 5/31/93
|
||||
* $Id$
|
||||
* $Id: extern.h,v 1.2 1994/09/24 02:54:37 davidg Exp $
|
||||
*/
|
||||
|
||||
int netsettime __P((time_t));
|
||||
+2
-2
@@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)netdate.c 8.1 (Berkeley) 5/31/93";
|
||||
static char sccsid[] = "@(#)netdate.c 8.1 (Berkeley) 5/31/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -116,7 +116,7 @@ netsettime(tval)
|
||||
warn("gethostname");
|
||||
goto bad;
|
||||
}
|
||||
(void)strncpy(msg.tsp_name, hostname, sizeof(msg.tsp_name) - 1);
|
||||
(void)strncpy(msg.tsp_name, hostname, sizeof(msg.tsp_name));
|
||||
msg.tsp_name[sizeof(msg.tsp_name) - 1] = '\0';
|
||||
msg.tsp_seq = htons((u_short)0);
|
||||
msg.tsp_time.tv_sec = htonl((u_long)tval);
|
||||
|
||||
-412
@@ -1,412 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <time.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "vary.h"
|
||||
|
||||
struct trans {
|
||||
int val;
|
||||
char *str;
|
||||
};
|
||||
|
||||
static struct trans trans_mon[] = {
|
||||
{ 1, "january" }, { 2, "february" }, { 3, "march" }, { 4, "april" },
|
||||
{ 6, "june" }, { 7, "july" }, { 8, "august" }, { 9, "september" },
|
||||
{ 10, "october" }, { 11, "november" }, { 12, "december" },
|
||||
{ -1, NULL }
|
||||
};
|
||||
|
||||
static struct trans trans_wday[] = {
|
||||
{ 0, "sunday" }, { 1, "monday" }, { 2, "tuesday" }, { 3, "wednesday" },
|
||||
{ 4, "thursday" }, { 5, "friday" }, { 6, "saturday" },
|
||||
{ -1, NULL }
|
||||
};
|
||||
|
||||
static char digits[] = "0123456789";
|
||||
|
||||
static int
|
||||
trans(const struct trans t[], const char *arg)
|
||||
{
|
||||
int f;
|
||||
|
||||
for (f = 0; t[f].val != -1; f++)
|
||||
if (!strncasecmp(t[f].str, arg, 3) ||
|
||||
!strncasecmp(t[f].str, arg, strlen(t[f].str)))
|
||||
return t[f].val;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct vary *
|
||||
vary_append(struct vary *v, char *arg)
|
||||
{
|
||||
struct vary *result, **nextp;
|
||||
|
||||
if (v) {
|
||||
result = v;
|
||||
while (v->next)
|
||||
v = v->next;
|
||||
nextp = &v->next;
|
||||
} else
|
||||
nextp = &result;
|
||||
|
||||
*nextp = (struct vary *)malloc(sizeof(struct vary));
|
||||
(*nextp)->arg = arg;
|
||||
(*nextp)->next = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
static int mdays[12] = { 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
static int
|
||||
daysinmonth(const struct tm *t)
|
||||
{
|
||||
int year;
|
||||
|
||||
year = t->tm_year + 1900;
|
||||
|
||||
if (t->tm_mon == 1)
|
||||
if (!(year % 400))
|
||||
return 29;
|
||||
else if (!(year % 100))
|
||||
return 28;
|
||||
else if (!(year % 4))
|
||||
return 29;
|
||||
else
|
||||
return 28;
|
||||
else if (t->tm_mon >= 0 && t->tm_mon < 12)
|
||||
return mdays[t->tm_mon];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
adjyear(struct tm *t, char type, int val)
|
||||
{
|
||||
switch (type) {
|
||||
case '+':
|
||||
t->tm_year += val;
|
||||
break;
|
||||
case '-':
|
||||
t->tm_year -= val;
|
||||
break;
|
||||
default:
|
||||
t->tm_year = val;
|
||||
if (t->tm_year < 69)
|
||||
t->tm_year += 100; /* as per date.c */
|
||||
else if (t->tm_year > 1900)
|
||||
t->tm_year -= 1900; /* struct tm holds years since 1900 */
|
||||
break;
|
||||
}
|
||||
return mktime(t) != -1;
|
||||
}
|
||||
|
||||
static int
|
||||
adjmon(struct tm *t, char type, int val, int istext)
|
||||
{
|
||||
if (val < 0)
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
case '+':
|
||||
if (istext)
|
||||
if (val <= t->tm_mon)
|
||||
val += 11 - t->tm_mon; /* early next year */
|
||||
else
|
||||
val -= t->tm_mon + 1; /* later this year */
|
||||
if (!adjyear(t, '+', (t->tm_mon + val) / 12))
|
||||
return 0;
|
||||
val %= 12;
|
||||
t->tm_mon += val;
|
||||
if (t->tm_mon > 11)
|
||||
t->tm_mon -= 12;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
if (istext)
|
||||
if (val-1 > t->tm_mon)
|
||||
val = 13 - val + t->tm_mon; /* later last year */
|
||||
else
|
||||
val = t->tm_mon - val + 1; /* early this year */
|
||||
if (!adjyear(t, '-', val / 12))
|
||||
return 0;
|
||||
val %= 12;
|
||||
if (val > t->tm_mon) {
|
||||
if (!adjyear(t, '-', 1))
|
||||
return 0;
|
||||
val -= 12;
|
||||
}
|
||||
t->tm_mon -= val;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (val > 12 || val < 1)
|
||||
return 0;
|
||||
t->tm_mon = --val;
|
||||
}
|
||||
|
||||
return mktime(t) != -1;
|
||||
}
|
||||
|
||||
static int
|
||||
adjday(struct tm *t, char type, int val)
|
||||
{
|
||||
int mdays;
|
||||
switch (type) {
|
||||
case '+':
|
||||
while (val) {
|
||||
mdays = daysinmonth(t);
|
||||
if (val > mdays - t->tm_mday) {
|
||||
val -= mdays - t->tm_mday + 1;
|
||||
t->tm_mday = 1;
|
||||
if (!adjmon(t, '+', 1, 0))
|
||||
return 0;
|
||||
} else {
|
||||
t->tm_mday += val;
|
||||
val = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
while (val)
|
||||
if (val >= t->tm_mday) {
|
||||
val -= t->tm_mday;
|
||||
t->tm_mday = 1;
|
||||
if (!adjmon(t, '-', 1, 0))
|
||||
return 0;
|
||||
t->tm_mday = daysinmonth(t);
|
||||
} else {
|
||||
t->tm_mday -= val;
|
||||
val = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (val > 0 && val <= daysinmonth(t))
|
||||
t->tm_mday = val;
|
||||
else
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return mktime(t) != -1;
|
||||
}
|
||||
|
||||
static int
|
||||
adjwday(struct tm *t, char type, int val, int istext)
|
||||
{
|
||||
if (val < 0)
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
case '+':
|
||||
if (istext)
|
||||
if (val < t->tm_wday)
|
||||
val = 7 - t->tm_wday + val; /* early next week */
|
||||
else
|
||||
val -= t->tm_wday; /* later this week */
|
||||
else
|
||||
val *= 7; /* "-W +5" == "5 weeks in the future" */
|
||||
return adjday(t, '+', val);
|
||||
case '-':
|
||||
if (istext)
|
||||
if (val > t->tm_wday)
|
||||
val = 7 - val + t->tm_wday; /* later last week */
|
||||
else
|
||||
val = t->tm_wday - val; /* early this week */
|
||||
else
|
||||
val *= 7; /* "-W -5" == "5 weeks ago" */
|
||||
return adjday(t, '-', val);
|
||||
default:
|
||||
if (val < t->tm_wday)
|
||||
return adjday(t, '-', t->tm_wday - val);
|
||||
else if (val > 6)
|
||||
return 0;
|
||||
else if (val > t->tm_wday)
|
||||
return adjday(t, '+', val - t->tm_wday);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
adjhour(struct tm *t, char type, int val)
|
||||
{
|
||||
if (val < 0)
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
case '+':
|
||||
if (!adjday(t, '+', (t->tm_hour + val) / 24))
|
||||
return 0;
|
||||
val %= 24;
|
||||
t->tm_hour += val;
|
||||
if (t->tm_hour > 23)
|
||||
t->tm_hour -= 24;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
if (!adjday(t, '-', val / 24))
|
||||
return 0;
|
||||
val %= 24;
|
||||
if (val > t->tm_hour) {
|
||||
if (!adjday(t, '-', 1))
|
||||
return 0;
|
||||
val -= 24;
|
||||
}
|
||||
t->tm_hour -= val;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (val > 23)
|
||||
return 0;
|
||||
t->tm_hour = val;
|
||||
}
|
||||
|
||||
return mktime(t) != -1;
|
||||
}
|
||||
|
||||
static int
|
||||
adjmin(struct tm *t, char type, int val)
|
||||
{
|
||||
if (val < 0)
|
||||
return 0;
|
||||
|
||||
switch (type) {
|
||||
case '+':
|
||||
if (!adjhour(t, '+', (t->tm_min + val) / 60))
|
||||
return 0;
|
||||
val %= 60;
|
||||
t->tm_min += val;
|
||||
if (t->tm_min > 59)
|
||||
t->tm_min -= 60;
|
||||
break;
|
||||
|
||||
case '-':
|
||||
if (!adjhour(t, '-', val / 60))
|
||||
return 0;
|
||||
val %= 60;
|
||||
if (val > t->tm_min) {
|
||||
if (!adjhour(t, '-', 1))
|
||||
return 0;
|
||||
val -= 60;
|
||||
}
|
||||
t->tm_min -= val;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (val > 59)
|
||||
return 0;
|
||||
t->tm_min = val;
|
||||
}
|
||||
|
||||
return mktime(t) != -1;
|
||||
}
|
||||
|
||||
const struct vary *
|
||||
vary_apply(const struct vary *v, struct tm *t)
|
||||
{
|
||||
char type;
|
||||
char which;
|
||||
char *arg;
|
||||
int len;
|
||||
int val;
|
||||
|
||||
for (; v; v = v->next) {
|
||||
type = *v->arg;
|
||||
arg = v->arg;
|
||||
if (type == '+' || type == '-')
|
||||
arg++;
|
||||
else
|
||||
type = '\0';
|
||||
len = strlen(arg);
|
||||
if (len < 2)
|
||||
return v;
|
||||
|
||||
if (strspn(arg, digits) != len-1) {
|
||||
val = trans(trans_wday, arg);
|
||||
if (val != -1) {
|
||||
if (!adjwday(t, type, val, 1))
|
||||
return v;
|
||||
} else {
|
||||
val = trans(trans_mon, arg);
|
||||
if (val != -1) {
|
||||
if (!adjmon(t, type, val, 1))
|
||||
return v;
|
||||
} else
|
||||
return v;
|
||||
}
|
||||
} else {
|
||||
val = atoi(arg);
|
||||
which = arg[len-1];
|
||||
|
||||
switch (which) {
|
||||
case 'M':
|
||||
if (!adjmin(t, type, val))
|
||||
return v;
|
||||
break;
|
||||
case 'H':
|
||||
if (!adjhour(t, type, val))
|
||||
return v;
|
||||
break;
|
||||
case 'd':
|
||||
if (!adjday(t, type, val))
|
||||
return v;
|
||||
break;
|
||||
case 'w':
|
||||
if (!adjwday(t, type, val, 0))
|
||||
return v;
|
||||
break;
|
||||
case 'm':
|
||||
if (!adjmon(t, type, val, 0))
|
||||
return v;
|
||||
break;
|
||||
case 'y':
|
||||
if (!adjyear(t, type, val))
|
||||
return v;
|
||||
break;
|
||||
default:
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
vary_destroy(struct vary *v)
|
||||
{
|
||||
struct vary *n;
|
||||
|
||||
while (v) {
|
||||
n = v->next;
|
||||
free(v);
|
||||
v = n;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
struct vary {
|
||||
char *arg;
|
||||
struct vary *next;
|
||||
};
|
||||
|
||||
extern struct vary *vary_append(struct vary *v, char *arg);
|
||||
extern const struct vary *vary_apply(const struct vary *v, struct tm *t);
|
||||
extern void vary_destroy(struct vary *v);
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:54:40 davidg Exp $
|
||||
|
||||
PROG= dd
|
||||
SRCS= args.c conv.c conv_tab.c dd.c misc.c position.c
|
||||
|
||||
+2
-5
@@ -34,11 +34,11 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: args.c,v 1.3.8.2 1997/08/24 21:45:26 jkh Exp $
|
||||
* $Id: args.c,v 1.3.8.1 1996/11/21 16:30:28 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
|
||||
static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -101,8 +101,6 @@ jcl(argv)
|
||||
in.dbsz = out.dbsz = 512;
|
||||
|
||||
while ((oper = *++argv) != NULL) {
|
||||
if ((oper = strdup(oper)) == NULL)
|
||||
errx(1, "unable to allocate space for the argument \"%s\"", *argv);
|
||||
if ((arg = strchr(oper, '=')) == NULL)
|
||||
errx(1, "unknown operand %s", oper);
|
||||
*arg++ = '\0';
|
||||
@@ -284,7 +282,6 @@ static struct conv {
|
||||
{ "oldebcdic", C_EBCDIC, C_ASCII, a2e_32V },
|
||||
{ "oldibm", C_EBCDIC, C_ASCII, a2ibm_32V },
|
||||
{ "osync", C_OSYNC, C_BS, NULL },
|
||||
{ "sparse", C_SPARSE, 0, NULL },
|
||||
{ "swab", C_SWAB, 0, NULL },
|
||||
{ "sync", C_SYNC, 0, NULL },
|
||||
{ "ucase", C_UCASE, C_LCASE, NULL },
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)conv.c 8.3 (Berkeley) 4/2/94";
|
||||
static char sccsid[] = "@(#)conv.c 8.3 (Berkeley) 4/2/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -129,7 +129,7 @@ block()
|
||||
* Copy records (max cbsz size chunks) into the output buffer. The
|
||||
* translation is done as we copy into the output buffer.
|
||||
*/
|
||||
ch = 0;
|
||||
ch = 0; /* Help the compiler. */
|
||||
for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) {
|
||||
maxlen = MIN(cbsz, in.dbcnt);
|
||||
if ((t = ctab) != NULL)
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)conv_tab.c 8.1 (Berkeley) 5/31/93";
|
||||
static char sccsid[] = "@(#)conv_tab.c 8.1 (Berkeley) 5/31/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
+2
-9
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)dd.1 8.2 (Berkeley) 1/13/94
|
||||
.\" $Id: dd.1,v 1.2.8.2 1997/08/24 21:45:30 jkh Exp $
|
||||
.\" $Id: dd.1,v 1.2.8.1 1997/02/28 07:54:33 mpp Exp $
|
||||
.\"
|
||||
.Dd January 13, 1994
|
||||
.Dt DD 1
|
||||
@@ -148,7 +148,7 @@ is one of the symbols from the following list.
|
||||
The same as the
|
||||
.Cm unblock
|
||||
value except that characters are translated from
|
||||
.Tn EBCDIC
|
||||
.Tn ECBDIC
|
||||
to
|
||||
.Tn ASCII
|
||||
before the
|
||||
@@ -250,13 +250,6 @@ regularly sized blocks to be written.
|
||||
This option is incompatible with use of the
|
||||
.Cm bs= Ns Ar n
|
||||
block size specification.
|
||||
.It Cm sparse
|
||||
If one or more output blocks would consist solely of
|
||||
.Tn NUL
|
||||
bytes, try to seek the output file by the required space instead of
|
||||
filling them with
|
||||
.Tn NULs ,
|
||||
resulting in a sparse file.
|
||||
.It Cm swab
|
||||
Swap every pair of input bytes.
|
||||
If an input buffer has an odd number of bytes, the last byte will be
|
||||
|
||||
+17
-48
@@ -34,17 +34,17 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: dd.c,v 1.5.2.4 1998/01/09 09:13:06 joerg Exp $
|
||||
* $Id: dd.c,v 1.5.2.1 1996/11/21 16:30:32 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const copyright[] =
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1991, 1993, 1994\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
|
||||
static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -75,7 +75,6 @@ IO in, out; /* input/output state */
|
||||
STAT st; /* statistics */
|
||||
void (*cfunc) __P((void)); /* conversion function */
|
||||
u_long cpy_cnt; /* # of blocks to copy */
|
||||
u_long pending = 0; /* pending seek if sparse */
|
||||
u_int ddflags; /* conversion options */
|
||||
u_int cbsz; /* conversion block size */
|
||||
u_int files_cnt = 1; /* # of files to copy */
|
||||
@@ -170,7 +169,7 @@ setup()
|
||||
* Truncate the output file; ignore errors because it fails on some
|
||||
* kinds of output files, tapes, for example.
|
||||
*/
|
||||
if ((ddflags & (C_OF | C_SEEK | C_NOTRUNC)) == (C_OF | C_SEEK))
|
||||
if (ddflags & (C_OF | C_SEEK | C_NOTRUNC) == (C_OF | C_SEEK))
|
||||
(void)ftruncate(out.fd, (off_t)out.offset * out.dbsz);
|
||||
|
||||
/*
|
||||
@@ -237,18 +236,19 @@ getfdtype(io)
|
||||
static void
|
||||
dd_in()
|
||||
{
|
||||
int n;
|
||||
int flags, n;
|
||||
|
||||
for (;;) {
|
||||
for (flags = ddflags;;) {
|
||||
if (cpy_cnt && (st.in_full + st.in_part) >= cpy_cnt)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Zero the buffer first if sync; If doing block operations
|
||||
* Zero the buffer first if trying to recover from errors so
|
||||
* lose the minimum amount of data. If doing block operations
|
||||
* use spaces.
|
||||
*/
|
||||
if (ddflags & C_SYNC)
|
||||
if (ddflags & (C_BLOCK|C_UNBLOCK))
|
||||
if ((flags & (C_NOERROR|C_SYNC)) == (C_NOERROR|C_SYNC))
|
||||
if (flags & (C_BLOCK|C_UNBLOCK))
|
||||
memset(in.dbp, ' ', in.dbsz);
|
||||
else
|
||||
memset(in.dbp, 0, in.dbsz);
|
||||
@@ -265,7 +265,7 @@ dd_in()
|
||||
* If noerror not specified, die. POSIX requires that
|
||||
* the warning message be followed by an I/O display.
|
||||
*/
|
||||
if (!(ddflags & C_NOERROR))
|
||||
if (!(flags & C_NOERROR))
|
||||
err(1, "%s", in.name);
|
||||
warn("%s", in.name);
|
||||
summary();
|
||||
@@ -316,7 +316,7 @@ dd_in()
|
||||
}
|
||||
|
||||
if (ddflags & C_SWAB) {
|
||||
if ((n = in.dbrcnt) & 1) {
|
||||
if ((n = in.dbcnt) & 1) {
|
||||
++st.swab;
|
||||
--n;
|
||||
}
|
||||
@@ -341,14 +341,11 @@ dd_close()
|
||||
block_close();
|
||||
else if (cfunc == unblock)
|
||||
unblock_close();
|
||||
if (ddflags & C_OSYNC && out.dbcnt && out.dbcnt < out.dbsz) {
|
||||
if (ddflags & (C_BLOCK|C_UNBLOCK))
|
||||
memset(out.dbp, ' ', out.dbsz - out.dbcnt);
|
||||
else
|
||||
memset(out.dbp, 0, out.dbsz - out.dbcnt);
|
||||
if (ddflags & C_OSYNC && out.dbcnt < out.dbsz) {
|
||||
memset(out.dbp, 0, out.dbsz - out.dbcnt);
|
||||
out.dbcnt = out.dbsz;
|
||||
}
|
||||
if (out.dbcnt || pending)
|
||||
if (out.dbcnt)
|
||||
dd_out(1);
|
||||
}
|
||||
|
||||
@@ -357,7 +354,7 @@ dd_out(force)
|
||||
int force;
|
||||
{
|
||||
static int warned;
|
||||
int cnt, n, nw, i, sparse;
|
||||
int cnt, n, nw;
|
||||
u_char *outp;
|
||||
|
||||
/*
|
||||
@@ -379,35 +376,7 @@ dd_out(force)
|
||||
outp = out.db;
|
||||
for (n = force ? out.dbcnt : out.dbsz;; n = out.dbsz) {
|
||||
for (cnt = n;; cnt -= nw) {
|
||||
sparse = 0;
|
||||
if (ddflags & C_SPARSE) {
|
||||
sparse = 1; /* Is buffer sparse? */
|
||||
for (i = 0; i < cnt; i++)
|
||||
if (outp[i] != 0) {
|
||||
sparse = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sparse && !force) {
|
||||
pending += cnt;
|
||||
nw = cnt;
|
||||
} else {
|
||||
if (pending != 0) {
|
||||
if (force)
|
||||
pending--;
|
||||
if (lseek (out.fd, pending, SEEK_CUR) == -1)
|
||||
err(2, "%s: seek error creating sparse file",
|
||||
out.name);
|
||||
if (force)
|
||||
write(out.fd, outp, 1);
|
||||
pending = 0;
|
||||
}
|
||||
if (cnt)
|
||||
nw = write(out.fd, outp, cnt);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
nw = write(out.fd, outp, cnt);
|
||||
if (nw <= 0) {
|
||||
if (nw == 0)
|
||||
errx(1, "%s: end of device", out.name);
|
||||
|
||||
+2
-3
@@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)dd.h 8.3 (Berkeley) 4/2/94
|
||||
* $Id: dd.h,v 1.2.8.2 1998/02/11 02:24:40 asami Exp $
|
||||
* $Id: dd.h,v 1.2.8.1 1996/11/21 16:30:33 phk Exp $
|
||||
*/
|
||||
|
||||
/* Input/output stream state. */
|
||||
@@ -69,7 +69,7 @@ typedef struct {
|
||||
u_long out_part; /* # of partial output blocks */
|
||||
u_long trunc; /* # of truncated records */
|
||||
u_long swab; /* # of odd-length swab blocks */
|
||||
u_int64_t bytes; /* # of bytes written */
|
||||
u_long bytes; /* # of bytes written */
|
||||
double start; /* start time of dd */
|
||||
} STAT;
|
||||
|
||||
@@ -95,4 +95,3 @@ typedef struct {
|
||||
#define C_UCASE 0x40000
|
||||
#define C_UNBLOCK 0x80000
|
||||
#define C_OSYNC 0x100000
|
||||
#define C_SPARSE 0x200000
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)extern.h 8.3 (Berkeley) 4/2/94
|
||||
* $Id$
|
||||
* $Id: extern.h,v 1.2 1994/09/24 02:54:57 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
+3
-6
@@ -34,18 +34,17 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: misc.c,v 1.2.8.3 1998/02/11 02:24:41 asami Exp $
|
||||
* $Id: misc.c,v 1.2.8.1 1996/11/21 16:30:35 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
|
||||
static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -82,7 +81,7 @@ summary()
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
}
|
||||
(void)snprintf(buf, sizeof(buf),
|
||||
"%qu bytes transferred in %.6f secs (%.0f bytes/sec)\n",
|
||||
"%u bytes transferred in %.6f secs (%.0f bytes/sec)\n",
|
||||
st.bytes, secs, st.bytes / secs);
|
||||
(void)write(STDERR_FILENO, buf, strlen(buf));
|
||||
}
|
||||
@@ -92,10 +91,8 @@ void
|
||||
summaryx(notused)
|
||||
int notused;
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
summary();
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char const sccsid[] = "@(#)position.c 8.3 (Berkeley) 4/2/94";
|
||||
static char sccsid[] = "@(#)position.c 8.3 (Berkeley) 4/2/94";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -67,7 +67,7 @@ pos_in()
|
||||
|
||||
/* If not a character, pipe or tape device, try to seek on it. */
|
||||
if (!(in.flags & (ISCHR|ISPIPE|ISTAPE))) {
|
||||
if (lseek(in.fd, (off_t)in.offset * in.dbsz, SEEK_CUR) == -1)
|
||||
if (lseek(in.fd, (off_t)(in.offset * in.dbsz), SEEK_CUR) == -1)
|
||||
err(1, "%s", in.name);
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.2 (Berkeley) 4/1/94
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:55:06 davidg Exp $
|
||||
|
||||
PROG= df
|
||||
BINGRP= operator
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)df.1 8.2 (Berkeley) 1/13/94
|
||||
.\" $Id: df.1,v 1.4.2.2 1997/09/19 06:18:10 charnier Exp $
|
||||
.\" $Id: df.1,v 1.4.2.1 1996/12/13 17:15:10 joerg Exp $
|
||||
.\"
|
||||
.Dd January 13, 1994
|
||||
.Dt DF 1
|
||||
@@ -96,10 +96,10 @@ or
|
||||
``df -t local -t nomfs''
|
||||
will display statistics for UFS and LFS filesystems.
|
||||
.El
|
||||
.Sh ENVIRONMENT VARIABLES
|
||||
.Sh ENVIRONMENTAL VARIABLES
|
||||
.Bl -tag -width BLOCKSIZE
|
||||
.It Ev BLOCKSIZE
|
||||
If the environment variable
|
||||
If the environmental variable
|
||||
.Ev BLOCKSIZE
|
||||
is set, the block counts will be displayed in units of that size block.
|
||||
.El
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ main(argc, argv)
|
||||
iflag = nflag = tflag = 0;
|
||||
fsmask = MT_NONE;
|
||||
|
||||
while ((ch = getopt(argc, argv, "iknt:")) != -1)
|
||||
while ((ch = getopt(argc, argv, "iknt:")) != EOF)
|
||||
switch (ch) {
|
||||
case 'i':
|
||||
iflag = 1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.1 1994/09/18 21:23:35 wollman Exp $
|
||||
|
||||
PROG= domainname
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
prints the name of the current YP/NIS domain. The super-user can
|
||||
set the domain name by supplying an argument; this is usually done in the
|
||||
network initialization script
|
||||
.Pa /etc/rc.network ,
|
||||
.Pa /etc/netstart ,
|
||||
normally run at boot
|
||||
time.
|
||||
.Sh NOTA BENE
|
||||
|
||||
@@ -51,26 +51,14 @@ static const char rcsid[] =
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int ch;
|
||||
char domainname[MAXHOSTNAMELEN];
|
||||
|
||||
while ((ch = getopt(argc, argv, "")) != -1)
|
||||
switch (ch) {
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc > 1)
|
||||
usage();
|
||||
argc--, argv++;
|
||||
|
||||
if (*argv) {
|
||||
if (setdomainname(*argv, strlen(*argv)))
|
||||
@@ -82,10 +70,3 @@ main(argc,argv)
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
{
|
||||
(void)fprintf(stderr, "usage: domainname [ypdomain]\n");
|
||||
exit(1);
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 5/31/93
|
||||
# $Id$
|
||||
# $Id: Makefile,v 1.2 1994/09/24 02:55:15 davidg Exp $
|
||||
|
||||
PROG= echo
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)echo.1 8.1 (Berkeley) 7/22/93
|
||||
.\" $Id: echo.1,v 1.2 1994/09/24 02:55:17 davidg Exp $
|
||||
.\" $Id: echo.1,v 1.3 1995/08/31 17:25:54 jkh Exp $
|
||||
.\"
|
||||
.Dd July 22, 1993
|
||||
.Dt ECHO 1
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: echo.c,v 1.2 1994/09/24 02:55:18 davidg Exp $
|
||||
* $Id: echo.c,v 1.3 1995/08/31 17:25:55 jkh Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.12 1995/10/03 15:44:50 markm Exp $
|
||||
# $Id: Makefile,v 1.13 1995/10/22 20:14:13 ache Exp $
|
||||
|
||||
PROG= ed
|
||||
SRCS= buf.c cbc.c glbl.c io.c main.c re.c sub.c undo.c
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
$Id$
|
||||
$Id: POSIX,v 1.4 1994/09/24 02:55:20 davidg Exp $
|
||||
|
||||
This version of ed(1) is not strictly POSIX compliant, as described in
|
||||
the POSIX 1003.2 document. The following is a summary of the omissions,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
$Id$
|
||||
$Id: README,v 1.4 1994/09/24 02:55:21 davidg Exp $
|
||||
|
||||
ed is an 8-bit-clean, POSIX-compliant line editor. It should work with
|
||||
any regular expression package that conforms to the POSIX interface
|
||||
|
||||
+3
-11
@@ -24,15 +24,11 @@
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: buf.c,v 1.7.6.1 1997/03/24 05:46:18 imp Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char * const rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
|
||||
#else
|
||||
static char * const rcsid =
|
||||
"$Id: buf.c,v 1.15 1997/12/31 12:25:33 helbig Exp $";
|
||||
#endif
|
||||
static char *rcsid = "@(#)buf.c,v 1.4 1994/02/01 00:34:35 alm Exp";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/file.h>
|
||||
@@ -268,10 +264,6 @@ init_buffers()
|
||||
hello, world
|
||||
EOF */
|
||||
setbuffer(stdin, stdinbuf, 1);
|
||||
|
||||
/* Ensure stdout is line buffered. This avoids bogus delays
|
||||
of output if stdout is piped through utilities to a terminal. */
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
if (open_sbuf() < 0)
|
||||
quit(2);
|
||||
REQUE(&buffer_head, &buffer_head);
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)bdes.c 5.5 (Berkeley) 6/27/91
|
||||
* $Id: cbc.c,v 1.5 1995/03/19 13:28:24 joerg Exp $
|
||||
* $Id: cbc.c,v 1.6 1996/08/11 16:48:11 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
.\" $Id: ed.1,v 1.12 1997/12/31 12:25:35 helbig Exp $
|
||||
.\" $Id: ed.1,v 1.8 1996/10/05 22:26:02 wosch Exp $
|
||||
.TH ED 1 "21 May 1993"
|
||||
.SH NAME
|
||||
.\" ed, red \- text editor
|
||||
@@ -454,7 +454,7 @@ implementation.
|
||||
.SS COMMANDS
|
||||
All
|
||||
.B ed
|
||||
commands are single characters, though some require additional parameters.
|
||||
commands are single characters, though some require additonal parameters.
|
||||
If a command's parameters extend over several lines, then
|
||||
each line except for the last
|
||||
must be terminated with a backslash (\\).
|
||||
@@ -820,7 +820,7 @@ are treated as a single command by undo.
|
||||
is its own inverse.
|
||||
|
||||
.TP 8
|
||||
.RI (1,$)v /re/command-list
|
||||
.RI (1,$)v /pat/command-list
|
||||
Applies
|
||||
.I command-list
|
||||
to each of the addressed lines not matching a regular expression
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
* $Id: ed.h,v 1.8 1994/11/03 21:46:55 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h> /* for MAXPATHLEN */
|
||||
#include <errno.h>
|
||||
#if defined(sun) || defined(__NetBSD__)
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: glbl.c,v 1.3 1995/03/19 13:28:27 joerg Exp $
|
||||
* $Id: glbl.c,v 1.4 1995/05/30 00:06:46 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: io.c,v 1.4 1995/03/19 13:28:32 joerg Exp $
|
||||
* $Id: io.c,v 1.5 1996/05/23 06:36:34 tg Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+10
-16
@@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: main.c,v 1.6.2.1 1997/08/24 21:50:21 jkh Exp $
|
||||
* $Id: main.c,v 1.6 1996/08/11 16:48:11 ache Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@@ -57,9 +57,9 @@ static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/wait.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include <pwd.h>
|
||||
#include <setjmp.h>
|
||||
#include <pwd.h>
|
||||
#include <locale.h>
|
||||
|
||||
#include "ed.h"
|
||||
|
||||
@@ -100,6 +100,10 @@ char *dps = "*"; /* default command-line prompt */
|
||||
|
||||
char *usage = "usage: %s [-] [-sx] [-p string] [name]\n";
|
||||
|
||||
extern char errmsg[];
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
|
||||
/* ed: line editor */
|
||||
int
|
||||
main(argc, argv)
|
||||
@@ -108,17 +112,12 @@ main(argc, argv)
|
||||
{
|
||||
int c, n;
|
||||
long status = 0;
|
||||
#if __GNUC__
|
||||
/* Avoid longjmp clobbering */
|
||||
(void) &argc;
|
||||
(void) &argv;
|
||||
#endif
|
||||
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
red = (n = strlen(argv[0])) > 2 && argv[0][n - 3] == 'r';
|
||||
top:
|
||||
while ((c = getopt(argc, argv, "p:sx")) != -1)
|
||||
while ((c = getopt(argc, argv, "p:sx")) != EOF)
|
||||
switch(c) {
|
||||
case 'p': /* set prompt */
|
||||
prompt = optarg;
|
||||
@@ -1355,8 +1354,7 @@ signal_hup(signo)
|
||||
{
|
||||
if (mutex)
|
||||
sigflags |= (1 << (signo - 1));
|
||||
else
|
||||
handle_hup(signo);
|
||||
else handle_hup(signo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1366,8 +1364,7 @@ signal_int(signo)
|
||||
{
|
||||
if (mutex)
|
||||
sigflags |= (1 << (signo - 1));
|
||||
else
|
||||
handle_int(signo);
|
||||
else handle_int(signo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1417,8 +1414,6 @@ void
|
||||
handle_winch(signo)
|
||||
int signo;
|
||||
{
|
||||
int save_errno = errno;
|
||||
|
||||
struct winsize ws; /* window size structure */
|
||||
|
||||
sigflags &= ~(1 << (signo - 1));
|
||||
@@ -1426,7 +1421,6 @@ handle_winch(signo)
|
||||
if (ws.ws_row > 2) rows = ws.ws_row - 2;
|
||||
if (ws.ws_col > 8) cols = ws.ws_col - 8;
|
||||
}
|
||||
errno = save_errno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: re.c,v 1.9 1995/03/19 13:28:36 joerg Exp $
|
||||
* $Id: re.c,v 1.10 1995/05/30 00:06:47 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sub.c,v 1.5 1995/03/19 13:28:38 joerg Exp $
|
||||
* $Id: sub.c,v 1.6 1995/05/30 00:06:48 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $Id: Makefile,v 1.5 1994/09/24 02:55:35 davidg Exp $
|
||||
# $Id: Makefile,v 1.6 1996/06/24 04:22:19 jkh Exp $
|
||||
|
||||
SHELL= /bin/sh
|
||||
ED= ${.OBJDIR}/ed
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# $Id$
|
||||
# $Id: README,v 1.4 1996/09/22 21:51:28 wosch Exp $
|
||||
|
||||
The files in this directory with suffixes `.t', `.d', `.r' and `.err' are
|
||||
used for testing ed. To run the tests, set the ED variable in the Makefile
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# and compares their output against the .r files, which contain
|
||||
# the correct output
|
||||
#
|
||||
# $Id$
|
||||
# $Id: ckscripts.sh,v 1.3 1996/09/22 21:51:29 wosch Exp $
|
||||
|
||||
PATH="/bin:/usr/bin:/usr/local/bin/:."
|
||||
ED=$1
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh -
|
||||
# This script generates ed test scripts (.ed) from .t files
|
||||
#
|
||||
# $Id$
|
||||
# $Id: mkscripts.sh,v 1.3 1996/09/22 21:51:30 wosch Exp $
|
||||
|
||||
PATH="/bin:/usr/bin:/usr/local/bin/:."
|
||||
ED=$1
|
||||
|
||||
Loaded 100 of 8276 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user