Table of Contents
par - Palm database archiver, version 0.5.
par t dbfile
par
h dbfile
par x dbfile [ioptions] [records..]
par c [hoptions] dbfile name type cid
[ioptions] [files..]
par u [hoptions] dbfile [ioptions] [updates..]
par a
[hoptions] dbfile [ioptions] [files..]
par d [hoptions] dbfile [doptions]
[records..]
par V
The par utility creates and manipulates PalmOS
database (.pdb) and resource (.prc) files. The first argument determines
the mode of operation, as follows:
- t
- List contents. For regular databases
a list of records is generated, each line showing the record attributes,
category, record size, and an ascii dump of the first few bytes of the
record. For resource databases, a list of resources is generated, each
line showing resource type, hex id, size, and ascii dump of the first
few bytes of the resource.
- h
- List header information. A report of the database
header is generated, showing the database name (this is the name that
would be visible on a device), the database type, creator id, attributes,
version, creation time, last modification time, last backup time, mod
number, nrecords (or resources), and the size of the application info
block in the database.
- x
- Extract. The extract mode can extract all or just
specific records from a database. With no further arguments, all records
will be extracted from the database. If further arguments are provided,
these should specify the index of the record to extract for regular databases,
and the type and id of the desired resource for resource databases. By
default, individual records will be saved as files with the name <index>.pdr,
where <index> is the index of the record in the database, individual resources
will be saved as files with the name <type><id>.bin, where <type> is the 4 character
type of the resource, and <id> is the resource id in 4 digit hexadecimal.
A preferred filename for a saved item can be specified for each record
using the -f option to the record or resource specification.
- c
- Create a
new database. The create mode creates a new database file, with the database
name, type, and creator id specified as (required) arguments. If no further
arguments are specified, the resulting database will contain no records,
but will have a valid database header. If further arguments are specified,
they should specify files to be appended to the database as records or
resources (see the -a mode description).
- u
- Touch the header or record attributes.
In touch mode, changes to the database header can be specified. By default,
the last modification time will be updated to the current time, but further
changes can be specified using the header options. See HEADER OPTIONS section.
In addition, attribute information for particular records can be specified.
For regular databases, the new record category and record attributes may
be specified, using the -c and -a options. The records to touch are specified
by index. For resource databases, the new resource type and id may be specified
using the -T option. The resources to touch are specified by <type> and <id>.
- a
- Append records or resources. In append mode, records or resources will
be added to the database. For regular databases, the target record category
and record attributes may be specified, using the -c and -a options before
the source filename. For resource databases, the target resource type and
id may be specified using the -T option before the source filename. If the
-T option is not specified, the source filename is assumed to specify the
type and id in the <type><index> fashion described for the x mode. In addition
to individual records and resources, par can append whole databases, in
effect merging the records or resources from one database into another.
Databases may be specified as append items explicitly using the -p argument
option, or implicitly by using a .pdb extension for record databases, and
.prc extension for resource databases.
- d
- Delete. In delete mode, records
or resources are removed from the database. Records are specified by index,
resources are specified by type and id.
- V
- Version. Print the version number.
- r
- Create resource. r is an convenience alias for c -a resource. See HEADER
OPTIONS section.
- l
- l is an alias for t.
- i
- i is an alias for h.
- -mode
- All
modes may be prefixed with - if that makes you feel better.
The a, c, d, u modes accept hoptions which update the database information
as follows:
- -n name
- Database name. This is the name of the database that
will be visible on the device. Note that this is entirely independent from
the dbfile, although some utilities will imply the latter from the former.
- -T type
- The four character database type. For example, an application resource
database is of type 'appl'. The address book database is of type 'DATA'.
- -I cid
- The four character creator identifier. This specifies which application
owns the database.
- -a attributes
- Database attributes. These may be specified
as a hex number, or symbolically using the keywords resource, readonly,
dirty, backup, newer, reset, copyprevent, stream, hidden, launchable,
recyclable, bundle, or any bit-ORed combination of names or hex numbers.
For new databases, the attributes default to 0x0 (none set).
- -v version
- The database version. For new databases, this defaults to 1.
- -C creation_time
- The time the database was created. Times should be specified using the
format [[CC]YY]MMDDHHMM, or using the special keywords now, or never. The
former is the current time, that latter is the beginning of PalmOS time
(90401010000). For new databases, this defaults to now.
- -m last_modification_time
- The time the database was created. For new databases, this defaults to
now.
- -b last_backup_time
- The time the database was last backed up. For new
databases, this defaults to never.
The x, c, u, and a modes
accept ioptions, and the d mode accepts doptions, which operate on the
app and sort info in the database:
- -A filename
- AppInfo filename. In x mode,
specifies that the database AppInfo should be saved to filename. In c,u,
and a modes, specifies that the database AppInfo should be set from filename.
- -S filename
- SortInfo filename. In x mode, specifies that the database SortInfo
should be saved to filename. In c,u, and a modes, specifies that the database
SortInfo should be set from filename.
- -A
- Delete AppInfo. In d mode, specifies
that the database AppInfo should be deleted from the database.
- -S
- Delete
SortInfo. In d mode, specifies that the database SortInfo should be deleted
from the database.
The following example prints the header information
for the database 'foo.pdb'.
par h foo.pdb
The following extracts all records
from 'foo.pdb'.
par x foo.pdb
The following extracts the application icon resource
from 'app.prc' and saves it in the file 'icon.Tbmp'. Note the use of decimal
specification for the resource id. The id may be specified in hex using
by using the '0x' prefix.
par x app.prc -f icon.Tbmp tAIB 1000
The following
creates a new application resource database from all the the files with
a '.bin' extension in the current directory. The database will have creator
id of 'djwP' and will have the backup bit set.
par c -a "resource|backup" app.prc
myapp appl djwP *.bin
If you use the author's technique for creating multi-segment
library prcs with CodeWarrior, the following example will be useful. This
example uses the touch mode to change the database type to 'libr', and to
change the attribute type of the primary code resource from type = 'code',
id = '1' (as used in an application) to type = 'libr', id = '0' (as used in
a library).
par u -T libr mylib.prc -T libr 0 code 1
The following example
merges the resources from two different resource databases, code.prc, and
resource.prc into a single target application database, myapp.prc. This technique
is useful for managing code and non-code elements of an application, using
the individual resource databases as libraries.
par r myapp.prc myapp appl
djwP code.prc resource.prc
By default, par saves extracted resources using
the form <type><id>.bin, where <type> is the 4 character type of the resource,
and <id> is the resource id in 4 digit hexadecimal. When appending resources
to a new or existing resource database, par will attempt to decode the
resource and id of the resource being appended from the resource filename
using this same naming scheme, or you can explicitly specify the resource
and id using the -T syntax. Here are two invocations of par that do exactly
the same thing: create a new resource database with one resource which
has type = NFNT and id = 256 (0x0100 hexadecimal):
par c -a "resource"
font.prc Font FONT djwF NFNT0100.bin
par r font.prc Font FONT djwF -T NFNT
256 myfont
The following example creates a stream database that can be
accessed using the PalmOS FileStream API. The stream will contain the contents
of the file 'WarAndPeace.txt':
par c -a "stream" book.pdb Book DATA djwS WarAndPeace.txt
In the following example, 'book.pdb' is a stream database. This example extracts
the stream from that database and stores the result in the output file
'Book.txt':
par x book.pdb Book.txt
par was written by David Williams,
djw@djw.org
Table of Contents