Merging upstream version 1.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
b375923f9b
commit
fa78de0b15
13 changed files with 129 additions and 103 deletions
4
Alloc.c
4
Alloc.c
|
@ -1,7 +1,5 @@
|
||||||
/* Alloc.c -- Memory allocation functions
|
/* Alloc.c -- Memory allocation functions
|
||||||
2008-09-24
|
2008-09-24 : Igor Pavlov : Public domain */
|
||||||
Igor Pavlov
|
|
||||||
Public domain */
|
|
||||||
|
|
||||||
#define _FILE_OFFSET_BITS 64
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
|
||||||
|
|
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,10 @@
|
||||||
|
2012-01-03 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
|
||||||
|
* Version 1.3 released.
|
||||||
|
* Small change in '--help' output and man page.
|
||||||
|
* Changed quote characters in messages as advised by GNU Standards.
|
||||||
|
* main.c: Set stdin/stdout in binary mode on OS2.
|
||||||
|
|
||||||
2011-01-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
2011-01-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
|
||||||
* Version 1.2 released.
|
* Version 1.2 released.
|
||||||
|
@ -11,7 +18,7 @@
|
||||||
reduced to extend range of use towards gzip. Lower numbers now
|
reduced to extend range of use towards gzip. Lower numbers now
|
||||||
compress less but faster. (-1 now takes 43% less time for only
|
compress less but faster. (-1 now takes 43% less time for only
|
||||||
20% larger compressed size).
|
20% larger compressed size).
|
||||||
* Code has been converted to `C89 + long long' from C99.
|
* Code has been converted to 'C89 + long long' from C99.
|
||||||
|
|
||||||
2010-04-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
2010-04-05 Antonio Diaz Diaz <ant_diaz@teleline.es>
|
||||||
|
|
||||||
|
@ -20,7 +27,7 @@
|
||||||
* Using LZMA SDK 9.10 (public domain) from Igor Pavlov.
|
* Using LZMA SDK 9.10 (public domain) from Igor Pavlov.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This file is a collection of facts, and thus it is not copyrightable,
|
This file is a collection of facts, and thus it is not copyrightable,
|
||||||
but just in case, you have unlimited permission to copy, distribute and
|
but just in case, you have unlimited permission to copy, distribute and
|
||||||
|
|
24
INSTALL
24
INSTALL
|
@ -18,7 +18,7 @@ This creates the directory ./pdlzip[version] containing the source from
|
||||||
the main archive.
|
the main archive.
|
||||||
|
|
||||||
2. Change to pdlzip directory and run configure.
|
2. Change to pdlzip directory and run configure.
|
||||||
(Try `configure --help' for usage instructions).
|
(Try 'configure --help' for usage instructions).
|
||||||
|
|
||||||
cd pdlzip[version]
|
cd pdlzip[version]
|
||||||
./configure
|
./configure
|
||||||
|
@ -27,30 +27,30 @@ the main archive.
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
4. Optionally, type `make check' to run the tests that come with pdlzip.
|
4. Optionally, type 'make check' to run the tests that come with pdlzip.
|
||||||
|
|
||||||
5. Type `make install' to install the program and any data files and
|
5. Type 'make install' to install the program and any data files and
|
||||||
documentation.
|
documentation.
|
||||||
|
|
||||||
|
|
||||||
Another way
|
Another way
|
||||||
-----------
|
-----------
|
||||||
You can also compile pdlzip into a separate directory. To do this, you
|
You can also compile pdlzip into a separate directory. To do this, you
|
||||||
must use a version of `make' that supports the `VPATH' variable, such
|
must use a version of 'make' that supports the 'VPATH' variable, such
|
||||||
as GNU `make'. `cd' to the directory where you want the object files
|
as GNU 'make'. 'cd' to the directory where you want the object files
|
||||||
and executables to go and run the `configure' script. `configure'
|
and executables to go and run the 'configure' script. 'configure'
|
||||||
automatically checks for the source code in `.', in `..' and in the
|
automatically checks for the source code in '.', in '..' and in the
|
||||||
directory that `configure' is in.
|
directory that 'configure' is in.
|
||||||
|
|
||||||
`configure' recognizes the option `--srcdir=DIR' to control where to
|
'configure' recognizes the option '--srcdir=DIR' to control where to
|
||||||
look for the sources. Usually `configure' can determine that directory
|
look for the sources. Usually 'configure' can determine that directory
|
||||||
automatically.
|
automatically.
|
||||||
|
|
||||||
After running `configure', you can run `make' and `make install' as
|
After running 'configure', you can run 'make' and 'make install' as
|
||||||
explained above.
|
explained above.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This file is free documentation: you have unlimited permission to copy,
|
This file is free documentation: you have unlimited permission to copy,
|
||||||
distribute and modify it.
|
distribute and modify it.
|
||||||
|
|
20
Makefile.in
20
Makefile.in
|
@ -7,7 +7,7 @@ INSTALL_DIR = $(INSTALL) -d -m 755
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
|
||||||
objs = 7zFile.o 7zStream.o Alloc.o LzFind.o LzmaDec.o LzmaEnc.o \
|
objs = 7zFile.o 7zStream.o Alloc.o LzFind.o LzmaDec.o LzmaEnc.o \
|
||||||
carg_parser.o main.o
|
pdarg_parser.o main.o
|
||||||
|
|
||||||
|
|
||||||
.PHONY : all install install-info install-man install-strip \
|
.PHONY : all install install-info install-man install-strip \
|
||||||
|
@ -28,15 +28,15 @@ main.o : main.c
|
||||||
%.o : %.c
|
%.o : %.c
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
$(objs) : Makefile
|
$(objs) : Makefile
|
||||||
7zFile.o : 7zFile.h Types.h
|
7zFile.o : 7zFile.h Types.h
|
||||||
7zStream.o : Types.h
|
7zStream.o : Types.h
|
||||||
Alloc.o : Alloc.h
|
Alloc.o : Alloc.h
|
||||||
LzFind.o : LzFind.h LzHash.h Types.h pdlzip.h
|
LzFind.o : LzFind.h LzHash.h Types.h pdlzip.h
|
||||||
LzmaDec.o : LzmaDec.h Types.h
|
LzmaDec.o : LzmaDec.h Types.h
|
||||||
LzmaEnc.o : LzFind.h LzmaEnc.h Types.h pdlzip.h
|
LzmaEnc.o : LzFind.h LzmaEnc.h Types.h pdlzip.h
|
||||||
carg_parser.o : carg_parser.h
|
pdarg_parser.o : pdarg_parser.h
|
||||||
main.o : 7zFile.h Alloc.h LzmaDec.h LzmaEnc.h carg_parser.h pdlzip.h
|
main.o : 7zFile.h Alloc.h LzmaDec.h LzmaEnc.h pdarg_parser.h pdlzip.h
|
||||||
|
|
||||||
|
|
||||||
doc : man
|
doc : man
|
||||||
|
|
9
NEWS
9
NEWS
|
@ -1,3 +1,8 @@
|
||||||
Changes in version 1.2:
|
Changes in version 1.3:
|
||||||
|
|
||||||
Code cleanup. Minor fixes.
|
A small change has been made in the "--help" output and man page.
|
||||||
|
|
||||||
|
Quote characters in messages have been changed as advised by GNU Coding
|
||||||
|
Standards.
|
||||||
|
|
||||||
|
Standard input and standard output are now set in binary mode on OS2.
|
||||||
|
|
8
README
8
README
|
@ -8,15 +8,15 @@ and data archiving.
|
||||||
|
|
||||||
Pdlzip is also able to decompress legacy lzma-alone (.lzma) files.
|
Pdlzip is also able to decompress legacy lzma-alone (.lzma) files.
|
||||||
|
|
||||||
Pdlzip is a public domain version of the lzip data compressor, intended
|
Pdlzip is a "public domain" version of the lzip data compressor,
|
||||||
for those who can't distribute GPL licensed Free Software. Pdlzip is
|
intended for those who can't distribute GPL licensed Free Software.
|
||||||
written in C.
|
Pdlzip is written in C.
|
||||||
|
|
||||||
Pdlzip uses public domain compression code from the LZMA SDK written by
|
Pdlzip uses public domain compression code from the LZMA SDK written by
|
||||||
Igor Pavlov.
|
Igor Pavlov.
|
||||||
|
|
||||||
|
|
||||||
Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This file is free documentation: you have unlimited permission to copy,
|
This file is free documentation: you have unlimited permission to copy,
|
||||||
distribute and modify it.
|
distribute and modify it.
|
||||||
|
|
8
configure
vendored
8
configure
vendored
|
@ -1,16 +1,14 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# configure script for Pdlzip - Data compressor based on the LZMA algorithm
|
# configure script for Pdlzip - Data compressor based on the LZMA algorithm
|
||||||
# Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
# Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
#
|
#
|
||||||
# This configure script is free software: you have unlimited permission
|
# This configure script is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
#
|
|
||||||
# Date of this version: 2011-01-05
|
|
||||||
|
|
||||||
args=
|
args=
|
||||||
no_create=
|
no_create=
|
||||||
pkgname=pdlzip
|
pkgname=pdlzip
|
||||||
pkgversion=1.2
|
pkgversion=1.3
|
||||||
progname=pdlzip
|
progname=pdlzip
|
||||||
srctrigger=pdlzip.h
|
srctrigger=pdlzip.h
|
||||||
|
|
||||||
|
@ -167,7 +165,7 @@ echo "LDFLAGS = ${LDFLAGS}"
|
||||||
rm -f Makefile
|
rm -f Makefile
|
||||||
cat > Makefile << EOF
|
cat > Makefile << EOF
|
||||||
# Makefile for Pdlzip - Data compressor based on the LZMA algorithm
|
# Makefile for Pdlzip - Data compressor based on the LZMA algorithm
|
||||||
# Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
# Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
# This file was generated automatically by configure. Do not edit.
|
# This file was generated automatically by configure. Do not edit.
|
||||||
#
|
#
|
||||||
# This Makefile is free software: you have unlimited permission
|
# This Makefile is free software: you have unlimited permission
|
||||||
|
|
12
doc/pdlzip.1
12
doc/pdlzip.1
|
@ -1,5 +1,5 @@
|
||||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.37.1.
|
||||||
.TH PDLZIP "1" "January 2011" "Pdlzip 1.2" "User Commands"
|
.TH PDLZIP "1" "January 2012" "Pdlzip 1.3" "User Commands"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
Pdlzip \- reduces the size of files
|
Pdlzip \- reduces the size of files
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
|
@ -22,13 +22,13 @@ send output to standard output
|
||||||
\fB\-d\fR, \fB\-\-decompress\fR
|
\fB\-d\fR, \fB\-\-decompress\fR
|
||||||
decompress
|
decompress
|
||||||
.TP
|
.TP
|
||||||
\fB\-m\fR, \fB\-\-match\-length=\fR<n>
|
\fB\-m\fR, \fB\-\-match\-length=\fR<bytes>
|
||||||
set match length limit in bytes [36]
|
set match length limit in bytes [36]
|
||||||
.TP
|
.TP
|
||||||
\fB\-q\fR, \fB\-\-quiet\fR
|
\fB\-q\fR, \fB\-\-quiet\fR
|
||||||
suppress all messages
|
suppress all messages
|
||||||
.TP
|
.TP
|
||||||
\fB\-s\fR, \fB\-\-dictionary\-size=\fR<n>
|
\fB\-s\fR, \fB\-\-dictionary\-size=\fR<bytes>
|
||||||
set dictionary size limit in bytes [8MiB]
|
set dictionary size limit in bytes [8MiB]
|
||||||
.TP
|
.TP
|
||||||
\fB\-t\fR, \fB\-\-test\fR
|
\fB\-t\fR, \fB\-\-test\fR
|
||||||
|
@ -50,12 +50,16 @@ If no file name is given, pdlzip compresses or decompresses
|
||||||
from standard input to standard output.
|
from standard input to standard output.
|
||||||
Numbers may be followed by a multiplier: k = kB = 10^3 = 1000,
|
Numbers may be followed by a multiplier: k = kB = 10^3 = 1000,
|
||||||
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...
|
Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...
|
||||||
|
The bidimensional parameter space of LZMA can't be mapped to a linear
|
||||||
|
scale optimal for all files. If your files are large, very repetitive,
|
||||||
|
etc, you may need to use the \fB\-\-match\-length\fR and \fB\-\-dictionary\-size\fR
|
||||||
|
options directly to achieve optimal performance.
|
||||||
.SH "REPORTING BUGS"
|
.SH "REPORTING BUGS"
|
||||||
Report bugs to lzip\-bug@nongnu.org
|
Report bugs to lzip\-bug@nongnu.org
|
||||||
.br
|
.br
|
||||||
Pdlzip home page: http://www.nongnu.org/lzip/pdlzip.html
|
Pdlzip home page: http://www.nongnu.org/lzip/pdlzip.html
|
||||||
.SH COPYRIGHT
|
.SH COPYRIGHT
|
||||||
Copyright \(co 2011 Antonio Diaz Diaz.
|
Copyright \(co 2012 Antonio Diaz Diaz.
|
||||||
Public Domain 2009 Igor Pavlov.
|
Public Domain 2009 Igor Pavlov.
|
||||||
.br
|
.br
|
||||||
This is free software: you are free to change and redistribute it.
|
This is free software: you are free to change and redistribute it.
|
||||||
|
|
84
main.c
84
main.c
|
@ -1,6 +1,6 @@
|
||||||
/* Pdlzip - Data compressor based on the LZMA algorithm
|
/* Pdlzip - Data compressor based on the LZMA algorithm
|
||||||
2009-08-14 : Igor Pavlov : Public domain
|
2009-08-14 : Igor Pavlov : Public domain
|
||||||
Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you have unlimited permission
|
This program is free software: you have unlimited permission
|
||||||
to copy, distribute and modify it.
|
to copy, distribute and modify it.
|
||||||
|
@ -19,8 +19,11 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#if defined(__OS2__)
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "carg_parser.h"
|
#include "pdarg_parser.h"
|
||||||
#include "pdlzip.h"
|
#include "pdlzip.h"
|
||||||
#include "Alloc.h"
|
#include "Alloc.h"
|
||||||
#include "7zFile.h"
|
#include "7zFile.h"
|
||||||
|
@ -50,7 +53,7 @@ static ISzAlloc g_Alloc = { SzAlloc, SzFree };
|
||||||
|
|
||||||
const char * const Program_name = "Pdlzip";
|
const char * const Program_name = "Pdlzip";
|
||||||
const char * const program_name = "pdlzip";
|
const char * const program_name = "pdlzip";
|
||||||
const char * const program_year = "2011";
|
const char * const program_year = "2012";
|
||||||
const char * invocation_name = 0;
|
const char * invocation_name = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ enum Mode { m_compress, m_decompress, m_test };
|
||||||
char * output_filename = 0;
|
char * output_filename = 0;
|
||||||
|
|
||||||
|
|
||||||
/* assure at least a minimum size for buffer `buf' */
|
/* assure at least a minimum size for buffer 'buf' */
|
||||||
inline void * resize_buffer( void * buf, const int min_size )
|
inline void * resize_buffer( void * buf, const int min_size )
|
||||||
{
|
{
|
||||||
if( buf ) buf = realloc( buf, min_size );
|
if( buf ) buf = realloc( buf, min_size );
|
||||||
|
@ -82,29 +85,33 @@ inline void * resize_buffer( void * buf, const int min_size )
|
||||||
static void show_help()
|
static void show_help()
|
||||||
{
|
{
|
||||||
printf( "%s - A \"public domain\" version of the lzip data compressor\n", Program_name );
|
printf( "%s - A \"public domain\" version of the lzip data compressor\n", Program_name );
|
||||||
printf( "also able to decompress legacy lzma-alone (.lzma) files.\n" );
|
printf( "also able to decompress legacy lzma-alone (.lzma) files.\n"
|
||||||
printf( "\nUsage: %s [options] [file]\n", invocation_name );
|
"\nUsage: %s [options] [file]\n", invocation_name );
|
||||||
printf( "\nOptions:\n" );
|
printf( "\nOptions:\n"
|
||||||
printf( " -h, --help display this help and exit\n" );
|
" -h, --help display this help and exit\n"
|
||||||
printf( " -V, --version output version information and exit\n" );
|
" -V, --version output version information and exit\n"
|
||||||
printf( " -c, --stdout send output to standard output\n" );
|
" -c, --stdout send output to standard output\n"
|
||||||
printf( " -d, --decompress decompress\n" );
|
" -d, --decompress decompress\n"
|
||||||
/* printf( " -f, --force overwrite existing output files\n" ); */
|
/* " -f, --force overwrite existing output files\n" */
|
||||||
/* printf( " -k, --keep keep (don't delete) input files\n" ); */
|
/* " -k, --keep keep (don't delete) input files\n" */
|
||||||
printf( " -m, --match-length=<n> set match length limit in bytes [36]\n" );
|
" -m, --match-length=<bytes> set match length limit in bytes [36]\n"
|
||||||
printf( " -q, --quiet suppress all messages\n" );
|
" -q, --quiet suppress all messages\n"
|
||||||
printf( " -s, --dictionary-size=<n> set dictionary size limit in bytes [8MiB]\n" );
|
" -s, --dictionary-size=<bytes> set dictionary size limit in bytes [8MiB]\n"
|
||||||
printf( " -t, --test test compressed file integrity\n" );
|
" -t, --test test compressed file integrity\n"
|
||||||
printf( " -v, --verbose be verbose (a 2nd -v gives more)\n" );
|
" -v, --verbose be verbose (a 2nd -v gives more)\n"
|
||||||
printf( " -1 .. -9 set compression level [default 6]\n" );
|
" -1 .. -9 set compression level [default 6]\n"
|
||||||
printf( " --fast alias for -1\n" );
|
" --fast alias for -1\n"
|
||||||
printf( " --best alias for -9\n" );
|
" --best alias for -9\n"
|
||||||
printf( "If no file name is given, %s compresses or decompresses\n", program_name );
|
"If no file name is given, pdlzip compresses or decompresses\n"
|
||||||
printf( "from standard input to standard output.\n" );
|
"from standard input to standard output.\n"
|
||||||
printf( "Numbers may be followed by a multiplier: k = kB = 10^3 = 1000,\n" );
|
"Numbers may be followed by a multiplier: k = kB = 10^3 = 1000,\n"
|
||||||
printf( "Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...\n" );
|
"Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc...\n"
|
||||||
printf( "\nReport bugs to lzip-bug@nongnu.org\n" );
|
"The bidimensional parameter space of LZMA can't be mapped to a linear\n"
|
||||||
printf( "Pdlzip home page: http://www.nongnu.org/lzip/pdlzip.html\n" );
|
"scale optimal for all files. If your files are large, very repetitive,\n"
|
||||||
|
"etc, you may need to use the --match-length and --dictionary-size\n"
|
||||||
|
"options directly to achieve optimal performance.\n"
|
||||||
|
"\nReport bugs to lzip-bug@nongnu.org\n"
|
||||||
|
"Pdlzip home page: http://www.nongnu.org/lzip/pdlzip.html\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,9 +119,9 @@ static void show_version()
|
||||||
{
|
{
|
||||||
printf( "%s %s\n", Program_name, PROGVERSION );
|
printf( "%s %s\n", Program_name, PROGVERSION );
|
||||||
printf( "Copyright (C) %s Antonio Diaz Diaz.\n", program_year );
|
printf( "Copyright (C) %s Antonio Diaz Diaz.\n", program_year );
|
||||||
printf( "Public Domain 2009 Igor Pavlov.\n" );
|
printf( "Public Domain 2009 Igor Pavlov.\n"
|
||||||
printf( "This is free software: you are free to change and redistribute it.\n" );
|
"This is free software: you are free to change and redistribute it.\n"
|
||||||
printf( "There is NO WARRANTY, to the extent permitted by law.\n" );
|
"There is NO WARRANTY, to the extent permitted by law.\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,11 +132,12 @@ static const char * format_num( long long num )
|
||||||
enum { buf_size = 16, factor = 1024 };
|
enum { buf_size = 16, factor = 1024 };
|
||||||
static char buf[buf_size];
|
static char buf[buf_size];
|
||||||
const char *p = "";
|
const char *p = "";
|
||||||
|
bool exact = ( num % factor == 0 );
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for( i = 0; i < 8 && ( llabs( num ) > 9999 ||
|
for( i = 0; i < 8 && ( llabs( num ) > 9999 ||
|
||||||
( llabs( num ) >= factor && num % factor == 0 ) ); ++i )
|
( exact && llabs( num ) >= factor ) ); ++i )
|
||||||
{ num /= factor; p = prefix[i]; }
|
{ num /= factor; if( num % factor != 0 ) exact = false; p = prefix[i]; }
|
||||||
snprintf( buf, buf_size, "%lld %s", num, p );
|
snprintf( buf, buf_size, "%lld %s", num, p );
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -537,7 +545,7 @@ void show_error( const char * const msg, const int errcode, const bool help )
|
||||||
fprintf( stderr, "\n" );
|
fprintf( stderr, "\n" );
|
||||||
}
|
}
|
||||||
if( help && invocation_name && invocation_name[0] )
|
if( help && invocation_name && invocation_name[0] )
|
||||||
fprintf( stderr, "Try `%s --help' for more information.\n",
|
fprintf( stderr, "Try '%s --help' for more information.\n",
|
||||||
invocation_name );
|
invocation_name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,8 +601,8 @@ static void set_d_outname( const char * const name )
|
||||||
output_filename = resize_buffer( output_filename, strlen( name ) + 4 + 1 );
|
output_filename = resize_buffer( output_filename, strlen( name ) + 4 + 1 );
|
||||||
strcpy( output_filename, name );
|
strcpy( output_filename, name );
|
||||||
strcat( output_filename, ".out" );
|
strcat( output_filename, ".out" );
|
||||||
if( verbosity >= 0 )
|
if( verbosity >= 1 )
|
||||||
fprintf( stderr, "%s: can't guess original name for `%s' -- using `%s'.\n",
|
fprintf( stderr, "%s: Can't guess original name for '%s' -- using '%s'.\n",
|
||||||
program_name, name, output_filename );
|
program_name, name, output_filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,7 +652,6 @@ int main( const int argc, const char * const argv[] )
|
||||||
{ 'b', "member-size", ap_yes },
|
{ 'b', "member-size", ap_yes },
|
||||||
{ 'c', "stdout", ap_no },
|
{ 'c', "stdout", ap_no },
|
||||||
{ 'd', "decompress", ap_no },
|
{ 'd', "decompress", ap_no },
|
||||||
{ 'e', "extreme", ap_no },
|
|
||||||
{ 'f', "force", ap_no },
|
{ 'f', "force", ap_no },
|
||||||
{ 'h', "help", ap_no },
|
{ 'h', "help", ap_no },
|
||||||
{ 'k', "keep", ap_no },
|
{ 'k', "keep", ap_no },
|
||||||
|
@ -699,6 +706,11 @@ int main( const int argc, const char * const argv[] )
|
||||||
}
|
}
|
||||||
} /* end process options */
|
} /* end process options */
|
||||||
|
|
||||||
|
#if defined(__OS2__)
|
||||||
|
_fsetmode( stdin, "b" );
|
||||||
|
_fsetmode( stdout, "b" );
|
||||||
|
#endif
|
||||||
|
|
||||||
if( ap_arguments( &parser ) > argind &&
|
if( ap_arguments( &parser ) > argind &&
|
||||||
strcmp( ap_argument( &parser, argind ), "-" ) )
|
strcmp( ap_argument( &parser, argind ), "-" ) )
|
||||||
input_filename = ap_argument( &parser, argind );
|
input_filename = ap_argument( &parser, argind );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Pdlzip - A data compressor based on the LZMA algorithm
|
/* Pdlzip - Data compressor based on the LZMA algorithm
|
||||||
Copyright (C) 2010 Antonio Diaz Diaz.
|
Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you have unlimited permission
|
This program is free software: you have unlimited permission
|
||||||
to copy, distribute and modify it.
|
to copy, distribute and modify it.
|
||||||
|
@ -12,10 +12,10 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "carg_parser.h"
|
#include "pdarg_parser.h"
|
||||||
|
|
||||||
|
|
||||||
/* assure at least a minimum size for buffer `buf' */
|
/* assure at least a minimum size for buffer 'buf' */
|
||||||
static void * ap_resize_buffer( void * buf, const int min_size )
|
static void * ap_resize_buffer( void * buf, const int min_size )
|
||||||
{
|
{
|
||||||
if( buf ) buf = realloc( buf, min_size );
|
if( buf ) buf = realloc( buf, min_size );
|
||||||
|
@ -29,7 +29,8 @@ static char push_back_record( struct Arg_parser * const ap,
|
||||||
{
|
{
|
||||||
const int len = strlen( argument );
|
const int len = strlen( argument );
|
||||||
struct ap_Record *p;
|
struct ap_Record *p;
|
||||||
void * tmp = ap_resize_buffer( ap->data, ( ap->data_size + 1 ) * sizeof (struct ap_Record) );
|
void * tmp = ap_resize_buffer( ap->data,
|
||||||
|
( ap->data_size + 1 ) * sizeof (struct ap_Record) );
|
||||||
if( !tmp ) return 0;
|
if( !tmp ) return 0;
|
||||||
ap->data = (struct ap_Record *)tmp;
|
ap->data = (struct ap_Record *)tmp;
|
||||||
p = &(ap->data[ap->data_size]);
|
p = &(ap->data[ap->data_size]);
|
||||||
|
@ -91,31 +92,31 @@ static char parse_long_option( struct Arg_parser * const ap,
|
||||||
|
|
||||||
if( ambig && !exact )
|
if( ambig && !exact )
|
||||||
{
|
{
|
||||||
add_error( ap, "option `" ); add_error( ap, opt );
|
add_error( ap, "option '" ); add_error( ap, opt );
|
||||||
add_error( ap, "' is ambiguous" );
|
add_error( ap, "' is ambiguous" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( index < 0 ) /* nothing found */
|
if( index < 0 ) /* nothing found */
|
||||||
{
|
{
|
||||||
add_error( ap, "unrecognized option `" ); add_error( ap, opt );
|
add_error( ap, "unrecognized option '" ); add_error( ap, opt );
|
||||||
add_error( ap, "'" );
|
add_error( ap, "'" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
++*argindp;
|
++*argindp;
|
||||||
|
|
||||||
if( opt[len+2] ) /* `--<long_option>=<argument>' syntax */
|
if( opt[len+2] ) /* '--<long_option>=<argument>' syntax */
|
||||||
{
|
{
|
||||||
if( options[index].has_arg == ap_no )
|
if( options[index].has_arg == ap_no )
|
||||||
{
|
{
|
||||||
add_error( ap, "option `--" ); add_error( ap, options[index].name );
|
add_error( ap, "option '--" ); add_error( ap, options[index].name );
|
||||||
add_error( ap, "' doesn't allow an argument" );
|
add_error( ap, "' doesn't allow an argument" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( options[index].has_arg == ap_yes && !opt[len+3] )
|
if( options[index].has_arg == ap_yes && !opt[len+3] )
|
||||||
{
|
{
|
||||||
add_error( ap, "option `--" ); add_error( ap, options[index].name );
|
add_error( ap, "option '--" ); add_error( ap, options[index].name );
|
||||||
add_error( ap, "' requires an argument" );
|
add_error( ap, "' requires an argument" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +127,7 @@ static char parse_long_option( struct Arg_parser * const ap,
|
||||||
{
|
{
|
||||||
if( !arg || !arg[0] )
|
if( !arg || !arg[0] )
|
||||||
{
|
{
|
||||||
add_error( ap, "option `--" ); add_error( ap, options[index].name );
|
add_error( ap, "option '--" ); add_error( ap, options[index].name );
|
||||||
add_error( ap, "' requires an argument" );
|
add_error( ap, "' requires an argument" );
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/* Pdlzip - A data compressor based on the LZMA algorithm
|
/* Pdlzip - Data compressor based on the LZMA algorithm
|
||||||
Copyright (C) 2010 Antonio Diaz Diaz.
|
Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you have unlimited permission
|
This program is free software: you have unlimited permission
|
||||||
to copy, distribute and modify it.
|
to copy, distribute and modify it.
|
||||||
|
@ -9,13 +9,13 @@
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Arg_parser reads the arguments in `argv' and creates a number of
|
/* Arg_parser reads the arguments in 'argv' and creates a number of
|
||||||
option codes, option arguments and non-option arguments.
|
option codes, option arguments and non-option arguments.
|
||||||
|
|
||||||
In case of error, `ap_error' returns a non-null pointer to an error
|
In case of error, 'ap_error' returns a non-null pointer to an error
|
||||||
message.
|
message.
|
||||||
|
|
||||||
`options' is an array of `struct ap_Option' terminated by an element
|
'options' is an array of 'struct ap_Option' terminated by an element
|
||||||
containing a code which is zero. A null name means a short-only
|
containing a code which is zero. A null name means a short-only
|
||||||
option. A code value outside the unsigned char range means a
|
option. A code value outside the unsigned char range means a
|
||||||
long-only option.
|
long-only option.
|
||||||
|
@ -24,13 +24,13 @@
|
||||||
were specified before all the non-option arguments for the purposes
|
were specified before all the non-option arguments for the purposes
|
||||||
of parsing, even if the user of your program intermixed option and
|
of parsing, even if the user of your program intermixed option and
|
||||||
non-option arguments. If you want the arguments in the exact order
|
non-option arguments. If you want the arguments in the exact order
|
||||||
the user typed them, call `ap_init' with `in_order' = true.
|
the user typed them, call 'ap_init' with 'in_order' = true.
|
||||||
|
|
||||||
The argument `--' terminates all options; any following arguments are
|
The argument '--' terminates all options; any following arguments are
|
||||||
treated as non-option arguments, even if they begin with a hyphen.
|
treated as non-option arguments, even if they begin with a hyphen.
|
||||||
|
|
||||||
The syntax for optional option arguments is `-<short_option><argument>'
|
The syntax for optional option arguments is '-<short_option><argument>'
|
||||||
(without whitespace), or `--<long_option>=<argument>'.
|
(without whitespace), or '--<long_option>=<argument>'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
2
pdlzip.h
2
pdlzip.h
|
@ -1,5 +1,5 @@
|
||||||
/* Pdlzip - Data compressor based on the LZMA algorithm
|
/* Pdlzip - Data compressor based on the LZMA algorithm
|
||||||
Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
|
|
||||||
This program is free software: you have unlimited permission
|
This program is free software: you have unlimited permission
|
||||||
to copy, distribute and modify it.
|
to copy, distribute and modify it.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# check script for Pdlzip - Data compressor based on the LZMA algorithm
|
# check script for Pdlzip - Data compressor based on the LZMA algorithm
|
||||||
# Copyright (C) 2010, 2011 Antonio Diaz Diaz.
|
# Copyright (C) 2010, 2011, 2012 Antonio Diaz Diaz.
|
||||||
#
|
#
|
||||||
# This script is free software: you have unlimited permission
|
# This script is free software: you have unlimited permission
|
||||||
# to copy, distribute and modify it.
|
# to copy, distribute and modify it.
|
||||||
|
@ -19,12 +19,13 @@ fi
|
||||||
|
|
||||||
if [ -d tmp ] ; then rm -rf tmp ; fi
|
if [ -d tmp ] ; then rm -rf tmp ; fi
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
printf "testing pdlzip-%s..." "$2"
|
|
||||||
cd "${objdir}"/tmp
|
cd "${objdir}"/tmp
|
||||||
|
|
||||||
cat "${testdir}"/test.txt > in || framework_failure
|
cat "${testdir}"/test.txt > in || framework_failure
|
||||||
fail=0
|
fail=0
|
||||||
|
|
||||||
|
printf "testing pdlzip-%s..." "$2"
|
||||||
|
|
||||||
"${LZIP}" -t "${testdir}"/test.lz || fail=1
|
"${LZIP}" -t "${testdir}"/test.lz || fail=1
|
||||||
printf .
|
printf .
|
||||||
"${LZIP}" -cd "${testdir}"/test.lz > copy || fail=1
|
"${LZIP}" -cd "${testdir}"/test.lz > copy || fail=1
|
||||||
|
@ -61,8 +62,8 @@ for i in s4Ki 0 1 2 3 4 5 6 7 8s16 9s16 ; do
|
||||||
printf .
|
printf .
|
||||||
done
|
done
|
||||||
|
|
||||||
"${LZIP}" -$i < in > anyothername || fail=1
|
"${LZIP}" < in > anyothername || fail=1
|
||||||
"${LZIP}" -dq anyothername || fail=1
|
"${LZIP}" -d anyothername || fail=1
|
||||||
cmp in anyothername.out || fail=1
|
cmp in anyothername.out || fail=1
|
||||||
printf .
|
printf .
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue