hashsum: improve help

This commit is contained in:
Steffen Jaeckel 2017-09-21 16:15:32 +02:00
parent eb75c894db
commit 5bb63f1bca

View File

@ -47,13 +47,15 @@ static void die(int status)
{ {
unsigned long w, x; unsigned long w, x;
FILE* o = status == EXIT_SUCCESS ? stdout : stderr; FILE* o = status == EXIT_SUCCESS ? stdout : stderr;
fprintf(o, "usage: %s -a algorithm [-c] [file...]\n", hashsum); fprintf(o, "usage: %s -a algorithm [-c] [file...]\n\n", hashsum);
fprintf(o, "Algorithms:\n"); fprintf(o, "\t-c\tCheck the hash(es) of the file(s) written in [file].\n");
fprintf(o, "\t\t(-a not required)\n");
fprintf(o, "\nAlgorithms:\n\t");
w = 0; w = 0;
for (x = 0; hash_descriptor[x].name != NULL; x++) { for (x = 0; hash_descriptor[x].name != NULL; x++) {
w += fprintf(o, "%-14s", hash_descriptor[x].name); w += fprintf(o, "%-14s", hash_descriptor[x].name);
if (w >= 70) { if (w >= 70) {
fprintf(o, "\n"); fprintf(o, "\n\t");
w = 0; w = 0;
} }
} }