From 0e8103604d15e3de53f016c86248a5f758fcbafb Mon Sep 17 00:00:00 2001 From: fredb Date: Mon, 25 Aug 2003 20:23:06 +0000 Subject: Here are a couple of patches I submitted to the Sourceforge project in June of this year, but for which I got no response. 1) Sourceforge PR #72673: Get the program name for the usage statement in the most portable fashion possible, using argv. 2) Sourceforge PR #762825, which is a rework of PR #504855, by Adam Lewandowski. Add a "table of contents" command, included a "+v" option to dump absolutely all of the information in the par file. Bump ${PKGREVISION}. I think it's safe to say that this is the final release. The current "par2", for version 2 parity files, is now backwards compatible with the version 1 parity files that this program generates. It does not, however, seem to have the cool "table of contents" feature. --- misc/parchive/Makefile | 3 +- misc/parchive/distinfo | 8 ++-- misc/parchive/patches/patch-aa | 14 ++++--- misc/parchive/patches/patch-ab | 67 ++++++++++++++++++++++------- misc/parchive/patches/patch-ac | 12 ++++++ misc/parchive/patches/patch-ad | 95 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 173 insertions(+), 26 deletions(-) create mode 100644 misc/parchive/patches/patch-ac create mode 100644 misc/parchive/patches/patch-ad (limited to 'misc/parchive') diff --git a/misc/parchive/Makefile b/misc/parchive/Makefile index ddc99f64703..92ea66b8f39 100644 --- a/misc/parchive/Makefile +++ b/misc/parchive/Makefile @@ -1,8 +1,9 @@ -# $NetBSD: Makefile,v 1.4 2003/07/21 17:01:25 martti Exp $ +# $NetBSD: Makefile,v 1.5 2003/08/25 20:23:06 fredb Exp $ # DISTNAME= par-v1.1 PKGNAME= parchive-1.1 +PKGREVISION= 1 WRKSRC= ${WRKDIR}/par-cmdline CATEGORIES= misc archivers MASTER_SITES= http://telia.dl.sourceforge.net/parchive/ diff --git a/misc/parchive/distinfo b/misc/parchive/distinfo index fd5cfca9f5b..b10434d7ce4 100644 --- a/misc/parchive/distinfo +++ b/misc/parchive/distinfo @@ -1,6 +1,8 @@ -$NetBSD: distinfo,v 1.2 2002/01/04 21:40:58 fredb Exp $ +$NetBSD: distinfo,v 1.3 2003/08/25 20:23:07 fredb Exp $ SHA1 (par-v1.1.tar.gz) = acba4cdfb8a89b1542cd9ba6494d0d3461e609a1 Size (par-v1.1.tar.gz) = 40959 bytes -SHA1 (patch-aa) = 847b137de8cc0ff250d1e0346fcc80fa67021135 -SHA1 (patch-ab) = fb1b68cc6e3ae4186f78d229bb237d7a62c6bff6 +SHA1 (patch-aa) = ca6ac3dfc740e02b1831b47852616e90e331b8ac +SHA1 (patch-ab) = a6ee18373febeaf9cf1dbda0cd0ca76b383788c0 +SHA1 (patch-ac) = ec4675bbfa9a0808e665d7aa2c22c3f96ae43ea1 +SHA1 (patch-ad) = 6d8738eabb517a59f4057bcf2d385d25f39c20e2 diff --git a/misc/parchive/patches/patch-aa b/misc/parchive/patches/patch-aa index c33089540a7..a08dbbbb547 100644 --- a/misc/parchive/patches/patch-aa +++ b/misc/parchive/patches/patch-aa @@ -1,15 +1,17 @@ -$NetBSD: patch-aa,v 1.2 2002/01/04 21:40:59 fredb Exp $ +$NetBSD: patch-aa,v 1.3 2003/08/25 20:23:08 fredb Exp $ --- Makefile.orig Sat Nov 17 10:39:52 2001 +++ Makefile -@@ -1,8 +1,8 @@ +@@ -1,8 +1,10 @@ --CFLAGS=-g -W -Wall -Wno-unused -O2 -+CFLAGS=-g -W -Wall -Wno-unused -O2 -DKNOW_NAME + CFLAGS=-g -W -Wall -Wno-unused -O2 - par: backend.o checkpar.o makepar.o rwpar.o rs.o md5.o fileops.o main.o readoldpar.o interface.o ui_text.o +-par: backend.o checkpar.o makepar.o rwpar.o rs.o md5.o fileops.o main.o readoldpar.o interface.o ui_text.o - $(CC) -o $@ $^ -+ $(CC) -o ${.TARGET} ${.ALLSRC} ++ALLSRCS= backend.o checkpar.o makepar.o rwpar.o rs.o md5.o fileops.o main.o readoldpar.o interface.o ui_text.o ++ ++par: ${ALLSRCS} ++ $(CC) -o $@ ${ALLSRCS} clean: rm -f core par par.exe *.o diff --git a/misc/parchive/patches/patch-ab b/misc/parchive/patches/patch-ab index 1a36b9982aa..3acd84703f9 100644 --- a/misc/parchive/patches/patch-ab +++ b/misc/parchive/patches/patch-ab @@ -1,17 +1,17 @@ -$NetBSD: patch-ab,v 1.1 2002/01/04 21:40:59 fredb Exp $ +$NetBSD: patch-ab,v 1.2 2003/08/25 20:23:08 fredb Exp $ --- main.c.orig Sat Nov 17 13:29:48 2001 +++ main.c -@@ -28,14 +28,20 @@ - int - usage(void) +@@ -21,6 +21,7 @@ + #include "interface.h" + + struct cmdline cmd; ++char* progname; + + /*\ + |*| Print usage +@@ -30,12 +31,13 @@ usage(void) { -+#ifdef KNOW_NAME -+ extern char *__progname; -+#else -+ char progname[] = "par"; -+#endif -+ printf( "Usage:\n" -" par c(heck) [options] : Check parity archive\n" @@ -20,6 +20,7 @@ $NetBSD: patch-ab,v 1.1 2002/01/04 21:40:59 fredb Exp $ +" %s c(heck) [options] : Check parity archive\n" +" %s r(ecover) [options] : Restore missing volumes\n" +" %s a(dd) [options] [files] : Add files to parity archive\n" ++" %s t(able) [options] : List contents of parity archive\n" " Advanced:\n" -" par m(ix) [options] : Try to restore from all parity files at once\n" -" par i(nteractive) [] : Interactive mode (very bare-bones)\n" @@ -28,18 +29,52 @@ $NetBSD: patch-ab,v 1.1 2002/01/04 21:40:59 fredb Exp $ "\n" "Options: (Can be turned off with '+')\n" " -m : Move existing files out of the way\n" -@@ -52,8 +58,12 @@ +@@ -52,8 +54,8 @@ usage(void) " -v,+v: Increase or decrease verbosity\n" " -h,-?: Display this help\n" " -- : Always treat following arguments as files\n" -"\n" - ); +"\n", -+#ifdef KNOW_NAME -+ __progname, __progname, __progname, __progname, __progname); -+#else -+ progname, progname, progname, progname, progname); -+#endif ++ progname, progname, progname, progname, progname, progname); return 0; } +@@ -97,6 +99,8 @@ main(int argc, char *argv[]) + if (check_sizes()) + return -1; + ++ progname = argv[0]; ++ + /*\ Some defaults \*/ + memset(&cmd, 0, sizeof(cmd)); + cmd.volumes = 10; +@@ -207,6 +211,10 @@ main(int argc, char *argv[]) + case 'I': + cmd.action = ACTION_TEXT_UI; + break; ++ case 't': ++ case 'T': ++ cmd.action = ACTION_CONTENTS; ++ break; + default: + fprintf(stderr, "Unknown command: '%s'\n", + argv[1]); +@@ -244,6 +252,17 @@ main(int argc, char *argv[]) + break; + case ACTION_TEXT_UI: + par_load(unist(argv[1])); ++ break; ++ case ACTION_CONTENTS: ++ fprintf(stderr, "Reading %s\n", argv[1]); ++ par = read_par_header(unist(argv[1]), 0, 0, 0); ++ if (!par) { ++ fail = 2; ++ continue; ++ } ++ dump_par(par); ++ free_par(par); ++ par=0; + break; + } + } diff --git a/misc/parchive/patches/patch-ac b/misc/parchive/patches/patch-ac new file mode 100644 index 00000000000..e6d1b5b49bd --- /dev/null +++ b/misc/parchive/patches/patch-ac @@ -0,0 +1,12 @@ +$NetBSD: patch-ac,v 1.1 2003/08/25 20:23:08 fredb Exp $ + +--- par.h.orig Sat Nov 17 14:08:19 2001 ++++ par.h +@@ -82,6 +82,7 @@ extern struct cmdline { + #define ACTION_ADD 11 /*\ Create a PAR archive ... \*/ + #define ACTION_ADDING 12 /*\ ... and add files to it. \*/ + #define ACTION_TEXT_UI 20 /*\ Interactive text interface \*/ ++#define ACTION_CONTENTS 21 /*\ List contents of PAR file \*/ + + #define PAR_MAGIC (*((i64 *)"PAR\0\0\0\0\0")) + #define IS_PAR(x) (((x).magic) == PAR_MAGIC) diff --git a/misc/parchive/patches/patch-ad b/misc/parchive/patches/patch-ad new file mode 100644 index 00000000000..e6210c249bc --- /dev/null +++ b/misc/parchive/patches/patch-ad @@ -0,0 +1,95 @@ +$NetBSD: patch-ad,v 1.1 2003/08/25 20:23:08 fredb Exp $ + +--- rwpar.c.orig Sat Nov 17 14:20:09 2001 ++++ rwpar.c +@@ -165,6 +165,9 @@ static void + dump_file(pfile_t *file) + { + fprintf(stderr, ++ " filename: %s\n", ++ stuni(file->filename)); ++ fprintf(stderr, + " status: 0x%llx\n" + " file size: %lld\n" + " hash: %s\n", +@@ -172,11 +175,8 @@ dump_file(pfile_t *file) + file->file_size, + stmd5(file->hash)); + fprintf(stderr, +- " 16k hash: %s\n", +- stmd5(file->hash_16k)); +- fprintf(stderr, +- " filename: %s\n", +- stuni(file->filename)); ++ " 16k hash: %s\n\n", ++ stmd5(file->hash_16k)); + } + + void +@@ -184,38 +184,43 @@ dump_par(par_t *par) + { + pfile_t *p; + +- fprintf(stderr, "PAR file dump:\n" +- " filename: %s\n" +- " version: 0x%04x\n" +- " client: 0x%04x\n" +- " control hash: %s\n", ++ fprintf(stderr, "\nPAR file dump:\n\n" ++ " filename: %s\n" ++ " version: 0x%04x\n" ++ " client: 0x%04x\n" ++ " control hash: %s\n" ++ " set hash: %s\n" ++ " volume number: %lld\n" ++ " number of files: %lld\n", + stuni(par->filename), + par->version, + par->client, +- stmd5(par->control_hash)); +- fprintf(stderr, +- " set hash: %s\n", +- stmd5(par->set_hash)); +- fprintf(stderr, +- " volume number: %lld\n" +- " number of files: %lld\n" +- " file list: 0x%llx\n" +- " file list size: 0x%llx\n" +- " data: 0x%llx\n" +- " data size: 0x%llx\n", ++ stmd5(par->control_hash), ++ stmd5(par->set_hash), + par->vol_number, +- par->num_files, +- par->file_list, +- par->file_list_size, +- par->data, +- par->data_size); ++ par->num_files); ++ if (cmd.loglevel > 0) ++ fprintf(stderr, ++ " file list: 0x%llx\n" ++ " file list size: 0x%llx\n" ++ " data: 0x%llx\n" ++ " data size: 0x%llx\n", ++ par->file_list, ++ par->file_list_size, ++ par->data, ++ par->data_size); + if (!par->vol_number) + fprintf(stderr, +- " comment: %s\n", ++ " comment: %s\n", + stuni(par->comment)); + fprintf(stderr, "\nFiles:\n\n"); + for (p = par->files; p; p = p->next) +- dump_file(p); ++ if (cmd.loglevel > 0) ++ dump_file(p); ++ else ++ fprintf(stderr, ++ " %s\n", ++ stuni(p->filename)); + } + + /*\ -- cgit v1.2.3