Mike Sullivan
2011-01-20 4f8cfa144e4608458bbab3c26ca48da41aadca7f
7011958 some things lost during move to userland
7013316 move bzip2 to userland
19 files added
2 files modified
1910 ■■■■■ changed files
components/a2ps/Makefile 1 ●●●● patch | view | raw | blame | history
components/bzip2/Makefile 96 ●●●●● patch | view | raw | blame | history
components/bzip2/Makefile.patch 118 ●●●●● patch | view | raw | blame | history
components/bzip2/SUNWbzip.p5m 36 ●●●●● patch | view | raw | blame | history
components/bzip2/bzip2.license 42 ●●●●● patch | view | raw | blame | history
components/bzip2/bzip2.p5m 82 ●●●●● patch | view | raw | blame | history
components/bzip2/bzip2.patch 55 ●●●●● patch | view | raw | blame | history
components/bzip2/llib-lbz2 73 ●●●●● patch | view | raw | blame | history
components/bzip2/manpages/bunzip2.1 1 ●●●● patch | view | raw | blame | history
components/bzip2/manpages/bzcat.1 1 ●●●● patch | view | raw | blame | history
components/bzip2/manpages/bzdiff.1 66 ●●●●● patch | view | raw | blame | history
components/bzip2/manpages/bzgrep.1 75 ●●●●● patch | view | raw | blame | history
components/bzip2/manpages/bzip2.1 477 ●●●●● patch | view | raw | blame | history
components/bzip2/manpages/bzip2recover.1 1 ●●●● patch | view | raw | blame | history
components/bzip2/manpages/bzmore.1 171 ●●●●● patch | view | raw | blame | history
components/bzip2/manpages/libbz2.3 107 ●●●●● patch | view | raw | blame | history
components/bzip2/mapfile 95 ●●●●● patch | view | raw | blame | history
components/bzip2/oldapi.c 178 ●●●●● patch | view | raw | blame | history
make-rules/justmake.mk 76 ●●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 108 ●●●●● patch | view | raw | blame | history
tools/cloney 51 ●●●●● patch | view | raw | blame | history
components/a2ps/Makefile
@@ -42,6 +42,7 @@
CONFIGURE_OPTIONS  +=        --sysconfdir=/etc/gnu
CONFIGURE_OPTIONS  +=        --infodir=$(CONFIGURE_INFODIR)
CONFIGURE_OPTIONS  +=        --with-medium=letter
CONFIGURE_OPTIONS  +=        CFLAGS="$(CFLAGS)"
# because viewpathing isn't quite right in this version of a2ps
COMPONENT_PREP_ACTION = \
components/bzip2/Makefile
New file
@@ -0,0 +1,96 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
#
include ../../make-rules/shared-macros.mk
COMPONENT_NAME=        bzip2
COMPONENT_VERSION=    1.0.6
IPS_PKG_NAME=        compress/bzip2
COMPONENT_DESCRIPTION=    "The bzip compression utility"
COMPONENT_CLASSIFICATION="Applications/System Utilities"
COMPONENT_SRC=        $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_PROJECT_URL=    http://www.bzip.org
COMPONENT_ARCHIVE=    $(COMPONENT_SRC).tar.gz
COMPONENT_ARCHIVE_HASH=    sha1:3f89f861209ce81a6bab1fd1998c0ef311712002
COMPONENT_ARCHIVE_URL=    http://www.bzip.org/1.0.6/$(COMPONENT_ARCHIVE)
include ../../make-rules/prep.mk
include ../../make-rules/justmake.mk
include ../../make-rules/ips.mk
LIBNAME=    bz2
LINTOUT=    lint.out
LINTFLAGS=    -nsvx -I. $(BITS32)
LINTFLAGS64=    -nsvx -I. $(BITS64)
CFLAGS += -KPIC -D_FILE_OFFSET_BITS=64
CFLAGS += $(XREGSFLAG)
COMPONENT_BUILD_ENV += CC="$(CC)"
COMPONENT_BUILD_TARGETS += CC="$(CC)"
COMPONENT_BUILD_TARGETS += CFLAGS="$(CFLAGS)"
COMPONENT_INSTALL_TARGETS += PREFIX=$(PROTOUSRDIR)
COMPONENT_PRE_BUILD_ACTION= \
    (cd $(@D) ; \
        cp ../../oldapi.c . )
COMPONENT_POST_BUILD_ACTION= \
    (cd $(@D) ; \
        $(LINT) -o $(LIBNAME) ../../llib-lbz2 > $(LINTOUT) 2>&1)
# common targets
build:        $(BUILD_32) $(BUILD_64)
MAN1FILES= bunzip2.1 bzcat.1 bzdiff.1 bzgrep.1 \
    bzip2.1 bzip2recover.1 bzmore.1
MAN3FILES=libbz2.3
PROTOMAN1FILES=$(MAN1FILES:%=$(PROTOUSRSHAREMAN1DIR)/%)
PROTOMAN3FILES=$(MAN3FILES:%=$(PROTOUSRSHAREMAN3DIR)/%)
PROTODIRS= $(PROTOUSRSHAREMAN1DIR) $(PROTOUSRSHAREMAN3DIR)
$(PROTOUSRSHAREMAN1DIR) $(PROTOUSRSHAREMAN3DIR):
    $(INS.dir)
$(PROTOUSRSHAREMAN1DIR)/% $(PROTOUSRSHAREMAN3DIR)/%:    manpages/%
    $(INS.file)
install:    build $(INSTALL_32) $(PROTODIRS) $(PROTOMAN3FILES) $(PROTOMAN1FILES)
    $(INSTALL) $(BUILD_DIR_32)/libbz2.so.1 $(PROTOUSRLIBDIR)
    cd $(PROTOUSRLIBDIR); rm -f libbz2.so; ln -s libbz2.so.1 libbz2.so
    $(INSTALL) llib-lbz2 $(PROTOUSRLIBDIR)
    $(INSTALL) $(BUILD_DIR_32)/llib-lbz2.ln $(PROTOUSRLIBDIR)
    $(MKDIR) $(PROTOUSRLIBDIR64)
    $(INSTALL) $(BUILD_DIR_64)/libbz2.so.1 $(PROTOUSRLIBDIR64)
    cd $(PROTOUSRLIBDIR64); rm -f libbz2.so; ln -s libbz2.so.1 libbz2.so
    $(INSTALL) $(BUILD_DIR_64)/llib-lbz2.ln $(PROTOUSRLIBDIR64)
# build does this always
test:
BUILD_PKG_DEPENDENCIES =    $(BUILD_TOOLS)
include ../../make-rules/depend.mk
components/bzip2/Makefile.patch
New file
@@ -0,0 +1,118 @@
--- bzip2-1.0.6/Makefile.orig    Wed Jan 12 13:53:06 2011
+++ bzip2-1.0.6/Makefile    Thu Jan 13 13:01:30 2011
@@ -33,34 +33,33 @@
       randtable.o  \
       compress.o   \
       decompress.o \
-      bzlib.o
+      bzlib.o    \
+      oldapi.o
-all: libbz2.a bzip2 bzip2recover test
+all: libbz2.so bzip2 bzip2recover test
-bzip2: libbz2.a bzip2.o
+bzip2: libbz2.so bzip2.o
     $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
 bzip2recover: bzip2recover.o
     $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
-libbz2.a: $(OBJS)
-    rm -f libbz2.a
-    $(AR) cq libbz2.a $(OBJS)
-    @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \
-        -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \
-        echo $(RANLIB) libbz2.a ; \
-        $(RANLIB) libbz2.a ; \
-    fi
+libbz2.so: $(OBJS)
+    rm -f libbz2.so libbz2.so.1
+    $(CC) $(CFLAGS) -G -h libbz2.so.1 -o libbz2.so.1 \
+        -z defs -z text -zcombreloc $(OBJS) -M ../../mapfile -L. \
+        -lc
+    ln -s libbz2.so.1 libbz2.so
 check: test
 test: bzip2
     @cat words1
