diff --git a/tarsum.c b/tarsum.c index 052da7c..6951ab0 100644 [/color]--- a/tarsum.c +++ b/tarsum.c @@ -280,7 +280,9 @@ enum tarsum_errors { TARSUM_ELAST, }; -#define TARSUM_F_DEFAULT "%C %N\\n" +#define TARSUM_F_DEFAULT "%A (%N) = %C\\n" +#define TARSUM_F_NONBSD "%C %N\\n" +#define TARSUM_F_SUM_ONLY "%C\\n" /* * glibc 2.27: %a %b %e %H:%M:%S %Y * macOS 10.14: %a %b %e %X %Y @@ -1244,7 +1246,7 @@ optspush(const char ***opts, size_t *optc, const char *opt) return *opts = p; } -#define SHORTOPTS "a:f:s:t:h" +#define SHORTOPTS "a:f:s:t:qnh" static void usage(const char *arg0, const struct tarsumopts *opts, FILE *fp) { @@ -1256,6 +1258,8 @@ usage(const char *arg0, const struct tarsumopts *opts, FILE *fp) " -f FORMAT format specification (default: \"%s\")\n" \ " -s SUBEXPR path substitution expression\n" \ " -t TIMEFMT strftime format specification (default: \"%s\")\n" \ + " -q print digest only (\"%s\")\n" \ + " -n use non-BSD format specification (\"%s\")\n" \ " -h print this usage message\n" \ "\n" \ "FORMAT (see printf(1) and BSD stat(1))\n" \ @@ -1274,7 +1278,7 @@ usage(const char *arg0, const struct tarsumopts *opts, FILE *fp) " %%z file size (%%Hz: header record(s), %%Lz: header and file records)\n" \ "\n" \ "Report bugs to <william@25thandClement.com>\n", - progname, EVP_MD_name(opts->mdtype), opts->format, opts->timefmt); + progname, EVP_MD_name(opts->mdtype), opts->format, opts->timefmt, TARSUM_F_SUM_ONLY, TARSUM_F_NONBSD); } int @@ -1302,6 +1306,12 @@ main(int argc, char **argv) case 'f': opts.format = optarg; break; + case 'q': + opts.format = TARSUM_F_SUM_ONLY; + break; + case 'n': + opts.format = TARSUM_F_NONBSD; + break; case 's': optspush(&subexprs, &nsubexpr, optarg); [color=#000000] break; |