pak tool: Re-add the -f option and clean up the man page.

This commit is contained in:
Jeff Teunissen 2002-05-25 02:47:53 +00:00
parent 11a14c077e
commit a116529db1
2 changed files with 46 additions and 15 deletions

View file

@ -34,7 +34,7 @@
pak \- The QuakeForge Packfile Tool pak \- The QuakeForge Packfile Tool
.SH SYNOPSIS .SH SYNOPSIS
.B pak .B pak
<\fIcommand\fP> [\fIoption\fP]... \fIARCHIVE\fP \fIFILE\fP... <\fBcommand\fP> [\fBoptions\fP] \fIARCHIVE\fP \fIFILE\fP...
.SH DESCRIPTION .SH DESCRIPTION
\fBpak\fP is a utility for managing pack (*.pak) archives. The format used is \fBpak\fP is a utility for managing pack (*.pak) archives. The format used is
compatible with Quake and Quake II. Pak archives are a convenient way to store compatible with Quake and Quake II. Pak archives are a convenient way to store
@ -45,7 +45,7 @@ internally.
used at a time. used at a time.
.TP .TP
.B \-c, \-\-create .B \-c, \-\-create
Create an archive. Overwrites any contents. Create an archive. Overwrites any contents the archive may have had.
.TP .TP
.B \-t, \-\-test .B \-t, \-\-test
Test an archive for valid formatting. Test an archive for valid formatting.
@ -62,18 +62,37 @@ Show the version of pak.
.SH OPTIONS .SH OPTIONS
\fBpak\fP takes the following arguments as options. \fBpak\fP takes the following arguments as options.
.TP .TP
.B \-f, \-\-file ARCHIVE
Use ARCHIVE as the archive filename, instead of the first non-option argument.
This option is provided for compatibility with older versions of \fBpak\fP.
.TP
.B \-p, \-\-pad .B \-p, \-\-pad
Can be useful when creating an archive. File space is padded to a 4\-byte Can be useful when creating an archive. File space is padded to a 4\-byte
boundary, assisting in the speed of loading files from the archive. boundary, assisting in the speed of loading files from the archive. The file
data itself is not changed.
.TP .TP
.B \-q, \-\-quiet .B \-q, \-\-quiet
Inhibit some of pak's normal output. Inhibit some of pak's normal output.
.TP .TP
.B \-v, \-\-verbose .B \-v, \-\-verbose
Display more output than usual. Display more output than usual.
.SH "SEE ALSO" .SH "EXIT STATUS"
.BR quakeforge (1) \fBpak\fP returns a zero exit status when it has completed a command
successfully (without error). Otherwise, it returns a non-zero exit status.
.SH BUGS
.PP
The program does not currently handle compression or decompression. This
is planned for a future version.
.PP
The program does not currently handle extraction of individual files inside an
archive. This is planned for a future version.
.PP
The program cannot modify an archive once it has been created.
.SH AUTHORS .SH AUTHORS
\fBpak\fP was written by Bill Currie <taniwha@quakeforge.net> for QuakeForge. Bill Currie (taniwha@quakeforge.net) wrote most of the program.
Jeff Teunissen <deek@quakeforge.net> has also work on it, mostly in the .PP
interface. Jeff Teunissen (deek@quakeforge.net) wrote the command-line interface and the
documentation.
.SH "SEE ALSO"
.BR quakeforge (1),
.BR qfcc (1)

View file

@ -32,6 +32,14 @@ static const char rcsid[] =
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <getopt.h> #include <getopt.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
@ -61,7 +69,7 @@ static void
usage (int status) usage (int status)
{ {
printf ("%s - QuakeForge Packfile tool\n", this_program); printf ("%s - QuakeForge Packfile tool\n", this_program);
printf ("Usage: %s <command> [options] ARCHIVE FILE [FILE ...]\n", printf ("Usage: %s <command> [options] ARCHIVE [FILE...]\n",
this_program); this_program);
printf ("Commands:\n" printf ("Commands:\n"
@ -72,6 +80,7 @@ usage (int status)
" -V, --version Output version information and exit\n\n"); " -V, --version Output version information and exit\n\n");
printf ("Options:\n" printf ("Options:\n"
" -f, --file ARCHIVE Use ARCHIVE for archive filename\n"
" -p, --pad Pad file space to a 32-bit boundary\n" " -p, --pad Pad file space to a 32-bit boundary\n"
" -q, --quiet Inhibit usual output\n" " -q, --quiet Inhibit usual output\n"
" -v, --verbose Display more output than usual\n"); " -v, --verbose Display more output than usual\n");
@ -93,7 +102,7 @@ decode_args (int argc, char **argv)
"x" // extract archive contents "x" // extract archive contents
"h" // show help "h" // show help
"V" // show version "V" // show version
// "f:" // filename "f:" // filename
"p" // pad "p" // pad
"q" // quiet "q" // quiet
"v" // verbose "v" // verbose
@ -115,6 +124,9 @@ decode_args (int argc, char **argv)
case 'x': // extract case 'x': // extract
options.mode = mo_extract; options.mode = mo_extract;
break; break;
case 'f': // set filename
options.packfile = strdup (optarg);
break;
case 'q': // lower verbosity case 'q': // lower verbosity
options.verbosity--; options.verbosity--;
break; break;
@ -129,7 +141,7 @@ decode_args (int argc, char **argv)
} }
} }
if (argv[optind] && *(argv[optind])) if ((!options.packfile) && argv[optind] && *(argv[optind]))
options.packfile = strdup (argv[optind++]); options.packfile = strdup (argv[optind++]);
return optind; return optind;
@ -146,9 +158,9 @@ main (int argc, char **argv)
decode_args (argc, argv); decode_args (argc, argv);
if (!options.packfile) { if (!options.packfile) {
fprintf (stderr, "%s: no archive file specified, giving up.\n", fprintf (stderr, "%s: no archive file specified.\n",
this_program); this_program);
return 1; usage (1);
} }
switch (options.mode) { switch (options.mode) {
@ -198,9 +210,9 @@ main (int argc, char **argv)
pack_close (pack); pack_close (pack);
break; break;
default: default:
fprintf (stderr, "%s: No command given, bailing out.\n", fprintf (stderr, "%s: No command given.\n",
this_program); this_program);
return 1; usage (1);
} }
return 0; return 0;
} }