-    ./bzip2 -1  < sample1.ref > sample1.rb2
-    ./bzip2 -2  < sample2.ref > sample2.rb2
-    ./bzip2 -3  < sample3.ref > sample3.rb2
-    ./bzip2 -d  < sample1.bz2 > sample1.tst
-    ./bzip2 -d  < sample2.bz2 > sample2.tst
-    ./bzip2 -ds < sample3.bz2 > sample3.tst
+    env LD_LIBRARY_PATH=. ./bzip2 -1  < sample1.ref > sample1.rb2
+    env LD_LIBRARY_PATH=. ./bzip2 -2  < sample2.ref > sample2.rb2
+    env LD_LIBRARY_PATH=. ./bzip2 -3  < sample3.ref > sample3.rb2
+    env LD_LIBRARY_PATH=. ./bzip2 -d  < sample1.bz2 > sample1.tst
+    env LD_LIBRARY_PATH=. ./bzip2 -d  < sample2.bz2 > sample2.tst
+    env LD_LIBRARY_PATH=. ./bzip2 -ds < sample3.bz2 > sample3.tst
     cmp sample1.bz2 sample1.rb2
     cmp sample2.bz2 sample2.rb2
     cmp sample3.bz2 sample3.rb2
@@ -72,8 +71,8 @@
 install: bzip2 bzip2recover
     if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
     if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
-    if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
-    if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
+    if ( test ! -d $(PREFIX)/share/man ) ; then mkdir -p $(PREFIX)/share/man ; fi
+    if ( test ! -d $(PREFIX)/share/man/man1 ) ; then mkdir -p $(PREFIX)/share/man/man1 ; fi
     if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
     cp -f bzip2 $(PREFIX)/bin/bzip2
     cp -f bzip2 $(PREFIX)/bin/bunzip2
@@ -83,30 +82,28 @@
     chmod a+x $(PREFIX)/bin/bunzip2
     chmod a+x $(PREFIX)/bin/bzcat
     chmod a+x $(PREFIX)/bin/bzip2recover
-    cp -f bzip2.1 $(PREFIX)/man/man1
-    chmod a+r $(PREFIX)/man/man1/bzip2.1
+    cp -f bzip2.1 $(PREFIX)/share/man/man1
+    chmod a+r $(PREFIX)/share/man/man1/bzip2.1
     cp -f bzlib.h $(PREFIX)/include
     chmod a+r $(PREFIX)/include/bzlib.h
-    cp -f libbz2.a $(PREFIX)/lib
-    chmod a+r $(PREFIX)/lib/libbz2.a
     cp -f bzgrep $(PREFIX)/bin/bzgrep
-    ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
-    ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
+    ln -s -f ./bzgrep $(PREFIX)/bin/bzegrep
+    ln -s -f ./bzgrep $(PREFIX)/bin/bzfgrep
     chmod a+x $(PREFIX)/bin/bzgrep
     cp -f bzmore $(PREFIX)/bin/bzmore
-    ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
+    ln -s -f ./bzmore $(PREFIX)/bin/bzless
     chmod a+x $(PREFIX)/bin/bzmore
     cp -f bzdiff $(PREFIX)/bin/bzdiff
-    ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
+    ln -s -f ./bzdiff $(PREFIX)/bin/bzcmp
     chmod a+x $(PREFIX)/bin/bzdiff
-    cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
-    chmod a+r $(PREFIX)/man/man1/bzgrep.1
-    chmod a+r $(PREFIX)/man/man1/bzmore.1
-    chmod a+r $(PREFIX)/man/man1/bzdiff.1
-    echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1
-    echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1
-    echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
-    echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
+    cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/share/man/man1
+    chmod a+r $(PREFIX)/share/man/man1/bzgrep.1
+    chmod a+r $(PREFIX)/share/man/man1/bzmore.1
+    chmod a+r $(PREFIX)/share/man/man1/bzdiff.1
+    echo ".so man1/bzgrep.1" > $(PREFIX)/share/man/man1/bzegrep.1
+    echo ".so man1/bzgrep.1" > $(PREFIX)/share/man/man1/bzfgrep.1
+    echo ".so man1/bzmore.1" > $(PREFIX)/share/man/man1/bzless.1
+    echo ".so man1/bzdiff.1" > $(PREFIX)/share/man/man1/bzcmp.1
 clean:
     rm -f *.o libbz2.a bzip2 bzip2recover \
@@ -132,6 +129,8 @@
     $(CC) $(CFLAGS) -c bzip2.c
 bzip2recover.o: bzip2recover.c
     $(CC) $(CFLAGS) -c bzip2recover.c
+oldapi.o: oldapi.c
+    $(CC) $(CFLAGS) -c oldapi.c
 distclean: clean
components/bzip2/SUNWbzip.p5m
New file
@@ -0,0 +1,36 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
#
#
# Legacy package information for renamed SUNWa2ps package
#
set name=pkg.fmri value=pkg:/SUNWbzip@1.0.5,5.11-0.133
set name=pkg.renamed value=true
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
set name=variant.opensolaris.zone value=global value=nonglobal
set name=variant.arch value=$(ARCH)
depend fmri=compress/bzip2@1.0.5-0.133 type=require
components/bzip2/bzip2.license
New file
@@ -0,0 +1,42 @@
--------------------------------------------------------------------------
This program, "bzip2", the associated library "libbzip2", and all
documentation, are copyright (C) 1996-2010 Julian R Seward.  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. The origin of this software must not be misrepresented; you must
   not claim that you wrote the original software.  If you use this
   software in a product, an acknowledgment in the product
   documentation would be appreciated but is not required.
3. Altered source versions must be plainly marked as such, and must
   not be misrepresented as being the original software.
4. The name of the author may not be used to endorse or promote
   products derived from this software without specific prior written
   permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Julian Seward, jseward@bzip.org
bzip2/libbzip2 version 1.0.6 of 6 September 2010
--------------------------------------------------------------------------
components/bzip2/bzip2.p5m
New file
@@ -0,0 +1,82 @@
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
#
set name=pkg.fmri value=pkg:/compress/bzip2@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)
set name=pkg.summary value="$(COMPONENT_SUMMARY) "
set name=pkg.description value="$(COMPONENT_DESCRIPTION) "
set name=info.classification value="org.opensolaris.category.2008:$(COMPONENT_CLASSIFICATION) "
set name=info.upstream_url value=$(COMPONENT_PROJECT_URL)
set name=info.source_url value=$(COMPONENT_ARCHIVE_URL)
set name=org.opensolaris.consolidation value=$(CONSOLIDATION)
set variant.arch=$(ARCH)
dir path=usr
dir path=usr/bin
dir path=usr/include
dir path=usr/lib
dir path=usr/lib/$(MACH64) variant.arch=$(ARCH)
dir path=usr/share
dir path=usr/share/man
dir path=usr/share/man/man1
dir path=usr/share/man/man3
file path=usr/bin/bunzip2 variant.arch=$(ARCH)
file path=usr/bin/bzcat variant.arch=$(ARCH)
file path=usr/bin/bzdiff
file path=usr/bin/bzgrep
file path=usr/bin/bzip2 variant.arch=$(ARCH)
file path=usr/bin/bzip2recover variant.arch=$(ARCH)
file path=usr/bin/bzmore
file path=usr/include/bzlib.h
file path=usr/lib/$(MACH64)/libbz2.so.1 variant.arch=$(ARCH)
file path=usr/lib/$(MACH64)/llib-lbz2.ln variant.arch=$(ARCH)
file path=usr/lib/libbz2.so.1 variant.arch=$(ARCH)
file path=usr/lib/llib-lbz2
file path=usr/lib/llib-lbz2.ln variant.arch=$(ARCH)
file path=usr/share/man/man1/bunzip2.1
file path=usr/share/man/man1/bzcat.1
file path=usr/share/man/man1/bzcmp.1
file path=usr/share/man/man1/bzdiff.1
file path=usr/share/man/man1/bzegrep.1
file path=usr/share/man/man1/bzfgrep.1
file path=usr/share/man/man1/bzgrep.1
file path=usr/share/man/man1/bzip2.1
file path=usr/share/man/man1/bzip2recover.1
file path=usr/share/man/man1/bzless.1
file path=usr/share/man/man1/bzmore.1
file path=usr/share/man/man3/libbz2.3
link path=usr/bin/bzcmp target=./bzdiff
link path=usr/bin/bzegrep target=./bzgrep
link path=usr/bin/bzfgrep target=./bzgrep
link path=usr/bin/bzless target=./bzmore
link path=usr/lib/$(MACH64)/libbz2.so target=libbz2.so.1 variant.arch=$(ARCH)
link path=usr/lib/libbz2.so target=libbz2.so.1 variant.arch=$(ARCH)
license bzip2.license license="bzip2.license"
legacy arch=$(ARCH) category=system \
    name="The bzip compression utility" \
    desc="The bzip compression utility" \
    hotline="Please contact your local service provider" \
    pkg=SUNWbzip variant.arch=$(ARCH) vendor="Oracle Corporation" \
    version=11.11.0,REV=010.10.26.16.59
