--- /dev/null
+.TH zpm-elftype 8 2019-02-14 "ZPM 0.3"
+.SH NAME
+zpm-elftype \- print type of elf files
+.SH SYNOPSIS
+.B zpm elftype
+[
+.BI -f " listfile"
+]
+[
+.B -redclatnvp0
+]
+.RI [ path ...]
+.SH DESCRIPTION
+\fBzpm-elftype\fR
+prints and filters lists of paths according to their elftype. By default
+the program checks its non-option arguments.
+.SH OPTIONS
+.TP
+\-l
+Don't follow symlinks when checking paths.
+.TP
+\-r
+Accept relocatable files.
+.TP
+\-e
+Accept executable files.
+.TP
+\-d
+Accept dynamic files.
+.TP
+\-c
+Accept CORE files.
+.TP
+\-t
+Print file type.
+.TP
+\-n
+Print file name.
+.TP
+\-v
+Run in verbose mode.
+.TP
+\-p
+print errors
+.TP
+-a
+Accept all elf files. Equivalent to -redc
+.TP
+\-f \fIpath\fR
+Take the list of paths to check from the path. If the path is '-' then
+use stdin.
+.TP
+\-0
+When printing type or path information, terminate items with a zero byte.
+Otherwise, by default, a newline is used.
+.SH EXAMPLES
+.TP
+zpm elftype
+lists all files in the local database
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
+.BR elf (5)
--- /dev/null
+.TH zpm-extract 8 2019-02-14 "ZPM 0.3"
+.SH NAME
+zpm-extract \- extract files from a zpm database
+.SH SYNOPSIS
+.B zpm extract
+[
+.BI -f " pkgfile"
+]
+.I hash path
+.SH DESCRIPTION
+\fBzpm-extract\fR
+extracts file content specified by hash, or a unique prefix of a hash,
+to the path specified. The permissions are set to 0600, and the
+owner and group will be the current user and group.
+.SH OPTIONS
+.TP
+\-f
+specify the package file to find packages in
+.SH EXAMPLES
+.TP
+zpm extract abcdef012 /tmp/out
+Extract from $ZPMDB the contents of a file whose sha256 hash begins with
+abcdef012 to /tmp/out.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
-.TH zpm-fetchurl 8 2018-12-09 "ZPM 0.4"
+.TH zpm-fetchurl 8 2019-02-15 "ZPM 0.4"
.SH NAME
zpm-fetchurl \- download files
.SH SYNOPSIS
.SH FILES
/var/lib/zpm/known_hosts
~/.zpm/known_hosts
+/etc/zpm/roots.pem
.SH ENVIRONMENT
ZPM_KNOWNHOSTS
ZPM_ROOTFILE
--- /dev/null
+.TH zpm-log 8 2019-02-15 "ZPM 0.3"
+.SH NAME
+zpm-log \- manage the zpm log
+.SH SYNOPSIS
+.B zpm log
+[
+.BI -f " pkgfile"
+]
+[
+.BI -t " target"
+]
+[
+.BI -a " action"
+]
+[
+.BI -T " timestamp"
+]
+[
+.B -ijvr
+]
+.RI [ message ...]
+.SH DESCRIPTION
+\fBzpm-log\fR
+prints or inserts into the zpm log, which is stored in the local database,
+or the database given by the \-f option.
+.SH OPTIONS
+.TP
+.B \-f path
+specify the database file where the log is stored. Defaults to
+$ZPMDB or /var/lib/zpm/local.db
+.TP
+.B \-t target
+Specify the target of the log. This is generally a package id.
+When listing, this filters the log to only targets that match.
+.TP
+.B \-a action
+Specify the action taken. This is intended to be stylized for eazy
+machine readability.
+.TP
+.B \-T timestamp
+Specify the timestamp of the log message. By default the current timestamp
+is used for an insert. If this option is given when listing log messages,
+it is used as the earliest time logs are listed from.
+.TP
+.B \-i
+Insert the log message given as arguments. Non option arguments
+are concatenated with a space separator and inserted into the log.
+list package names only
+.TP
+.B \-j
+Output the log in json format.
+.TP
+.B \-v
+Verbose mode. On insert, print the log message inserted to stdout.
+.TP
+.B \-r
+When listing messages, output them in reverse timestamp order, newest
+first.
+.SH EXAMPLES
+.TP
+.B zpm log
+Lists all log messages in the default database.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
--- /dev/null
+.TH zpm-packagehash 8 2019-02-14 "ZPM 0.3"
+.SH NAME
+zpm-packagehash \- run packagehash
+.SH SYNOPSIS
+ case 'f': dbfile = optarg; break;
+ case 's': set = 1; break;
+ case 'S': clear = 1; break;
+ case 'c': check = 1; break;
+ case 'q': quiet = 1; break;
+ case 'e': showcurrent = 1; break;
+.B zpm packagehash
+[
+.BI -f " pkgfile"
+]
+[
+.B -sScqe
+]
+.RI [ package ]
+.SH DESCRIPTION
+\fBzpm-packagehash\fR
+calculates, prints, or sets the hash of a package. The package must
+be specified as a complete package triple.
+.SH OPTIONS
+.TP
+\-f
+specify the package file to find packages in
+.TP
+\-s
+set the hash after calculating it
+.TP
+\-S
+clear the package hash
+.TP
+\-c
+check the package hash against one given as an additional argument
+.TP
+\-q
+Don't output anything to stdout.
+.TP
+\-e
+Show the current package hash, rather than the calculated one.
+.SH EXAMPLES
+.TP
+zpm packagehash -s -f foo-1.0-1.zpm foo-1.0-1
+Calculate and set the package hash for the foo-1.0-1 package.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
--- /dev/null
+.TH zpm-parse 8 2019-02-14 "ZPM 0.3"
+.SH NAME
+zpm-parse \- parse a package string
+.SH SYNOPSIS
+.B zpm parse
+[
+.B -nvrE
+]
+.I pkgstring
+.SH DESCRIPTION
+\fBzpm-parse\fR
+parses a package string into its components and prints them separated
+by a space to stdout. By default, it prints the name, version, and
+release. The default output is equivalent to the -nvr options.
+If a given component is not present, the corresponding field is not
+printed.
+.SH OPTIONS
+.TP
+\-n
+print the name
+.TP
+\-v
+print the version
+.TP
+\-r
+print the release
+.TP
+\-E
+Print the output in a form that can be evaled by a shell. The
+variable names are "name", "version", and "release".
+.SH EXAMPLES
+.TP
+zpm parse foo-1.0-1
+Prints "foo 1.0 1" to stdout.
+.SH EXIT STATUS
+0 on success non zero if the given string can't be parsed even as
+an incomplete package string.
+.SH FILES
+None.
+.SH ENVIRONMENT
+None.
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
-.TH zpm-contents 8 2018-11-30 "ZPM 0.2"
+.TH zpm-repo 8 2018-11-30 "ZPM 0.2"
.SH NAME
-zpm-contents \- list files in a zpm package
+zpm-repo \- manage remote package repositories
.SH SYNOPSIS
-.B zpm contents
+.B zpm repo
[
-.BI -f " pkgfile"
+.BI -R " path"
]
[
-.I package ...
+.BI -d " path"
]
[
-.B --
-.I fileglob ...
+.I subcommand ...
]
.SH DESCRIPTION
-zpm-contents lists files belonging to any of the given packages,
-or all packages. Additionally, the list of packages can be
-terminated with '--' and any additional arguments are glob patterns.
+zpm-repo manages remote repositories
+.PP
+zpm-repo operates in several modes: list, add, del(ete), url,
+.SS list
+lists each defined remote repository, along with its priority, url,
+and a unix timestamp of the last time it was refreshed.
+.SS add
+zpm-repo add \fIname url\fR
+.PP
+add a new repository. The name is arbitrary.
+.SS del
+zpm-repo del \fIname\fR
+.PP
+Delete the named repository. Also delete any cached packages downloaded
+from this repository.
+.SS url
+zpm-repo url \fIname [ newurl ]\fR
+.PP
+Print or set the url of a given repository.
+.SS pri
+zpm-repo pri \fIname [ newurl ]\fR
+.PP
+Print or set the priority of a given repository.
+.SS fetch
+zpm-repo fetch \fIname downloadargs\fR
+.PP
+download a given package, download is an alias for fetch.
+.SS update
+zpm-repo update \fIname\fR
+.PP
+Update repository metadata. Pull is an alias for update.
+.SS packages
+zpm-repo packages \fIname\fR
+.PP
+List packages contained in a repo.
+.SS contents
+zpm-repo contents \fIname package\fR
+.PP
+List files contained in a given package of a repo.
+.SS purge
+zpm-repo purge \fIname purgeinfo\fR
+.PP
+Deletes packages from the repository package cache. Deletes
+all packages if purgeinfo is not given.
.SH OPTIONS
-\-f specify the package file to find packages in
+.TP
+\-R
+specify a root directory for packages
+.TP
+\-d
+specify a zpm database where repository information is stored.
.SH EXAMPLES
-zpm contents
+zpm repo
.SH EXIT STATUS
0 on success non zero on failure
.SH FILES
.SH AUTHOR
Nathan Wagner
.SH SEE ALSO
-zpm(8)
+.BR zpm (8)
+.BR zpm-fetchurl (8)
--- /dev/null
+.TH zpm-rmpackage 8 2019-02-15 "ZPM 0.3"
+.SH NAME
+zpm-rmpackage \- remove packages from a database
+.SH SYNOPSIS
+ f) pkgfile="$OPTARG" ;;
+ v) verbose=1 ;;
+ m) message="$OPTARG" ;;
+.B zpm rmpackage
+[
+.BI -f " pkgfile"
+]
+[
+.BI -m " message"
+]
+[
+.B -v
+]
+.RI [ package ...]
+.SH DESCRIPTION
+\fBzpm-rmpackage\fR
+removes packages from a zpm database and logs a message. This is
+potentially dangerous. No checking as to the status of the
+package is made, so it is possible to remove a package from the
+database even if it is installed. This program is intended to
+be run from garbage collection utilities or by package maintainers
+rather than as a normal part of system administration.
+.PP
+Packages to be removed are given as package id arguments, which
+may be abbreviated, and will be looked up via
+.BR zpm-findpkg (8).
+If a package is not found, it is not an error. A message will
+be printed to stderr in this case if the -v option is given.
+.PP
+A log message will be entered into the zpm log for each package removed with an
+action of 'rmpackage'.
+An optional message to put in the log can be given with the -m option.
+.SH OPTIONS
+.TP
+.BI \-f path
+specify the package file to find packages in
+.TP
+.BI \-m message
+specify a message for each log message.
+.TP
+.B \-v
+Verbose mode.
+.SH EXAMPLES
+.TP
+.B zpm rmpackage foo
+Removes a foo package as found with zpm-findpkg from the default database.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+ZPM_PACKAGEFILE
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
+.BR zpm-findpackage (8)
+.BR zpm-log (8)
--- /dev/null
+.TH zpm-script 8 2019-02-15 "ZPM 0.3"
+.SH NAME
+zpm-script \- run, set, or list package scripts
+.SH SYNOPSIS
+.B zpm script
+[
+.B -Fhq
+]
+[
+.BI -f " pkgfile"
+]
+[
+.BI -p " phase"
+]
+[
+.BI -R " rootdir"
+]
+[
+.BI -o " path"
+]
+[
+.BI -S " script"
+]
+.I package
+.SH DESCRIPTION
+\fBzpm-script\fR
+runs, sets, or lists package scripts for a package. The package is a package
+id, which may be abbreviated. Despite the name, scripts can be any
+arbitrary program, though they are usually posix shell scripts.
+.PP
+zpm-script runs in one of three modes, run, list, and set.
+.SS Run Mode
+In run mode, a script for a given phase is run if it exists. It is not
+an error if there is no script for the given package and phase unless
+the \-F option is given. Standard output from the script will be redirected
+to /var/tmp/zpm-script.out, or as specified by the -o option.
+.PP
+The script itself will be extracted to /var/tmp/zpm-script, set as executable,
+and then run. The script is run with one or two arguments. The
+first argument is the package id being installed, removed, or configured.
+For a package version update (or downgrade) the second argument is
+the previous version of the package.
+.TP
+An example script
+.EX
+#!/bin/sh
+
+echo example and test zpm stage script
+echo args: "$*"
+.EE
+.SS Set Mode
+Set mode will set the script for a given package and phase to the
+path given as an additional argument. If the -h is given, the script
+is interpreted as a hash to be set directly, and nothing is taken
+from the filesystem.
+.SH OPTIONS
+.TP
+.BI \-p phase
+Specify the script phase. This defaults to all phases for list mode,
+and configure for running or setting scripts.
+.TP
+.B \-f
+specify the package file to find packages in
+.TP
+.B \-h
+When setting a script, the script is taken as a hex encoded hash, rather
+than a path to a script.
+.TP
+.B \-q
+Run quietly.
+.SH EXAMPLES
+.TP
+zpm script -f foo-1.0-1.zpm foo
+Run the configure script for the foo package found in the foo-1.0-1.zpm
+file.
+.TP
+zpm script foo
+Run the configure script for the (most recent) foo package found
+in the local database.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
--- /dev/null
+.TH zpm-sign 8 2019-02-15 "ZPM 0.3"
+.SH NAME
+zpm-sign \- manage package signatures
+.SH SYNOPSIS
+.B zpm sign
+[
+.B -hrdsgev
+]
+[
+.BI -f " sigfile"
+]
+[
+.BI -o " outfile"
+]
+[
+.BI -S " sigstring"
+]
+[
+.BI -k " keystring"
+]
+[
+.BI -K " keyfile"
+]
+[
+.BI -p " passphrase"
+]
+[
+.BI -m " messagestring"
+]
+.RI [ file ]
+.SH DESCRIPTION
+\fBzpm-sign\fR
+manages signatures on zpm packages. It can generate signing keys,
+sign files, and verify signatures. The ed25519 algorithms are
+used exclusively, and all the signature code is taken from the
+ref10 implementation. Signatures themselves are hex encoded
+representions of the signature metadata and the actual signature value.
+.PP
+Private keys are potentially encrypted with chacha20 before storing
+them on disk.
+.SH OPTIONS
+.B -r
+.TP
+.B \-g
+Generate a private key
+.TP
+.B \-e
+Extract a public key from a private key.
+.TP
+.B \-s
+Sign a file or message. In addition to the message to be signed,
+signature metadata is signed.
+.TP
+.B \-v
+Verify a signature on a file or message.
+.TP
+.B \-h
+hexencode values
+.TP
+.B \-d
+Increase the debug level. May be given more than once.
+.TP
+.B \-r
+Output the raw signature, rather than a full zpm certificate.
+This also just signs the data given, without any signature
+metadata.
+.TP
+.BI \-p passphrase
+Specify a passphrase to decrypt a private key.
+.TP
+.BI \-m message
+Specify a message to be signed or verified. If not set with the -m option, the
+message is taken from file named with the first non-option argument.
+.TP
+.BI \-k path
+Take the private key for message signing from the path given. This
+defaults to ~/.zpm/key. If ~/.zpm/key is not found and the euid
+is root, /var/lib/zpm/key is tried.
+.TP
+.BI \-K key
+Take the private key from the command line argument. This is not
+particularly secure and is primarily intended for testing.
+.TP
+.BI \-S sigstring
+Use sigstring as the signature to verify.
+.TP
+.BI \-m message
+Specify a message to be signed or verified. If not set with the -m option, the
+message is taken from file named with the first non-option argument.
+.SH EXAMPLES
+.TP
+.B zpm sign
+lists all files in the local database
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
--- /dev/null
+.TH zpm-soname 8 2019-02-14 "ZPM 0.4"
+.SH NAME
+zpm-soname \- list the soname of an elf library
+.SH SYNOPSIS
+.B zpm soname \fR[\fB-l\fR] \fIpath\fR
+.SH DESCRIPTION
+\fBzpm-soname\fR prints to stdout the soname, if any, of a given path.
+.SH OPTIONS
+.TP
+\-l
+Don't follow symlinks. If the path is a symlink, this will cause the program
+to exit with status 1.
+.SH EXAMPLES
+.PP
+.nf
+zpm-soname /lib/libc.so
+.fi
+.SH EXIT STATUS
+.TP
+0
+if the file had an soname
+.TP
+1
+file is not a regular file, or unable to stat, no file given, or other file
+error
+.TP
+2
+unable map file to read elf info
+.TP
+3
+file is not an elf file
+.TP
+4
+file is not an dynamic library file
+.TP
+5
+unable to determine 64 or 32 bit elf file
+.TP
+6
+unable to determine endianness
+.TP
+8
+File has no string table
+.TP
+9
+File has no dynamic section
+.TP
+10
+File has no dynamic table
+.TP
+11
+No soname found in dynamic table
+.SH FILES
+None
+.SH ENVIRONMENT
+None
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+zpm(8)
--- /dev/null
+.TH zpm-stat 8 2019-02-14 "ZPM 0.3"
+.SH NAME
+zpm-stat \- run stat
+.SH SYNOPSIS
+.B zpm stat
+[
+.BI -f " format"
+]
+[
+.BI -t " timeformat"
+]
+[
+.B -l
+]
+.RI [ path ...]
+.SH DESCRIPTION
+\fBzpm-stat\fR
+prints information from stat(2) to stdout. This program is needed because the
+output from stat(1) is not specified by posix and thus can't be portably parsed
+by shell scripts. Thus zpm-stat provides a consistent interface for zpm
+scripts to use.
+.SH OPTIONS
+.TP
+\-f \fIformat\fR
+Specify an output format. Format strings are printf style strings,
+where conversions are specified beginning with a % character, and %%
+is used to output a literal %. %z will output a zero byte. \\n and \\t
+escape sequences are also recognized. Any other character preceeded
+by a \\ will be output as is.
+.IP
+Available format conversions are:
+y = mtime, s = file size, a = mode in octal, t = a file type string,
+u = numeric user id, U = username, g = numeric group id, G = groupname,
+and n = file name.
+.TP
+\-t \fIformat\fR
+When outputting mtime, pass the given format to strftime. The default
+time format is "%s".
+.TP
+\-l
+Use lstat instead of stat. That is, don't follow symlinks.
+.SH EXAMPLES
+.TP
+zpm stat /etc/passwd
+print the mtime of /etc/passwd in decimal to stdout.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+None.
+.SH ENVIRONMENT
+None.
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
--- /dev/null
+.TH zpm-test 8 2019-02-14 "ZPM 0.3"
+.SH NAME
+zpm-test \- check whether files are zpm databases
+.SH SYNOPSIS
+.B zpm test
+[
+.B -v
+]
+.RI [ path ...]
+.SH DESCRIPTION
+\fBzpm-test\fR
+checks its arguments and returns success if all arguments are zpm databases.
+No check on the schema is performed, a file is considered valid if it is an
+sqlite3 database file with an application id of 0x5A504442 (decimal
+1515209794).
+.SH OPTIONS
+.TP
+\-v
+prints an error message to stderr if a package is not a zpm
+database file.
+.SH EXAMPLES
+.TP
+zpm test foo-1.0-1.zpm
+checks foo-1.0-1.zpm for validity.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+None.
+.SH ENVIRONMENT
+None.
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
[
.B -LAOUnzvpSC
]
- d) localdb="$OPTARG" ;;
- P) packagepath="$OPTARG" ;;
- D) packagepath="$OPTARG:$packagepath" ;;
- R) rootdir="$OPTARG" ;;
-
- b) backup=1 ;;
- B) backup=0 ;;
- l) justlist=1 ;;
.RI [ \fB[+|-]\fIpackage ...]
.SH DESCRIPTION
\fBzpm-update\fR changes the set of installed packages.
the same time, rather than taking each package one at a time and installing,
updating, or removing it. If the admin wants to do the packages one at a time,
zpm-update can be run multiple times.
+.PP
+Either the package update process, or package scripts may
+put notes in the database with information for the sysadmin.
+zpm-note should be run after updates to check for these.
.SS Package Search
Packages will be searched for in *.repo files, the local database, and
in individual zpm package files. These are looked for by default
--- /dev/null
+.TH zpm-verify 8 2019-02-15 "ZPM 0.3"
+.SH NAME
+zpm-verify \- verify installed packages
+.SH SYNOPSIS
+.B zpm verify
+[
+.BI -f " pkgfile"
+]
+.RI [ package ...]
+.SH DESCRIPTION
+\fBzpm-verify\fR
+Will check installed files against the metadata recorded in the
+local database. For each package given, file size, permissions,
+ownership, and content will be checked.
+.SH OPTIONS
+.TP
+.BI \-f path
+specify the package file to find package metadata in
+.SH EXAMPLES
+.TP
+.B zpm verify less-543-1
+Check the less-543-1 package.
+.SH EXIT STATUS
+0 on success non zero on failure
+.SH FILES
+/var/lib/zpm/local.db
+.SH ENVIRONMENT
+ZPMDB
+.SH AUTHOR
+Nathan Wagner
+.SH SEE ALSO
+.BR zpm (8)
-.TH zpm 8 2018-12-07 "ZPM 0.3"
+.TH zpm 8 2019-02-15 "ZPM 0.3"
.SH NAME
zpm \- the ultimate package manager
.SH SYNOPSIS
(or $ZPMTRUSTDB, or ~/.zpm/trustdb, or via command line).
.PP
zpm-checksignature -t trustdbfile
+.SS Library Handling
+ZPM understands ELF files, and will automatically calculate elf library
+dependencies.
.SH OPTIONS
\-P \fIpath\fR sets a path to the sub-command executables
.SH EXAMPLES
.B zpm init \fIpkgfile\fR
.B zpm list \fIpkgfile\fR
+.SH GLOSSARY
+.TP
+default database
+Many commands take a database to work on. If not specified via a command
+line option, a path to the database is taken from the ZPMDB environment
+variable of, if that is not set, /var/lib/zpm/local.db is used.
.SH EXIT STATUS
0 on success non zero on failure
.SH FILES
likely contain code from the C library and are subject to any licensing
requirements that implies. Where possible, programs have been statically
linked with musl rather than glibc, since glibc doesn't actually support
-static linking. See https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT for
-the musl copyright.
+static linking. For the musl copyright see https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT.
.SH SEE ALSO
.BR zpm-contents (8)
.BR zpm-list (8)
.BR zpm-quote (8)
.BR zpm-hash (8)
.BR zpm-fetchurl (8)
+.BR zpm-soname (8)
+.BR zpm-soneed (8)
+.BR zpm-elftype (8)
+.BR zpm-merge (8)
+.BR zpm-shell (8)
+.BR zpm-extract (8)
+.BR zpm-init (8)
+.BR zpm-sign (8)
+.BR zpm-verify (8)
+.BR zpm-parse (8)
+.BR zpm-test (8)
+.BR zpm-stat (8)
+.BR zpm-log (8)
+.BR zpm-rmpackage (8)
+.BR zpm-packagehash (8)
return s;
}
-void stat_one(char *fmt, char *timefmt, char *filename, struct stat *buf) {
+void stat_one(char *fmt, char *timefmt, int zeroterm, char *filename, struct
+ stat *buf) {
struct tm *tm;
char timestr[1024];
struct format_string f;
fmt = format_string_parse(fmt, &f);
if (!f.found) break; /* done */
if (!f.flags) {
+ if (f.found == '\\') {
+ switch (*fmt) {
+ case 0:
+ continue; break;
+ case 'n':
+ putchar('\n'); break;
+ case 't':
+ putchar('\t'); break;
+ default:
+ putchar(*fmt);
+ break;
+ }
+ fmt++;
+ continue;
+ }
/* literal/noformat */
putchar(f.found); /* or whatever */
continue;
case 'n':
printf("%s", filename);
break;
+ case 'z':
+ putchar(0); break;
case '%':
putchar('%');
break;
break;
}
}
- putchar('\n');
+ if (zeroterm & 2) {
+ return;
+ }
+
+ if (zeroterm & 1 ) {
+ putchar(0);
+ } else {
+ putchar('\n');
+ }
}
int main(int ac, char *av[]) {
int errflg = 0;
int c;
int uselstat = 0;
+ int zeroterm = 0;
- while ((c = getopt(ac, av, "lf:t:")) != -1) {
+ while ((c = getopt(ac, av, "lf:t:0")) != -1) {
switch(c) {
case 'f':
fmt = optarg;
"Option -%c requires an operand\n", optopt);
errflg++;
break;
+ case 'z':
+ zeroterm |= 2;
+ case '0':
+ zeroterm |= 1;
+ break;
case 'l':
uselstat = 1;
break;
} else {
stat(av[optind], &buf);
}
- stat_one(fmt, timefmt, av[optind], &buf);
+ stat_one(fmt, timefmt, zeroterm, av[optind], &buf);
}
return 0;
}