1818#include <stdlib.h>
1919#include <stdio.h>
2020#ifndef _WIN32
21+ # include <libgen.h>
2122# include <unistd.h>
2223#else
2324# include "perflib/getopt.h"
@@ -246,12 +247,13 @@ static void do_hash_evp_shared(size_t num)
246247
247248static void print_help ()
248249{
249- printf ("Usage: evp_hash [-h] [-t] [-o operation] [-u update-times] [-a algorithm] thread-count\n" );
250+ printf ("Usage: evp_hash [-h] [-t] [-o operation] [-u update-times] [-a algorithm] [-V] thread-count\n" );
250251 printf ("-h - print this help output\n" );
251252 printf ("-t - terse output\n" );
252253 printf ("-o operation - mode of operation. One of [deprecated, evp_isolated, evp_shared] (default: evp_shared)\n" );
253254 printf ("-u update-times - times to update digest. 1 for one-shot (default: 1)\n" );
254255 printf ("-a algorithm - One of: [SHA1, SHA224, SHA256, SHA384, SHA512] (default: SHA1)\n" );
256+ printf ("-V - print version information and exit\n" );
255257 printf ("thread-count - number of threads\n" );
256258}
257259
@@ -263,7 +265,7 @@ int main(int argc, char *argv[])
263265 int terse = 0 , operation = EVP_SHARED , hash_algorithm = SHA1_ALG ;
264266 int j , opt , rc = EXIT_FAILURE ;
265267
266- while ((opt = getopt (argc , argv , "hto:u:a:" )) != -1 ) {
268+ while ((opt = getopt (argc , argv , "hto:u:a:V " )) != -1 ) {
267269 switch (opt ) {
268270 case 't' :
269271 terse = 1 ;
@@ -305,6 +307,10 @@ int main(int argc, char *argv[])
305307 goto out ;
306308 }
307309 break ;
310+ case 'V' :
311+ perflib_print_version (basename (argv [0 ]));
312+ rc = EXIT_SUCCESS ;
313+ goto out ;
308314 case 'h' :
309315 default :
310316 print_help ();
0 commit comments