Warning fixes:

* compress.c: Include stdlib.h and compress.h.
	(rcsid): Delete.
	(report_str_error): Make static.
	(ez_inflate_str): Delete unused variable.  Add parens in if-stmt.
	(hrd_inflate_str): Likewise.

	* compress.h (init_compression, end_compression, init_inflation,
	end_inflation): Prototype void arguments.

	* dostime.c (rcsid): Delete.

	* jargrep.c: Include ctype.h, stdlib.h, zlib.h and compress.h.
	Make functions static.  Cast ctype function argument to `unsigned
	char'.  Add parens in if-stmts.  Constify.
	(Usage): Change into a macro.
	(jargrep): Remove unused parameter.

	* jartool.c: Constify.  Add parens in if-stmts.  Align
	signed/unsigned char pointers in functions calls using casts.
	(rcsid): Delete.
	(list_jar): Fix printf format specifier.
	(usage): Chop long string into bits.  Reformat.

	* pushback.c (rcsid): Delete.

From-SVN: r38254
This commit is contained in:
Kaveh R. Ghazi 2000-12-14 18:45:35 +00:00 committed by Kaveh Ghazi
parent ad46e8819b
commit 990bee10e7
7 changed files with 181 additions and 85 deletions

View File

@ -1,3 +1,30 @@
2000-12-14 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* compress.c: Include stdlib.h and compress.h.
(rcsid): Delete.
(report_str_error): Make static.
(ez_inflate_str): Delete unused variable. Add parens in if-stmt.
(hrd_inflate_str): Likewise.
* compress.h (init_compression, end_compression, init_inflation,
end_inflation): Prototype void arguments.
* dostime.c (rcsid): Delete.
* jargrep.c: Include ctype.h, stdlib.h, zlib.h and compress.h.
Make functions static. Cast ctype function argument to `unsigned
char'. Add parens in if-stmts. Constify.
(Usage): Change into a macro.
(jargrep): Remove unused parameter.
* jartool.c: Constify. Add parens in if-stmts. Align
signed/unsigned char pointers in functions calls using casts.
(rcsid): Delete.
(list_jar): Fix printf format specifier.
(usage): Chop long string into bits. Reformat.
* pushback.c (rcsid): Delete.
2000-12-13 Tom Tromey <tromey@redhat.com>
* jartool.c (extract_jar): Use strchr, not index.

View File