set name=variant.opensolaris.zone value=global value=nonglobal
components/bzip2/bzip2.patch
New file
@@ -0,0 +1,55 @@
--- bzip2-1.0.5/bzip2.c.orig    2008-11-28 05:47:09.537546000 -0800
+++ bzip2-1.0.5/bzip2.c    2008-11-28 05:50:37.075934000 -0800
@@ -221,6 +221,7 @@
 static void    copyFileName ( Char*, Char* );
 static void*   myMalloc     ( Int32 );
 static void    applySavedFileAttrToOutputFile ( IntNative fd );
+static void    applySavedTimeInfoToOutputFile ( Char *dstName );
@@ -368,6 +369,7 @@
    if (zStream != stdout) {
       Int32 fd = fileno ( zStream );
       if (fd < 0) goto errhandler_io;
+      applySavedTimeInfoToOutputFile ( outName );
       applySavedFileAttrToOutputFile ( fd );
       ret = fclose ( zStream );
       outputHandleJustInCase = NULL;
@@ -481,17 +483,18 @@
    closeok:
    if (ferror(zStream)) goto errhandler_io;
+   ret = fflush ( stream );
+   if (ret != 0) goto errhandler_io;
    if (stream != stdout) {
       Int32 fd = fileno ( stream );
       if (fd < 0) goto errhandler_io;
+      applySavedTimeInfoToOutputFile ( outName );
       applySavedFileAttrToOutputFile ( fd );
    }
    ret = fclose ( zStream );
    if (ret == EOF) goto errhandler_io;
    if (ferror(stream)) goto errhandler_io;
-   ret = fflush ( stream );
-   if (ret != 0) goto errhandler_io;
    if (stream != stdout) {
       ret = fclose ( stream );
       outputHandleJustInCase = NULL;
@@ -1297,7 +1300,6 @@
    /*--- If there was an I/O error, we won't get here. ---*/
    if ( srcMode == SM_F2F ) {
-      applySavedTimeInfoToOutputFile ( outName );
       deleteOutputOnInterrupt = False;
       if ( !keepInputFiles ) {
          IntNative retVal = remove ( inName );
@@ -1475,7 +1477,6 @@
    /*--- If there was an I/O error, we won't get here. ---*/
    if ( magicNumberOK ) {
       if ( srcMode == SM_F2F ) {
-         applySavedTimeInfoToOutputFile ( outName );
          deleteOutputOnInterrupt = False;
          if ( !keepInputFiles ) {
             IntNative retVal = remove ( inName );
components/bzip2/llib-lbz2
New file
@@ -0,0 +1,73 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
 */
/* LINTLIBRARY */
/* PROTOLIB1 */
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <bzlib.h>
/*
 * usr/src/cmd/bzip2
 */
/*-- Core (low-level) library functions --*/
extern int BZ2_bzCompressInit(bz_stream *strm, int blockSize100k, int verbosity,
    int workFactor);
extern int BZ2_bzCompress(bz_stream *strm, int action);
extern int BZ2_bzCompressEnd(bz_stream *strm);
extern int BZ2_bzDecompressInit(bz_stream *strm, int verbosity, int small);
extern int BZ2_bzDecompress(bz_stream *strm);
extern int BZ2_bzDecompressEnd(bz_stream *strm);
extern BZFILE *BZ2_bzReadOpen(int *bzerror, FILE *f, int verbosity, int small,
    void *unused, int nUnused);
extern void BZ2_bzReadClose(int *bzerror, BZFILE *b);
extern void BZ2_bzReadGetUnused(int *bzerror, BZFILE *b, void **unused,
    int *nUnused);
extern int BZ2_bzRead(int *bzerror, BZFILE *b, void *buf, int len);
extern BZFILE *BZ2_bzWriteOpen(int *bzerror, FILE *f, int blockSize100k,
    int verbosity, int workFactor);
extern void BZ2_bzWrite(int *bzerror, BZFILE *b, void *buf, int len);
extern void BZ2_bzWriteClose(int *bzerror, BZFILE *b, int abandon,
    unsigned int *nbytes_in, unsigned int *nbytes_out);
extern void BZ2_bzWriteClose64(int *bzerror, BZFILE *b, int abandon,
    unsigned int *nbytes_in_lo32, unsigned int *nbytes_in_hi32,
    unsigned int *nbytes_out_lo32, unsigned int *nbytes_out_hi32);
extern int BZ2_bzBuffToBuffCompress(char *dest, unsigned int *destLen,
    char *source, unsigned int sourceLen, int blockSize100k, int verbosity,
    int workFactor);
extern int BZ2_bzBuffToBuffDecompress(char *dest, unsigned int *destLen,
    char *source, unsigned int sourceLen, int small, int verbosity);
extern const char *BZ2_bzlibVersion(void);
extern BZFILE *BZ2_bzopen(const char *path, const char *mode);
extern BZFILE *BZ2_bzdopen(int fd, const char *mode);
extern int BZ2_bzread(BZFILE *b, void *buf, int len);
extern int BZ2_bzwrite(BZFILE *b, void *buf, int len);
extern int BZ2_bzflush(BZFILE *b);
extern void BZ2_bzclose(BZFILE *b);
extern const char *BZ2_bzerror(BZFILE *b, int *errnum);
components/bzip2/manpages/bunzip2.1
New file
@@ -0,0 +1 @@
.so man1/bzip2.1
components/bzip2/manpages/bzcat.1
New file
@@ -0,0 +1 @@
.so man1/bzip2.1
components/bzip2/manpages/bzdiff.1
New file
@@ -0,0 +1,66 @@
'\" t
.\"
.\"
\"Shamelessly copied from zmore.1 by Philippe Troin <phil@fifi.org>
\"for Debian GNU/Linux
.TH BZDIFF 1
.SH NAME
bzcmp, bzdiff \- compare bzip2 compressed files
.SH SYNOPSIS
.B bzcmp
[ cmp_options ] file1
[ file2 ]
.br
.B bzdiff
[ diff_options ] file1
[ file2 ]
.SH DESCRIPTION
.I  Bzcmp
and
.I bzdiff
are used to invoke the
.I cmp
or the
.I diff
program on bzip2 compressed files.  All options specified are passed
directly to
.I cmp
or
.IR diff "."
If only 1 file is specified, then the files compared are
.I file1
and an uncompressed
.IR file1 ".bz2."
If two files are specified, then they are uncompressed if necessary and fed to
.I cmp
or
.IR diff "."
The exit status from
.I cmp
or
.I diff
is preserved.
.SH ATTRIBUTES
See
.BR attributes (5)
for descriptions of the following attributes:
.sp
.TS
box;
cbp-1 | cbp-1
l | l .
ATTRIBUTE TYPE    ATTRIBUTE VALUE
=
Availability    compress/bzip2
=
Interface Stability    Committed
.TE
.PP
.SH "SEE ALSO"
cmp(1), diff(1), bzmore(1), bzless(1), bzgrep(1), bzip2(1)
.SH BUGS
Messages from the
.I cmp
or
.I diff
programs refer to temporary filenames instead of those specified.
components/bzip2/manpages/bzgrep.1
New file
@@ -0,0 +1,75 @@
'\" t
.\"
.\"
\"Shamelessly copied from zmore.1 by Philippe Troin <phil@fifi.org>
\"for Debian GNU/Linux
.TH BZGREP 1
.SH NAME
bzgrep, bzfgrep, bzegrep \- search possibly bzip2 compressed files for a regular expression
.SH SYNOPSIS
.B bzgrep
[ grep_options ]
.BI  [\ -e\ ] " pattern"
.IR filename ".\|.\|."
.br
.B bzegrep
[ egrep_options ]
.BI  [\ -e\ ] " pattern"
.IR filename ".\|.\|."
.br
.B bzfgrep
[ fgrep_options ]
.BI  [\ -e\ ] " pattern"
.IR filename ".\|.\|."
.SH DESCRIPTION
.IR  Bzgrep
is used to invoke the
.I grep
on bzip2-compressed files. All options specified are passed directly to
.I grep.
If no file is specified, then the standard input is decompressed
if necessary and fed to grep.
Otherwise the given files are uncompressed if necessary and fed to
.I grep.
.PP
If
.I bzgrep
is invoked as
.I bzegrep
or
.I bzfgrep
then
.I egrep
or
.I fgrep
is used instead of
.I grep.
If the GREP environment variable is set,
.I bzgrep
uses it as the
.I grep
program to be invoked. For example:
    for sh:  GREP=fgrep  bzgrep string files
    for csh: (setenv GREP fgrep; bzgrep string files)
.SH AUTHOR
Charles Levert (charles@comm.polymtl.ca). Adapted to bzip2 by Philippe
Troin <phil@fifi.org> for Debian GNU/Linux.
.SH ATTRIBUTES
See
.BR attributes (5)
for descriptions of the following attributes:
.sp
.TS
box;
cbp-1 | cbp-1
l | l .
ATTRIBUTE TYPE    ATTRIBUTE VALUE
=
Availability    compress/bzip2
=
Interface Stability    Committed
.TE
.PP
.SH "SEE ALSO"
grep(1), egrep(1), fgrep(1), bzdiff(1), bzmore(1), bzless(1), bzip2(1)
components/bzip2/manpages/bzip2.1
New file
@@ -0,0 +1,477 @@
'\" t
.\"
.\" modified to reference existing Solaris man pages, and to add note
.\" about source availability
.\"
.PU
.TH bzip2 1
.SH NAME
bzip2, bunzip2 \- a block-sorting file compressor, v1.0.6
.br
bzcat \- decompresses files to stdout
.br
bzip2recover \- recovers data from damaged bzip2 files
.SH SYNOPSIS
.ll +8
.B bzip2
.RB [ " \-cdfkqstvzVL123456789 " ]
[
.I "filenames \&..."
]
.ll -8
.br
.B bunzip2
.RB [ " \-fkvsVL " ]
[
.I "filenames \&..."
]
.br
.B bzcat
.RB [ " \-s " ]
[
.I "filenames \&..."
]
.br
.B bzip2recover
.I "filename"
.SH DESCRIPTION
.I bzip2
compresses files using the Burrows-Wheeler block sorting
text compression algorithm, and Huffman coding.  Compression is
generally considerably better than that achieved by more conventional
LZ77/LZ78-based compressors, and approaches the performance of the PPM
family of statistical compressors.
The command-line options are deliberately very similar to
those of
.I GNU gzip,
but they are not identical.
.I bzip2
expects a list of file names to accompany the
command-line flags.  Each file is replaced by a compressed version of
itself, with the name "original_name.bz2".
Each compressed file
has the same modification date, permissions, and, when possible,
ownership as the corresponding original, so that these properties can
be correctly restored at decompression time.  File name handling is
naive in the sense that there is no mechanism for preserving original
file names, permissions, ownerships or dates in filesystems which lack
these concepts, or have serious file name length restrictions, such as
MS-DOS.
.I bzip2
and
.I bunzip2
will by default not overwrite existing
files.  If you want this to happen, specify the \-f flag.
If no file names are specified,
.I bzip2
compresses from standard
input to standard output.  In this case,
.I bzip2
will decline to
write compressed output to a terminal, as this would be entirely
incomprehensible and therefore pointless.
.I bunzip2
(or
.I bzip2 \-d)
decompresses all
specified files.  Files which were not created by
.I bzip2
will be detected and ignored, and a warning issued.
.I bzip2
attempts to guess the filename for the decompressed file
from that of the compressed file as follows:
       filename.bz2    becomes   filename
       filename.bz     becomes   filename
       filename.tbz2   becomes   filename.tar
       filename.tbz    becomes   filename.tar
       anyothername    becomes   anyothername.out
If the file does not end in one of the recognised endings,
.I .bz2,
.I .bz,
.I .tbz2
or
.I .tbz,
.I bzip2
complains that it cannot
guess the name of the original file, and uses the original name
with
.I .out
appended.
As with compression, supplying no
filenames causes decompression from
standard input to standard output.
.I bunzip2
will correctly decompress a file which is the
concatenation of two or more compressed files.  The result is the
concatenation of the corresponding uncompressed files.  Integrity
testing (\-t)
of concatenated
compressed files is also supported.
You can also compress or decompress files to the standard output by
giving the \-c flag.  Multiple files may be compressed and
decompressed like this.  The resulting outputs are fed sequentially to
stdout.  Compression of multiple files
in this manner generates a stream
containing multiple compressed file representations.  Such a stream
can be decompressed correctly only by
.I bzip2
version 0.9.0 or
later.  Earlier versions of
.I bzip2
will stop after decompressing
the first file in the stream.
.I bzcat
(or
.I bzip2 -dc)
decompresses all specified files to
the standard output.
.I bzip2
will read arguments from the environment variables
.I BZIP2
and
.I BZIP,
in that order, and will process them
before any arguments read from the command line.  This gives a
convenient way to supply default arguments.
Compression is always performed, even if the compressed
file is slightly
larger than the original.  Files of less than about one hundred bytes
tend to get larger, since the compression mechanism has a constant
overhead in the region of 50 bytes.  Random data (including the output
of most file compressors) is coded at about 8.05 bits per byte, giving
an expansion of around 0.5%.
As a self-check for your protection,
.I
bzip2
uses 32-bit CRCs to
make sure that the decompressed version of a file is identical to the
original.  This guards against corruption of the compressed data, and
against undetected bugs in
.I bzip2
(hopefully very unlikely).  The
chances of data corruption going undetected is microscopic, about one
chance in four billion for each file processed.  Be aware, though, that
the check occurs upon decompression, so it can only tell you that
something is wrong.  It can't help you
recover the original uncompressed
data.  You can use
.I bzip2recover
to try to recover data from
damaged files.
Return values: 0 for a normal exit, 1 for environmental problems (file
not found, invalid flags, I/O errors, &c), 2 to indicate a corrupt
compressed file, 3 for an internal consistency error (eg, bug) which
caused
.I bzip2
to panic.
.SH OPTIONS
.TP
.B \-c --stdout
Compress or decompress to standard output.
.TP
.B \-d --decompress
Force decompression.
.I bzip2,
.I bunzip2
and
.I bzcat
are
really the same program, and the decision about what actions to take is
done on the basis of which name is used.  This flag overrides that
mechanism, and forces
.I bzip2
to decompress.
.TP
.B \-z --compress
The complement to \-d: forces compression, regardless of the
invocation name.
.TP
.B \-t --test
Check integrity of the specified file(s), but don't decompress them.
This really performs a trial decompression and throws away the result.
.TP
.B \-f --force
Force overwrite of output files.  Normally,
.I bzip2
will not overwrite
existing output files.  Also forces
.I bzip2
to break hard links
to files, which it otherwise wouldn't do.
bzip2 normally declines to decompress files which don't have the
correct magic header bytes.  If forced (-f), however, it will pass
such files through unmodified.  This is how GNU gzip behaves.
.TP
.B \-k --keep
Keep (don't delete) input files during compression
or decompression.
.TP
.B \-s --small
Reduce memory usage, for compression, decompression and testing.  Files
are decompressed and tested using a modified algorithm which only
requires 2.5 bytes per block byte.  This means any file can be
decompressed in 2300k of memory, albeit at about half the normal speed.
During compression, \-s selects a block size of 200k, which limits
memory use to around the same figure, at the expense of your compression
ratio.  In short, if your machine is low on memory (8 megabytes or
less), use \-s for everything.  See MEMORY MANAGEMENT below.
.TP
.B \-q --quiet
Suppress non-essential warning messages.  Messages pertaining to
I/O errors and other critical events will not be suppressed.
.TP
.B \-v --verbose
Verbose mode -- show the compression ratio for each file processed.
Further \-v's increase the verbosity level, spewing out lots of
information which is primarily of interest for diagnostic purposes.
.TP
.B \-L --license -V --version
Display the software version, license terms and conditions.
.TP
.B \-1 (or \-\-fast) to \-9 (or \-\-best)
Set the block size to 100 k, 200 k ..  900 k when compressing.  Has no
effect when decompressing.  See MEMORY MANAGEMENT below.
The \-\-fast and \-\-best aliases are primarily for GNU gzip
compatibility.  In particular, \-\-fast doesn't make things
significantly faster.
And \-\-best merely selects the default behaviour.
.TP
.B \--
Treats all subsequent arguments as file names, even if they start
with a dash.  This is so you can handle files with names beginning
with a dash, for example: bzip2 \-- \-myfilename.
.TP
.B \--repetitive-fast --repetitive-best
These flags are redundant in versions 0.9.5 and above.  They provided
some coarse control over the behaviour of the sorting algorithm in
earlier versions, which was sometimes useful.  0.9.5 and above have an
improved algorithm which renders these flags irrelevant.
.SH MEMORY MANAGEMENT
.I bzip2
compresses large files in blocks.  The block size affects
both the compression ratio achieved, and the amount of memory needed for
compression and decompression.  The flags \-1 through \-9
specify the block size to be 100,000 bytes through 900,000 bytes (the
default) respectively.  At decompression time, the block size used for
compression is read from the header of the compressed file, and
.I bunzip2
then allocates itself just enough memory to decompress
the file.  Since block sizes are stored in compressed files, it follows
that the flags \-1 to \-9 are irrelevant to and so ignored
during decompression.
Compression and decompression requirements,
in bytes, can be estimated as:
       Compression:   400k + ( 8 x block size )
       Decompression: 100k + ( 4 x block size ), or
                      100k + ( 2.5 x block size )
Larger block sizes give rapidly diminishing marginal returns.  Most of
the compression comes from the first two or three hundred k of block
size, a fact worth bearing in mind when using
.I bzip2
on small machines.
It is also important to appreciate that the decompression memory
requirement is set at compression time by the choice of block size.
For files compressed with the default 900k block size,
.I bunzip2
will require about 3700 kbytes to decompress.  To support decompression
of any file on a 4 megabyte machine,
.I bunzip2
has an option to
decompress using approximately half this amount of memory, about 2300
kbytes.  Decompression speed is also halved, so you should use this
option only where necessary.  The relevant flag is -s.
In general, try and use the largest block size memory constraints allow,
since that maximises the compression achieved.  Compression and
decompression speed are virtually unaffected by block size.
Another significant point applies to files which fit in a single block
-- that means most files you'd encounter using a large block size.  The
amount of real memory touched is proportional to the size of the file,
since the file is smaller than a block.  For example, compressing a file
20,000 bytes long with the flag -9 will cause the compressor to
allocate around 7600k of memory, but only touch 400k + 20000 * 8 = 560
kbytes of it.  Similarly, the decompressor will allocate 3700k but only
touch 100k + 20000 * 4 = 180 kbytes.
Here is a table which summarises the maximum memory usage for different
block sizes.  Also recorded is the total compressed size for 14 files of
the Calgary Text Compression Corpus totalling 3,141,622 bytes.  This
column gives some feel for how compression varies with block size.
These figures tend to understate the advantage of larger block sizes for
larger files, since the Corpus is dominated by smaller files.
           Compress   Decompress   Decompress   Corpus
    Flag     usage      usage       -s usage     Size
     -1      1200k       500k         350k      914704
     -2      2000k       900k         600k      877703
     -3      2800k      1300k         850k      860338
     -4      3600k      1700k        1100k      846899
     -5      4400k      2100k        1350k      845160
     -6      5200k      2500k        1600k      838626
     -7      6100k      2900k        1850k      834096
     -8      6800k      3300k        2100k      828642
     -9      7600k      3700k        2350k      828642
.SH RECOVERING DATA FROM DAMAGED FILES
.I bzip2
compresses files in blocks, usually 900kbytes long.  Each
block is handled independently.  If a media or transmission error causes
a multi-block .bz2
file to become damaged, it may be possible to
recover data from the undamaged blocks in the file.
The compressed representation of each block is delimited by a 48-bit
pattern, which makes it possible to find the block boundaries with
reasonable certainty.  Each block also carries its own 32-bit CRC, so
damaged blocks can be distinguished from undamaged ones.
.I bzip2recover
is a simple program whose purpose is to search for
blocks in .bz2 files, and write each block out into its own .bz2
file.  You can then use
.I bzip2
\-t
to test the
integrity of the resulting files, and decompress those which are
undamaged.
.I bzip2recover
takes a single argument, the name of the damaged file,
and writes a number of files "rec00001file.bz2",
"rec00002file.bz2", etc, containing the  extracted  blocks.
The  output  filenames  are  designed  so  that the use of
wildcards in subsequent processing -- for example,
"bzip2 -dc  rec*file.bz2 > recovered_data" -- processes the files in
the correct order.
.I bzip2recover
should be of most use dealing with large .bz2
files,  as  these will contain many blocks.  It is clearly
futile to use it on damaged single-block  files,  since  a
damaged  block  cannot  be recovered.  If you wish to minimise
any potential data loss through media  or  transmission errors,
you might consider compressing with a smaller
block size.
.SH PERFORMANCE NOTES
The sorting phase of compression gathers together similar strings in the
file.  Because of this, files containing very long runs of repeated
symbols, like "aabaabaabaab ..."  (repeated several hundred times) may
compress more slowly than normal.  Versions 0.9.5 and above fare much
better than previous versions in this respect.  The ratio between
worst-case and average-case compression time is in the region of 10:1.
For previous versions, this figure was more like 100:1.  You can use the
\-vvvv option to monitor progress in great detail, if you want.
Decompression speed is unaffected by these phenomena.
.I bzip2
usually allocates several megabytes of memory to operate
in, and then charges all over it in a fairly random fashion.  This means
that performance, both for compressing and decompressing, is largely
determined by the speed at which your machine can service cache misses.
Because of this, small changes to the code to reduce the miss rate have
been observed to give disproportionately large performance improvements.
I imagine
.I bzip2
will perform best on machines with very large caches.
.SH CAVEATS
I/O error messages are not as helpful as they could be.
.I bzip2
tries hard to detect I/O errors and exit cleanly, but the details of
what the problem is sometimes seem rather misleading.
This manual page pertains to version 1.0.6 of
.I bzip2.
Compressed data created by this version is entirely forwards and
backwards compatible with the previous public releases, versions
0.1pl2, 0.9.0, 0.9.5, 1.0.0, 1.0.1, 1.0.2 and above, but with the following
exception: 0.9.0 and above can correctly decompress multiple
concatenated compressed files.  0.1pl2 cannot do this; it will stop
after decompressing just the first file in the stream.
.I bzip2recover
versions prior to 1.0.2 used 32-bit integers to represent
bit positions in compressed files, so they could not handle compressed
files more than 512 megabytes long.  Versions 1.0.2 and above use
64-bit ints on some platforms which support them (GNU supported
targets, and Windows).  To establish whether or not bzip2recover was
built with such a limitation, run it without arguments.  In any event
you can build yourself an unlimited version if you can recompile it
with MaybeUInt64 set to be an unsigned 64-bit integer.
.SH AUTHOR
Julian Seward, jsewardbzip.org.
http://www.bzip.org
The ideas embodied in
.I bzip2
are due to (at least) the following
people: Michael Burrows and David Wheeler (for the block sorting
transformation), David Wheeler (again, for the Huffman coder), Peter
Fenwick (for the structured coding model in the original
.I bzip,
and many refinements), and Alistair Moffat, Radford Neal and Ian Witten
(for the arithmetic coder in the original
.I bzip).
I am much
indebted for their help, support and advice.  See the manual in the
source distribution for pointers to sources of documentation.  Christian
von Roques encouraged me to look for faster sorting algorithms, so as to
speed up compression.  Bela Lubkin encouraged me to improve the
worst-case compression performance.
Donna Robinson XMLised the documentation.
The bz* scripts are derived from those of GNU gzip.
Many people sent patches, helped
with portability problems, lent machines, gave advice and were generally
helpful.
.SH ATTRIBUTES
See
.BR attributes (5)
for descriptions of the following attributes:
.sp
.TS
box;
cbp-1 | cbp-1
l | l .
ATTRIBUTE TYPE    ATTRIBUTE VALUE
=
Availability    compress/bzip2
=
Interface Stability    Committed
.TE
.PP
.SH NOTES
Source for bzip2 is available on http://opensolaris.org.
components/bzip2/manpages/bzip2recover.1
New file
@@ -0,0 +1 @@
.so man1/bzip2.1
components/bzip2/manpages/bzmore.1
New file
@@ -0,0 +1,171 @@
'\" t
.\"
.\"
.\"Shamelessly copied from zmore.1 by Philippe Troin <phil@fifi.org>
.\"for Debian GNU/Linux
.TH BZMORE 1
.SH NAME
bzmore, bzless \- file perusal filter for crt viewing of bzip2 compressed text
.SH SYNOPSIS
.B bzmore
[ name ...  ]
.br
.B bzless
[ name ...  ]
.SH NOTE
In the following description,
.I bzless
and
.I less
can be used interchangeably with
.I bzmore
and
.I more.
.SH DESCRIPTION
.I  Bzmore
is a filter which allows examination of compressed or plain text files
one screenful at a time on a soft-copy terminal.
.I bzmore
works on files compressed with
.I bzip2
and also on uncompressed files.
If a file does not exist,
.I bzmore
looks for a file of the same name with the addition of a .bz2 suffix.
.PP
.I Bzmore
normally pauses after each screenful, printing --More--
at the bottom of the screen.
If the user then types a carriage return, one more line is displayed.
If the user hits a space,
another screenful is displayed.  Other possibilities are enumerated later.
.PP
.I Bzmore
looks in the file
.I /etc/termcap
to determine terminal characteristics,
and to determine the default window size.
On a terminal capable of displaying 24 lines,
the default window size is 22 lines.
Other sequences which may be typed when
.I bzmore
pauses, and their effects, are as follows (\fIi\fP is an optional integer
argument, defaulting to 1) :
.PP
.IP \fIi\|\fP<space>
display
.I i
more lines, (or another screenful if no argument is given)
.PP
.IP ^D
display 11 more lines (a ``scroll'').
If
.I i
is given, then the scroll size is set to \fIi\|\fP.
.PP
.IP d
same as ^D (control-D)
.PP
.IP \fIi\|\fPz
same as typing a space except that \fIi\|\fP, if present, becomes the new
window size.  Note that the window size reverts back to the default at the
end of the current file.
.PP
.IP \fIi\|\fPs
skip \fIi\|\fP lines and print a screenful of lines
.PP
.IP \fIi\|\fPf
skip \fIi\fP screenfuls and print a screenful of lines
.PP
.IP "q or Q"
quit reading the current file; go on to the next (if any)
.PP
.IP "e or q"
When the prompt --More--(Next file:
.IR file )
is printed, this command causes bzmore to exit.
.PP
.IP s
When the prompt --More--(Next file:
.IR file )
is printed, this command causes bzmore to skip the next file and continue.
.PP
.IP =
Display the current line number.
.PP
.IP \fIi\|\fP/expr
search for the \fIi\|\fP-th occurrence of the regular expression \fIexpr.\fP
If the pattern is not found,
.I bzmore
goes on to the next file (if any).
Otherwise, a screenful is displayed, starting two lines before the place
where the expression was found.
The user's erase and kill characters may be used to edit the regular
expression.
Erasing back past the first column cancels the search command.
.PP
.IP \fIi\|\fPn
search for the \fIi\|\fP-th occurrence of the last regular expression entered.
.PP
.IP !command
invoke a shell with \fIcommand\|\fP.
The character `!' in "command" are replaced with the
previous shell command.  The sequence "\\!" is replaced by "!".
.PP
.IP ":q or :Q"
quit reading the current file; go on to the next (if any)
(same as q or Q).
.PP
.IP .
(dot) repeat the previous command.
.PP
The commands take effect immediately, i.e., it is not necessary to
type a carriage return.
Up to the time when the command character itself is given,
the user may hit the line kill character to cancel the numerical
argument being formed.
In addition, the user may hit the erase character to redisplay the
--More-- message.
.PP
At any time when output is being sent to the terminal, the user can
hit the quit key (normally control\-\\).
.I Bzmore
will stop sending output, and will display the usual --More--
prompt.
The user may then enter one of the above commands in the normal manner.
Unfortunately, some output is lost when this is done, due to the
fact that any characters waiting in the terminal's output queue
are flushed when the quit signal occurs.
.PP
The terminal is set to
.I noecho
mode by this program so that the output can be continuous.
What you type will thus not show on your terminal, except for the / and !
commands.
.PP
If the standard output is not a teletype, then
.I bzmore
acts just like
.I bzcat,
except that a header is printed before each file.
.SH FILES
.DT
/etc/termcap        Terminal data base
.SH ATTRIBUTES
See
.BR attributes (5)
for descriptions of the following attributes:
.sp
.TS
box;
cbp-1 | cbp-1
l | l .
ATTRIBUTE TYPE    ATTRIBUTE VALUE
=
Availability    compress/bzip2
=
Interface Stability    Committed
.TE
.PP
.SH "SEE ALSO"
more(1), less(1), bzip2(1), bzdiff(1), bzgrep(1)
components/bzip2/manpages/libbz2.3
New file
@@ -0,0 +1,107 @@
'\" t
.TH libbz2 3 "8 Oct 1999"
.SH NAME
libbz2 \- library for block-sorting data compression
.SH SYNOPSIS
.LP
.B cc
.RI "[ " "flag " \|.\|.\|. ] " "file \|.\|.\|."
.B \-lbz2
.RI "[ " "library" " \|.\|.\|. ]"
.sp 1n
.nf
.ft 3
#include <stdio.h>
#include <bzlib.h>
.ft
.fi
.SH DESCRIPTION
Interfaces in this library provide the ability to compress (and
decompress) files using the Burrows-Wheeler blocksorting text compression
algorithm, and  Huffman  coding. It is provided along with the
.BR bzip2(1)
utility.
See
.BR bzip2(1)
for more information.
.LP
The source distribution of bzip2 contains a description of how to
use this library in HTML form.
.LP
For additional information on shared object interfaces,  see
.BR intro(3).
.SH INTERFACES
.nf
BZ2_bzCompressInit
BZ2_bzCompress
BZ2_bzCompressEnd
BZ2_bzDecompressInit
BZ2_bzDecompress
BZ2_bzDecompressEnd
BZ2_bzReadOpen
BZ2_bzReadClose
BZ2_bzReadGetUnused
BZ2_bzRead
BZ2_bzWriteOpen
BZ2_bzWrite
BZ2_bzWriteClose
BZ2_bzBuffToBuffCompress
BZ2_bzBuffToBuffDecompress
BZ2_bzlibVersion
BZ2_bzopen
BZ2_bzdopen
BZ2_bzread
BZ2_bzwrite
BZ2_bzflush
BZ2_bzclose
.fi
.SH FILES
.PD 0
.TP 20
/usr/lib/libbz2.so.1
shared object
.TP
/usr/lib/64/libbz2.so.1
64-bit shared object
.PD
.SH "SEE ALSO"
bzip2(1), intro(3)
.SH AUTHOR
Julian Seward, jseward@acm.org.
http://sourceware.cygnus.com/bzip2
http://www.muraroa.demon.co.uk
The ideas embodied in bzip2 are due to (at least) the fol-
lowing people: Michael Burrows and David Wheeler (for  the
block  sorting  transformation), David Wheeler (again, for
the Huffman coder), Peter Fenwick (for the structured cod-
ing model in the original bzip, and many refinements), and
Alistair Moffat, Radford Neal  and  Ian  Witten  (for  the
arithmetic  coder  in  the  original  bzip).   I  am  much
indebted for their help, support and advice.  See the man-
ual  in the source distribution for pointers to sources of
documentation.  Christian von Roques encouraged me to look
for  faster sorting algorithms, so as to speed up compres-
sion.  Bela Lubkin encouraged me to improve the worst-case
compression performance.  Many people sent patches, helped
with portability problems, lent machines, gave advice  and
were generally helpful.
.SH ATTRIBUTES
See
.BR attributes (5)
for descriptions of the following attributes:
.sp
.TS
box;
cbp-1 | cbp-1
l | l .
ATTRIBUTE TYPE    ATTRIBUTE VALUE
=
Availability    compress/bzip2
=
Interface Stability    Committed
.TE
.PP
.SH NOTES
Source for libbz is available on http://opensolaris.org.
components/bzip2/mapfile
New file
@@ -0,0 +1,95 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# MAPFILE HEADER START
#
# WARNING:  STOP NOW.  DO NOT MODIFY THIS FILE.
# Object versioning must comply with the rules detailed in
#
#    usr/src/lib/README.mapfiles
#
# You should not be making modifications here until you've read the most current
# copy of that file. If you need help, contact a gatekeeper for guidance.
#
# MAPFILE HEADER END
#
# Note that the source above actually lives in the ON tree.
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
$mapfile_version 2
SYMBOL_VERSION SUNW_1.2 {
    global:
    BZ2_bzCompressInit ;
    BZ2_bzCompress ;
    BZ2_bzCompressEnd ;
    BZ2_bzDecompressInit ;
    BZ2_bzDecompress ;
    BZ2_bzDecompressEnd ;
    BZ2_bzReadOpen ;
    BZ2_bzReadClose ;
    BZ2_bzReadGetUnused ;
    BZ2_bzRead ;
    BZ2_bzWriteOpen ;
    BZ2_bzWrite ;
    BZ2_bzWriteClose ;
    BZ2_bzBuffToBuffCompress ;
    BZ2_bzBuffToBuffDecompress ;
    BZ2_bzlibVersion ;
    BZ2_bzopen ;
    BZ2_bzdopen ;
    BZ2_bzread ;
    BZ2_bzwrite ;
    BZ2_bzflush ;
    BZ2_bzclose ;
    BZ2_bzerror ;
    BZ2_bzWriteClose64 ;
    local:
    *;
} SUNW_1.1;
SYMBOL_VERSION SUNW_1.1 {
    global:
    bzCompressInit ;
    bzCompress ;
    bzCompressEnd ;
    bzDecompressInit ;
    bzDecompress ;
    bzDecompressEnd ;
    bzReadOpen ;
    bzReadClose ;
    bzReadGetUnused ;
    bzRead ;
    bzWriteOpen ;
    bzWrite ;
    bzWriteClose ;
    bzBuffToBuffCompress ;
    bzBuffToBuffDecompress ;
    bzlibVersion ;
    bzopen ;
    bzdopen ;
    bzread ;
    bzwrite ;
    bzflush ;
    bzclose ;
    bzerror ;
};
components/bzip2/oldapi.c
New file
@@ -0,0 +1,178 @@
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 *  Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
 */
#include <stdio.h>
#include "bzlib.h"
/*
 * Wrappers for the old names. For compatibility with Solaris 8.
 */
int
bzCompressInit(bz_stream *strm, int blockSize100k, int verbosity,
    int workFactor)
{
    return (BZ2_bzCompressInit(strm, blockSize100k, verbosity, workFactor));
}
int
bzCompress(bz_stream *strm, int action)
{
    return (BZ2_bzCompress(strm, action));
}
int
bzCompressEnd(bz_stream *strm)
{
    return (BZ2_bzCompressEnd(strm));
}
int
bzDecompressInit(bz_stream *strm, int verbosity, int small)
{
    return (BZ2_bzDecompressInit(strm, verbosity, small));
}
int
bzDecompress(bz_stream *strm)
{
    return (BZ2_bzDecompress(strm));
}
int
bzDecompressEnd(bz_stream *strm)
{
    return (BZ2_bzDecompressEnd(strm));
}
BZFILE *
bzReadOpen(int *bzerror, FILE *f, int verbosity, int small, void *unused,
    int nUnused)
{
    return (BZ2_bzReadOpen(bzerror, f, verbosity, small, unused, nUnused));
}
void
bzReadClose(int *bzerror, BZFILE *b)
{
    BZ2_bzReadClose(bzerror, b);
}
void
bzReadGetUnused(int *bzerror, BZFILE *b, void **unused, int *nUnused)
{
    BZ2_bzReadGetUnused(bzerror, b, unused, nUnused);
}
int
bzRead(int *bzerror, BZFILE *b, void *buf, int len)
{
    return (BZ2_bzRead(bzerror, b, buf, len));
}
BZFILE *
bzWriteOpen(int *bzerror, FILE *f, int blockSize100k, int verbosity,
    int workFactor)
{
    return (BZ2_bzWriteOpen(bzerror, f, blockSize100k, verbosity,
        workFactor));
}
void
bzWrite(int *bzerror, BZFILE *b, void *buf, int len)
{
    BZ2_bzWrite(bzerror, b, buf, len);
}
void
bzWriteClose(int *bzerror, BZFILE *b, int abandon, unsigned int *nbytes_in,
    unsigned int *nbytes_out)
{
    BZ2_bzWriteClose(bzerror, b, abandon, nbytes_in, nbytes_out);
}
int
bzBuffToBuffCompress(char *dest, unsigned int *destLen, char *source,
    unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor)
{
    return (BZ2_bzBuffToBuffCompress(dest, destLen, source, sourceLen,
        blockSize100k, verbosity, workFactor));
}
int
bzBuffToBuffDecompress(char *dest, unsigned int *destLen, char *source,
    unsigned int sourceLen, int small, int verbosity)
{
    return (BZ2_bzBuffToBuffDecompress(dest, destLen, source, sourceLen,
        small, verbosity));
}
const char *
bzlibVersion(void)
{
    return (BZ2_bzlibVersion());
}
BZFILE *
bzopen(const char *path, const char *mode)
{
    return (BZ2_bzopen(path, mode));
}
BZFILE *
bzdopen(int fd, const char *mode)
{
    return (BZ2_bzdopen(fd, mode));
}
int
bzread(BZFILE *b, void *buf, int len)
{
    return (BZ2_bzread(b, buf, len));
}
int
bzwrite(BZFILE *b, void *buf, int len)
{
    return (BZ2_bzwrite(b, buf, len));
}
int
bzflush(BZFILE *b)
{
    return (BZ2_bzflush(b));
}
void
bzclose(BZFILE *b)
{
    BZ2_bzclose(b);
}
const char *
bzerror(BZFILE *b, int *errnum)
{
    return (BZ2_bzerror(b, errnum));
}
make-rules/justmake.mk
New file
@@ -0,0 +1,76 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
#
#
# Rules and Macros for building opens source software that just uses their
# own make and no autoconf-style tools.
#
# To use these rules, include ../make-rules/justmake.mk in your Makefile
# and define "build", "install" targets appropriate to building your component.
# Ex:
#
#     build:        $(BUILD_32) \
#             $(BUILD_64)
#
#    install:    $(INSTALL_32) \
#             $(INSTALL_64)
#
# Any additional pre/post configure, build, or install actions can be specified
# in your Makefile by setting them in on of the following macros:
#    COMPONENT_PRE_BUILD_ACTION, COMPONENT_POST_BUILD_ACTION
#    COMPONENT_PRE_INSTALL_ACTION, COMPONENT_POST_INSTALL_ACTION
#
# If component specific make targets need to be used for build or install, they
# can be specified in
#    COMPONENT_BUILD_TARGETS, COMPONENT_INSTALL_TARGETS
#
CLONEY =    $(WS_TOOLS)/cloney
$(BUILD_DIR_32)/.built:    BITS=32
$(BUILD_DIR_64)/.built:    BITS=64
$(BUILD_DIR_32)/.install:    BITS=32
$(BUILD_DIR_64)/.install:    BITS=64
# set the default target for installation of the component
COMPONENT_INSTALL_TARGETS =    install
# build the configured source
$(BUILD_DIR)/%/.built:    $(SOURCE_DIR)/.prep
    $(RM) -r $(@D) ; $(MKDIR) $(@D)
    $(CLONEY) $(SOURCE_DIR) $(@D)
    $(COMPONENT_PRE_BUILD_ACTION)
    (cd $(@D) ; $(ENV) $(COMPONENT_BUILD_ENV) \
        $(GMAKE) $(COMPONENT_BUILD_TARGETS))
    $(COMPONENT_POST_BUILD_ACTION)
    $(TOUCH) $@
# install the built source into a prototype area
$(BUILD_DIR)/%/.installed:    $(BUILD_DIR)/%/.built
    $(COMPONENT_PRE_INSTALL_ACTION)
    (cd $(@D) ; $(ENV) $(COMPONENT_INSTALL_ENV) $(GMAKE) \
            $(COMPONENT_INSTALL_TARGETS))
    $(COMPONENT_POST_INSTALL_ACTION)
    $(TOUCH) $@
clean::
    $(RM) -r $(BUILD_DIR) $(PROTO_DIR)
make-rules/shared-macros.mk
@@ -60,6 +60,26 @@
BUILD_DIR =    $(shell pwd)/build
PROTO_DIR =    $(BUILD_DIR)/prototype/$(MACH)
USRDIR =    /usr
BINDIR =    /bin
LIBDIR =    /lib
USRBINDIR =    $(USRDIR)/bin
USRLIBDIR =    $(USRDIR)/lib
USRSHAREDIR =    $(USRDIR)/share
USRSHAREMANDIR =    $(USRSHAREDIR)/man
USRSHAREMAN1DIR =    $(USRSHAREMANDIR)/man1
USRSHAREMAN3DIR =    $(USRSHAREMANDIR)/man3
USRLIBDIR64 =    $(USRDIR)/lib/$(MACH64)
PROTOUSRDIR =    $(PROTO_DIR)/$(USRDIR)
PROTOUSRBINDIR =    $(PROTO_DIR)/$(USRBINDIR)
PROTOUSRLIBDIR =    $(PROTO_DIR)/$(USRLIBDIR)
PROTOUSRLIBDIR64 =    $(PROTO_DIR)/$(USRLIBDIR64)
PROTOUSRSHAREDIR =    $(PROTO_DIR)/$(USRSHAREDIR)
PROTOUSRSHAREMANDIR =    $(PROTO_DIR)/$(USRSHAREMANDIR)
PROTOUSRSHAREMAN1DIR =    $(PROTO_DIR)/$(USRSHAREMAN1DIR)
PROTOUSRSHAREMAN3DIR =    $(PROTO_DIR)/$(USRSHAREMAN3DIR)
SFWBIN =    /usr/sfw/bin
SFWLIB =    /usr/sfw/lib
PROTOSFWBIN =    $(PROTO_DIR)/$(SFWBIN)
@@ -83,12 +103,15 @@
MACH64_1 =    $(MACH:sparc=sparcv9)
MACH64 =    $(MACH64_1:i386=amd64)
BUILD_32 =        $(BUILD_DIR)/$(MACH32)/.built
BUILD_64 =        $(BUILD_DIR)/$(MACH64)/.built
BUILD_DIR_32 =        $(BUILD_DIR)/$(MACH32)
BUILD_DIR_64 =        $(BUILD_DIR)/$(MACH64)
BUILD_32 =        $(BUILD_DIR_32)/.built
BUILD_64 =        $(BUILD_DIR_64)/.built
BUILD_32_and_64 =    $(BUILD_32) $(BUILD_64)
INSTALL_32 =        $(BUILD_DIR)/$(MACH32)/.installed
INSTALL_64 =        $(BUILD_DIR)/$(MACH64)/.installed
INSTALL_32 =        $(BUILD_DIR_32)/.installed
INSTALL_64 =        $(BUILD_DIR_64)/.installed
INSTALL_32_and_64 =    $(INSTALL_32) $(INSTALL_64)
# BUILD_TOOLS is the root of all tools not normally installed on the system.
@@ -114,6 +137,11 @@
CC =        $(CC.$(COMPILER).$(BITS))
CCC =        $(CCC.$(COMPILER).$(BITS))
lint.32 =    $(SPRO_VROOT)/bin/lint -m32
lint.64 =    $(SPRO_VROOT)/bin/lint -m64
LINT =        $(lint.$(BITS))
LD =        /usr/bin/ld
PYTHON.2.6.32 =    /usr/bin/python2.6
@@ -136,3 +164,75 @@
SYMLINK =    /bin/ln -s
ENV =        /usr/bin/env
INSTALL =    /usr/bin/ginstall
INS.dir=        $(INSTALL) -d $@
INS.file=       $(INSTALL) -m 444 $< $(@D)
# C compiler mode. Future compilers may change the default on us,
# so force transition mode globally. Lower level makefiles can
# override this by setting CCMODE.
#
CCMODE=        -Xa
CCMODE64=    -Xa
# compiler '-xarch' flag. This is here to centralize it and make it
# overridable for testing.
sparc_XARCH=    $(CCBITS32) -xarch=sparc
sparcv9_XARCH=  $(CCBITS64) -xcode=abs64
i386_XARCH=     $(CCBITS32) -xchip=pentium
amd64_XARCH=    $(CCBITS64) -xarch=generic -Ui386 -U__i386
# disable the incremental linker
ILDOFF=         -xildoff
# C99 mode
C99_ENABLE=     -xc99=all
C99_DISABLE=    -xc99=none
C99MODE=        $(C99_ENABLE)
C99LMODE=       $(C99MODE:-xc99%=-Xc99%)
# XPG6 mode.  This option enables XPG6 conformance, plus extensions.
# Amongst other things, this option will cause system calls like
# popen (3C) and system (3C) to invoke the standards-conforming
# shell, /usr/xpg4/bin/sh, instead of /usr/bin/sh.
XPG6MODE=    $(C99MODE) -D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1
# The Sun Studio 11 compiler has changed the behaviour of integer
# wrap arounds and so a flag is needed to use the legacy behaviour
# (without this flag panics/hangs could be exposed within the source).
#
sparc_IROPTFLAG        = -W2,-xwrap_int
sparcv9_IROPTFLAG    = -W2,-xwrap_int
i386_IROPTFLAG        =
amd64_IROPTFLAG        =
IROPTFLAG        = $($(MACH)_IROPTFLAG)
IROPTFLAG64        = $($(MACH64)_IROPTFLAG)
sparc_CFLAGS=    $(sparc_XARCH)
sparcv9_CFLAGS=    $(sparcv9_XARCH) -dalign $(CCVERBOSE)
i386_CFLAGS=    $(i386_XARCH)
amd64_CFLAGS=    $(amd64_XARCH)
sparc_COPTFLAG=        -xO3
sparcv9_COPTFLAG=    -xO3
i386_COPTFLAG=        -xO3
amd64_COPTFLAG=        -xO3
COPTFLAG= $($(MACH)_COPTFLAG)
COPTFLAG64= $($(MACH64)_COPTFLAG)
sparc_XREGSFLAG        = -xregs=no%appl
sparcv9_XREGSFLAG    = -xregs=no%appl
i386_XREGSFLAG        =
amd64_XREGSFLAG        =
XREGSFLAG        = $($(MACH)_XREGSFLAG)
XREGSFLAG64        = $($(MACH64)_XREGSFLAG)
CFLAGS=  \
    $(COPTFLAG) $($(MACH)_CFLAGS) $(CCMODE) \
    $(ILDOFF) $(C99MODE) $(IROPTFLAG)
CFLAGS64= \
    $(COPTFLAG64) $($(MACH64)_CFLAGS) $(CCMODE64) \
    $(ILDOFF) $(C99MODE) $(IROPTFLAG64)
tools/cloney
New file
@@ -0,0 +1,51 @@
#!/bin/ksh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
#
# clone a directory to another using symlinks, in a very clunky way
if [ $# != 2 ]; then
    echo "usage $0 srcdir destdir"
    exit 1
fi
srcdir=$1
destdir=$2
PATH=/usr/bin
echo symlink cloning $srcdir to $destdir
cd ${srcdir}
for i in `gfind . -type d | \
    grep -v '^.$' | \
    gsed -e 's,^./,,'`
do
    mkdir -p ${destdir}/$i
done
for i in `gfind . -type f | \
    gsed -e 's,^./,,'`
do
    rm -f ${destdir}/$i
    ln -s ${srcdir}/$i ${destdir}/$i
done