81 lines
2.3 KiB
Plaintext
81 lines
2.3 KiB
Plaintext
$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
|
|
@@ -21,6 +21,7 @@
|
|
#include "interface.h"
|
|
|
|
struct cmdline cmd;
|
|
+char* progname;
|
|
|
|
/*\
|
|
|*| Print usage
|
|
@@ -30,12 +31,13 @@ usage(void)
|
|
{
|
|
printf(
|
|
"Usage:\n"
|
|
-" par c(heck) [options] <par file> : Check parity archive\n"
|
|
-" par r(ecover) [options] <par file> : Restore missing volumes\n"
|
|
-" par a(dd) [options] <par file> [files] : Add files to parity archive\n"
|
|
+" %s c(heck) [options] <par file> : Check parity archive\n"
|
|
+" %s r(ecover) [options] <par file> : Restore missing volumes\n"
|
|
+" %s a(dd) [options] <par file> [files] : Add files to parity archive\n"
|
|
+" %s t(able) [options] <par file> : 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) [<par files>] : Interactive mode (very bare-bones)\n"
|
|
+" %s m(ix) [options] : Try to restore from all parity files at once\n"
|
|
+" %s i(nteractive) [<par files>] : Interactive mode (very bare-bones)\n"
|
|
"\n"
|
|
"Options: (Can be turned off with '+')\n"
|
|
" -m : Move existing files out of the way\n"
|
|
@@ -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",
|
|
+ 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;
|
|
}
|
|
}
|