@ -1,6 +1,11 @@
/* $Id: compress.c,v 1.7 2000/09/13 14:02:02 cory Exp $
/* $Id: compress.c,v 1.1 2000/12/09 03:08:23 apbianco Exp $
$Log: compress.c,v $
Revision 1.1 2000/12/09 03:08:23 apbianco
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
* fastjar: Imported.
Revision 1.7 2000/09/13 14:02:02 cory
Reformatted some of the code to more closly match the layout of the orriginal
fastjar utility.
@ -67,16 +72,18 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#include <sys/types.h>
#include "jartool.h"
#include "pushback.h"
#include "compress.h"
extern int seekable;
static char rcsid[] = "$Id: compress.c,v 1.7 2000/09/13 14:02:02 cory Exp $";
static z_stream zs;
void init_compression(){
@ -335,7 +342,7 @@ purpose: Put out an error message corresponding to error code returned from zlib
Be suitably cryptic seeing I don't really know exactly what these errors mean.
*/
void report_str_error(int val) {
static void report_str_error(int val) {
switch(val) {
case Z_STREAM_END:
break;
@ -376,10 +383,9 @@ static Bytef *ez_inflate_str(pb_file *pbf, ub4 csize, ub4 usize) {
Bytef *out_buff;
Bytef *in_buff;
unsigned int rdamt;
ub4 crc = 0;
if(zs.next_in = in_buff = (Bytef *) malloc(csize)) {
if(zs.next_out = out_buff = (Bytef *) malloc(usize + 1)) {
if((zs.next_in = in_buff = (Bytef *) malloc(csize))) {
if((zs.next_out = out_buff = (Bytef *) malloc(usize + 1))) {
if((rdamt = pb_read(pbf, zs.next_in, csize)) == csize) {
zs.avail_in = csize;
zs.avail_out = usize;
@ -430,7 +436,6 @@ static Bytef *hrd_inflate_str(pb_file *pbf, ub4 *csize, ub4 *usize) {
unsigned int rdamt;
int i;
int zret;
ub4 crc = 0;
i = 1;
out_buff = NULL;
@ -441,7 +446,7 @@ static Bytef *hrd_inflate_str(pb_file *pbf, ub4 *csize, ub4 *usize) {
zs.avail_out = 0;
zs.next_in = in_buff;
do {
if(tmp = (Bytef *) realloc(out_buff, (RDSZ * i) + 1)) {
if((tmp = (Bytef *) realloc(out_buff, (RDSZ * i) + 1))) {
out_buff = tmp;
zs.next_out = &(out_buff[(RDSZ * (i - 1)) - zs.avail_out]);
zs.avail_out += RDSZ;

View File

@ -1,6 +1,11 @@
/* $Id: compress.h,v 1.1.1.1 1999/12/06 03:09:12 toast Exp $
/* $Id: compress.h,v 1.1 2000/12/09 03:08:23 apbianco Exp $
$Log: compress.h,v $
Revision 1.1 2000/12/09 03:08:23 apbianco
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
* fastjar: Imported.
Revision 1.1.1.1 1999/12/06 03:09:12 toast
initial checkin..
@ -38,14 +43,15 @@
*/
/* Initializes the compression data structure(s) */
void init_compression();
void init_compression(void);
/* Compresses the file specified by in_fd and appends it to out_fd */
int compress_file(int in_fd, int out_fd, struct zipentry *ze);
/* Frees memory used by compression function */
void end_compression();
void end_compression(void);
void init_inflation();
void init_inflation(void);
int inflate_file(pb_file *, int, struct zipentry *);
void end_inflation();
void end_inflation(void);
Bytef *inflate_string(pb_file *, ub4 *, ub4 *);

View File

@ -20,9 +20,14 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dostime.c,v 1.1.1.1 1999/12/06 03:09:12 toast Exp $
/* $Id: dostime.c,v 1.1 2000/12/09 03:08:23 apbianco Exp $
$Log: dostime.c,v $
Revision 1.1 2000/12/09 03:08:23 apbianco
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
* fastjar: Imported.
Revision 1.1.1.1 1999/12/06 03:09:12 toast
initial checkin..
@ -55,8 +60,6 @@
#include "dostime.h"
static char rcsid[] = "$Id: dostime.c,v 1.1.1.1 1999/12/06 03:09:12 toast Exp $";
/*
Copyright (C) 1990-1997 Mark Adler, Richard B. Wales, Jean-loup Gailly,

View File

@ -21,9 +21,21 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: jargrep.c,v 1.1 2000/12/09 03:08:23 apbianco Exp $
/* $Id: jargrep.c,v 1.2 2000/12/11 02:59:55 apbianco Exp $
$Log: jargrep.c,v $
Revision 1.2 2000/12/11 02:59:55 apbianco
2000-12-10 Robert Lipe <robertlipe@usa.net>
* jargrep.c (jargrep): Added null statement after case.
2000-12-10 Alexandre Petit-Bianco <apbianco@cygnus.com>
* Makefile: Removed.
* Makefile.in: Rebuilt with `-i' and `--enable-foreign'.
(http://gcc.gnu.org/ml/gcc/2000-12/msg00294.html)
Revision 1.1 2000/12/09 03:08:23 apbianco
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -49,12 +61,18 @@ will test some other platforms later.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
#ifdef STDC_HEADERS
#include <stdlib.h>
#endif
#include "jargrep.h"
#include "jartool.h"
#include "pushback.h"
#include "zipfile.h"
#include "zlib.h"
#include "compress.h"
char *Usage = { "Usage: %s [-bcinsw] <-e regexp | regexp> file(s)\n" };
#define Usage "Usage: %s [-bcinsw] <-e regexp | regexp> file(s)\n"
extern char *optarg;
@ -66,7 +84,7 @@ together.
returns: TRUE if options are valid, FALSE otherwise.
*/
int opt_valid(int options) {
static int opt_valid(int options) {
int retflag;
if((options & JG_PRINT_COUNT) &&
@ -90,18 +108,17 @@ expression.
returns: Newly allocated compile regular expression ready to be used in an regexec call.
*/
regex_t *create_regexp(char *regstr, int options) {
static regex_t *create_regexp(const char *regstr, int options) {
regex_t *exp;
int exp_flags = 0;
int errcode;
int msgsize;
char *errmsg;
if(exp = (regex_t *) malloc(sizeof(regex_t)))
if((exp = (regex_t *) malloc(sizeof(regex_t))))
{
if(errcode = regcomp(exp, regstr, (options & JG_IGNORE_CASE) ? REG_ICASE : 0)) {
if((errcode = regcomp(exp, regstr, (options & JG_IGNORE_CASE) ? REG_ICASE : 0))) {
fprintf(stderr, "regcomp of regex failed,\n");
if(errmsg = (char *) malloc(msgsize = regerror(errcode, exp, NULL, 0) + 1)) {
if((errmsg = (char *) malloc(msgsize = regerror(errcode, exp, NULL, 0) + 1))) {
regerror(errcode, exp, errmsg, msgsize);
fprintf(stderr, "Error: %s\n", errmsg);
free(exp);
@ -135,7 +152,7 @@ we have read beyound the embedded file list and can exit knowing we have read al
relevent information. 2 means we still haven't reached embdedded file list and need to
do some more reading.
*/
int check_sig(ub1 *scratch, pb_file *pbfp) {
static int check_sig(ub1 *scratch, pb_file *pbfp) {
ub4 signature;
int retflag = 0;
@ -175,7 +192,7 @@ args csize Pointer to embedded file's compressed size.
Purpose: Unpack the series of values from file_header.
*/
void decd_siz(ub4 *csize, ub4 *usize, ub2 *fnlen, ub2 *eflen, ub2 *flags, ub2 *method, ub1 *file_header) {
static void decd_siz(ub4 *csize, ub4 *usize, ub2 *fnlen, ub2 *eflen, ub2 *flags, ub2 *method, ub1 *file_header) {
*csize = UNPACK_UB4(file_header, LOC_CSIZE);
#ifdef DEBUG
printf("Compressed size is %u\n", *csize);
@ -216,7 +233,7 @@ purpose: Read in the embedded file name from jar file.
returns: Pointer to newly allocated string containing file name.
*/
char *new_filename(pb_file *pbf, ub4 len) {
static char *new_filename(pb_file *pbf, ub4 len) {
char *filename;
if(!(filename = (char *) malloc(len + 1))) {
@ -241,10 +258,10 @@ purpose: Create a string containing the contents of the embedded noncompressed f
returns: Pointer to newly allocated string containing embedded file contents.
*/
char *read_string(pb_file *pbf, int size) {
static char *read_string(pb_file *pbf, int size) {
char *page;
if(page = (char *) malloc(size + 1)) {
if((page = (char *) malloc(size + 1))) {
pb_read(pbf, page, size);
page[size] = '\0';
}
@ -270,16 +287,16 @@ The matching line that is printed out by jargrep is generated by this function.
returns: Pointer to newly allocated string containing matched expression.
*/
char *extract_line(char *stream, regoff_t begin, regoff_t end, int *b) {
static char *extract_line(const char *stream, regoff_t begin, regoff_t end, int *b) {
int e;
int length;
char *retstr;
for(*b = begin; *b >= 0 && !iscntrl(stream[*b]); (*b)--);
for(*b = begin; *b >= 0 && !iscntrl((unsigned char)stream[*b]); (*b)--);
(*b)++;
for(e = end; stream[e] == '\t' || !iscntrl(stream[e]); e++);
for(e = end; stream[e] == '\t' || !iscntrl((unsigned char)stream[e]); e++);
length = e - *b;
if(retstr = (char *) malloc(length + 1)) {
if((retstr = (char *) malloc(length + 1))) {
sprintf(retstr, "%d:", *b);
strncpy(retstr, &(stream[*b]), length);
retstr[length] = '\0';
@ -302,24 +319,26 @@ word and not a substring of another word.
returns: TRUE if it is a word, FALSE of it is a substring.
*/
int chk_wrd(regex_t *exp, char *str) {
static int chk_wrd(regex_t *exp, const char *str) {
int wrd_fnd = FALSE;
int regflag;
int frnt_ok;
int bck_ok;
char *str2;
const char *str2;
regmatch_t match;
str2 = str;
frnt_ok = bck_ok = FALSE;
while(!wrd_fnd && !(regflag = regexec(exp, str2, 1, &match, 0))) {
if(!match.rm_so && (str2 == str)) frnt_ok = TRUE;
else if(!isalnum(str2[match.rm_so - 1]) && str2[match.rm_so - 1] != '_')
else if(!isalnum((unsigned char)str2[match.rm_so - 1])
&& str2[match.rm_so - 1] != '_')
frnt_ok = TRUE;
else frnt_ok = FALSE;
if(frnt_ok) {
if(str2[match.rm_eo] == '\0') bck_ok = TRUE;
else if(!isalnum(str2[match.rm_eo]) && str2[match.rm_eo] != '_')
else if(!isalnum((unsigned char)str2[match.rm_eo])
&& str2[match.rm_eo] != '_')
bck_ok = TRUE;
else bck_ok = FALSE;
}
@ -348,7 +367,7 @@ purpose: Control output of jargrep. Output is controlled by which options have
set at the command line.
*/
void prnt_mtchs(regex_t *exp, char *filename, char *stream, regmatch_t *pmatch, regmatch_t *nl_offset, int num, int lines, int options) {
static void prnt_mtchs(regex_t *exp, const char *filename, const char *stream, regmatch_t *pmatch, regmatch_t *nl_offset, int num, int lines, int options) {
int i;
int j = 0;
int ln_cnt;
@ -388,13 +407,13 @@ args: pbf Pointer to pushback file pointer for jar file.
purpose: Verify the CRC matches that as what is stored in the jar file.
*/
void check_crc(pb_file *pbf, char *stream, ub4 usize) {
static void check_crc(pb_file *pbf, const char *stream, ub4 usize) {
ub4 crc;
ub4 lcrc;
ub1 scratch[16];
crc = crc32(crc, NULL, 0);
crc = crc32(crc, stream, usize);
crc = crc32(crc, (const unsigned char *)stream, usize);
if(pb_read(pbf, scratch, 16) != 16) {
perror("read");
exit(1);
@ -420,11 +439,13 @@ permits grepping of binary files as well by converting non ASCII and control cha
into '\n'.
*/
void mk_ascii(char *stream, int usize) {
int i;
static void mk_ascii(char *stream, size_t usize) {
size_t i;
for(i = 0; i < usize; i++)
if(stream[i] != '\t' && (iscntrl(stream[i]) || (unsigned char) stream[i] >= 128))
if(stream[i] != '\t'
&& (iscntrl((unsigned char)stream[i])
|| (unsigned char) stream[i] >= 128))
stream[i] = '\n';
}
@ -439,7 +460,7 @@ returns: Pointer to newly allocated array of regmatch_t which gives indexes to
and end of matches. NULL is returned upon no matches found.
*/
regmatch_t *fnd_match(regex_t *exp, char *str_stream, int *i) {
static regmatch_t *fnd_match(regex_t *exp, const char *str_stream, int *i) {
int regflag;
regmatch_t match;
regmatch_t *match_array;
@ -449,8 +470,8 @@ regmatch_t *fnd_match(regex_t *exp, char *str_stream, int *i) {
for(*i = 0, regflag = regexec(exp, str_stream, 1, &match, 0); !regflag;
regflag = regexec(exp, &(str_stream[match.rm_eo]), 1, &match, 0), (*i)++)
{
if(tmp = (regmatch_t *)
realloc(match_array, sizeof(regmatch_t) * ((*i) + 1)))
if((tmp = (regmatch_t *)
realloc(match_array, sizeof(regmatch_t) * ((*i) + 1))))
{
match_array = tmp;
if(*i) {
@ -483,7 +504,7 @@ read and then the embeded file is extracted and grepped.
returns: FALSE upon failure, TRUE otherwise.
*/
int cont_grep(regex_t *exp, regex_t *nl_exp, int fd, char *jarfile, pb_file *pbf, int options) {
static int cont_grep(regex_t *exp, regex_t *nl_exp, int fd, pb_file *pbf, int options) {
int retflag = TRUE;
int i;
int j;
@ -538,7 +559,7 @@ purpose: Open jar file. Check signatures. When right signature is found go to
grep routine.
*/
void jargrep(regex_t *exp, regex_t *nl_exp, char *jarfile, int options) {
static void jargrep(regex_t *exp, regex_t *nl_exp, const char *jarfile, int options){
int fd;
int floop = TRUE;
pb_file pbf;
@ -559,7 +580,7 @@ void jargrep(regex_t *exp, regex_t *nl_exp, char *jarfile, int options) {
else {
switch (check_sig(scratch, &pbf)) {
case 0:
floop = cont_grep(exp, nl_exp, fd, jarfile, &pbf, options);
floop = cont_grep(exp, nl_exp, fd, &pbf, options);
break;
case 1:
floop = FALSE;

View File

@ -17,9 +17,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: jartool.c,v 1.1 2000/12/09 03:08:23 apbianco Exp $
/* $Id: jartool.c,v 1.2 2000/12/13 18:11:57 tromey Exp $
$Log: jartool.c,v $
Revision 1.2 2000/12/13 18:11:57 tromey
* jartool.c (extract_jar): Use strchr, not index.
Revision 1.1 2000/12/09 03:08:23 apbianco
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
@ -169,23 +172,22 @@
#endif
static char version_string[] = VERSION;
static char rcsid[] = "$Id: jartool.c,v 1.1 2000/12/09 03:08:23 apbianco Exp $";
extern int errno;
void usage(char*);
void usage(const char*);
void add_entry(struct zipentry *);
void init_headers();
void init_headers(void);
int consume(pb_file *, int);
int list_jar(int, char**, int);
int extract_jar(int, char**, int);
int add_file_to_jar(int, int, char*, struct stat*);
int add_to_jar(int, char*, char*);
int add_file_to_jar(int, int, const char*, struct stat*);
int add_to_jar(int, const char*, const char*);
int create_central_header(int);
int make_manifest(int, char*);
int make_manifest(int, const char*);
static void init_args(char **, int);
static char *get_next_arg ();
static char *get_next_arg (void);
/* global variables */
ub1 file_header[30];
@ -371,7 +373,7 @@ int main(int argc, char **argv){
}
if(action == ACTION_CREATE || action == ACTION_UPDATE){
char *arg;
const char *arg;
init_headers();
if((action == ACTION_UPDATE) && file) {
@ -397,8 +399,8 @@ int main(int argc, char **argv){
while ((arg = get_next_arg ())){
if(!strcmp(arg, "-C")){
char *dir_to_change = get_next_arg ();
char *file_to_add = get_next_arg ();
const char *dir_to_change = get_next_arg ();
const char *file_to_add = get_next_arg ();
if(!dir_to_change
|| !file_to_add
|| add_to_jar(jarfd, dir_to_change, file_to_add)){
@ -570,7 +572,7 @@ void add_entry(struct zipentry *ze){
number_of_entries++;
}
int make_manifest(int jfd, char *mf_name){
int make_manifest(int jfd, const char *mf_name){
time_t current_time;
int nlen; /* length of file name */
int mod_time; /* file modification time */
@ -622,14 +624,14 @@ int make_manifest(int jfd, char *mf_name){
int mf_len = 37 + strlen(VERSION);
char *mf;
if(mf = (char *) malloc(mf_len + 1)) {
if((mf = (char *) malloc(mf_len + 1))) {
uLong crc;
sprintf(mf, "Manifest-Version: 1.0\nCreated-By: %s\n\n", VERSION);
crc = crc32(0L, Z_NULL, 0);
crc = crc32(crc, mf, mf_len);
crc = crc32(crc, (const unsigned char *)mf, mf_len);
nlen = 20; /* once again, trust me */
@ -703,7 +705,7 @@ int make_manifest(int jfd, char *mf_name){
return 0;
}
int add_to_jar(int fd, char *new_dir, char *file){
int add_to_jar(int fd, const char *new_dir, const char *file){
struct stat statbuf;
DIR *dir;
struct dirent *de;
@ -857,7 +859,7 @@ int add_to_jar(int fd, char *new_dir, char *file){
return 0;
}
int add_file_to_jar(int jfd, int ffd, char *fname, struct stat *statbuf){
int add_file_to_jar(int jfd, int ffd, const char *fname, struct stat *statbuf){
unsigned short file_name_length;
unsigned long mod_time;
@ -1259,7 +1261,7 @@ int extract_jar(int fd, char **files, int file_num){
handle = FALSE;
for(j = 0; j < file_num; j++)
if(strcmp(files[j], filename) == 0){
if(strcmp(files[j], (const char *)filename) == 0){
handle = TRUE;
break;
}
@ -1271,16 +1273,16 @@ int extract_jar(int fd, char **files, int file_num){
/* OK, there is some directory information in the file. Nothing to do
but ensure the directory(s) exist, and create them if they don't.
What a pain! */
if(strchr(filename, '/') != NULL && handle){
if(strchr((const char *)filename, '/') != NULL && handle){
/* Loop through all the directories in the path, (everything w/ a '/') */
ub1 *start = filename;
const ub1 *start = filename;
char *tmp_buff;
struct stat sbuf;
tmp_buff = malloc(sizeof(char) * strlen(filename));
tmp_buff = malloc(sizeof(char) * strlen((const char *)filename));
for(;;){
ub1 *idx = strchr(start, '/');
const ub1 *idx = (const unsigned char *)strchr((const char *)start, '/');
if(idx == NULL)
break;
@ -1290,7 +1292,7 @@ int extract_jar(int fd, char **files, int file_num){
}
start = idx + 1;
strncpy(tmp_buff, filename, (idx - filename));
strncpy(tmp_buff, (const char *)filename, (idx - filename));
tmp_buff[(idx - filename)] = '\0';
#ifdef DEBUG
@ -1327,26 +1329,26 @@ int extract_jar(int fd, char **files, int file_num){
}
/* only a directory */
if(strlen(start) == 0)
if(strlen((const char *)start) == 0)
dir = TRUE;
#ifdef DEBUG
printf("Leftovers are \"%s\" (%d)\n", start, strlen(start));
printf("Leftovers are \"%s\" (%d)\n", start, strlen((const char *)start));
#endif
/* If the entry was just a directory, don't write to file, etc */
if(strlen(start) == 0)
if(strlen((const char *)start) == 0)
f_fd = -1;
free(tmp_buff);
}
if(f_fd != -1 && handle){
f_fd = creat(filename, 00644);
f_fd = creat((const char *)filename, 00644);
if(f_fd < 0){
fprintf(stderr, "Error extracting JAR archive!\n");
perror(filename);
perror((const char *)filename);
exit(1);
}
}
@ -1568,7 +1570,7 @@ int list_jar(int fd, char **files, int file_num){
we'll only display those, otherwise we'll display everything */
if(file_num > 0){
for(j = 0; j < file_num; j++)
if(strcmp(files[j], filename) == 0){
if(strcmp(files[j], (const char *)filename) == 0){
if(verbose)
printf("%6d %s %s\n", usize, ascii_date, filename);
else
@ -1705,7 +1707,7 @@ int list_jar(int fd, char **files, int file_num){
#ifdef DEBUG
printf("Skipping %d bytes\n", size);
printf("Skipping %ld bytes\n", (long)size);
#endif
consume(&pbf, size);
@ -1713,7 +1715,7 @@ int list_jar(int fd, char **files, int file_num){
/* print out the listing */
if(file_num > 0){
for(j = 0; j < file_num; j++)
if(strcmp(files[j], filename) == 0){
if(strcmp(files[j], (const char *)filename) == 0){
if(verbose)
printf("%6d %s %s\n", usize, ascii_date, filename);
else
@ -1755,8 +1757,37 @@ int consume(pb_file *pbf, int amt){
return 0;
}
void usage(char *filename){
fprintf(stderr, "Usage: %s {ctxuV}[vfm0ME@] [jar-file] [manifest-file] [-C dir] files ...\nOptions\n -c create new archive\n -t list table of contents for archive\n -x extract named (or all) files from archive\n -u update existing archive\n -V display version information\n -v generate verbose output on standard output\n -f specify archive file name\n -m include manifest information from specified manifest file\n -0 store only; use no ZIP compression\n -M Do not create a manifest file for the entries\n -C change to the specified directory and include the following file\n -E don't include the files found in a directory\n -@ Read names from stdin\nIf any file is a directory then it is processed recursively.\nThe manifest file name and the archive file name needs to be specified\nin the same order the 'm' and 'f' flags are specified.\n\nExample 1: to archive two class files into an archive called classes.jar: \n jar cvf classes.jar Foo.class Bar.class \nExample 2: use an existing manifest file 'mymanifest' and archive all the\n files in the foo/ directory into 'classes.jar': \n jar cvfm classes.jar mymanifest -C foo/ .\n", filename);
void usage(const char *filename){
fprintf(stderr, "\
Usage: %s {ctxuV}[vfm0ME@] [jar-file] [manifest-file] [-C dir] files ...\n\
Options\n\
-c create new archive\n\
-t list table of contents for archive\n\
-x extract named (or all) files from archive\n\
", filename);
fprintf(stderr, "\
-u update existing archive\n\
-V display version information\n\
-v generate verbose output on standard output\n\
-f specify archive file name\n\
-m include manifest information from specified manifest file\n\
-0 store only; use no ZIP compression\n\
-M Do not create a manifest file for the entries\n\
-C change to the specified directory and include the following file\n\
-E don't include the files found in a directory\n\
-@ Read names from stdin\n\
");
fprintf(stderr, "\
If any file is a directory then it is processed recursively.\n\
The manifest file name and the archive file name needs to be specified\n\
in the same order the 'm' and 'f' flags are specified.\n\
\n\
Example 1: to archive two class files into an archive called classes.jar: \n\
jar cvf classes.jar Foo.class Bar.class \n\
Example 2: use an existing manifest file 'mymanifest' and archive all the\n\
files in the foo/ directory into 'classes.jar': \n\
jar cvfm classes.jar mymanifest -C foo/ .\n\
");
exit(1);
}

View File

@ -1,6 +1,11 @@
/* $Id: pushback.c,v 1.2 2000/08/23 19:42:17 cory Exp $
/* $Id: pushback.c,v 1.1 2000/12/09 03:08:23 apbianco Exp $
$Log: pushback.c,v $
Revision 1.1 2000/12/09 03:08:23 apbianco
2000-12-08 Alexandre Petit-Bianco <apbianco@cygnus.com>
* fastjar: Imported.
Revision 1.2 2000/08/23 19:42:17 cory
Added support for more Unix platforms. The following code has been hacked
to work on AIX, Solaris, True 64, and HP-UX.
@ -43,8 +48,6 @@
#include "jartool.h"
#include "pushback.h"
static char rcsid[] = "$Id: pushback.c,v 1.2 2000/08/23 19:42:17 cory Exp $";
void pb_init(pb_file *pbf, int fd){
pbf->fd = fd;
pbf->next = pbf->pb_buff;