1 /*
2 * usage.c
3 *
4 * $Id: usage.c 62 2017-08-28 21:38:50Z diraison $
5 *
6 * This file is part of the btcheck project (c) 2008-2009 distributed
7 * under the GNU GPLv3 license and created by Jean Diraison
8 * <jean.diraison@ac-rennes.fr>
9 *
10 * URL: http://sourceforge.net/projects/btcheck/
11 *
12 */
13
14 #include "config.h"
15
16 #include <stdio.h>
17 #include <stdlib.h>
18
19 #ifndef PACKAGE_NAME
20 #define PACKAGE_NAME "btcheck"
21 #endif
22 #ifndef VERSION
23 #define VERSION "unknown"
24 #endif
25
26 #ifdef WITH_OPENSSL
27 #define SHA1_SUPPORT "OpenSSL crypto library"
28 #endif
29 #ifdef WITH_POLARSSL
30 #define SHA1_SUPPORT "mbedTLS/PolarSSL crypto library"
31 #endif
32 #ifdef WITH_GNUTLS
33 #define SHA1_SUPPORT "GnuTLS library"
34 #endif
35 #ifdef WITH_GCRYPT
36 #define SHA1_SUPPORT "libgcrypt crypto library"
37 #endif
38 #ifdef WITH_TOMCRYPT
39 #define SHA1_SUPPORT "tomcrypt library"
40 #endif
41 #ifdef WITH_NETTLE
42 #define SHA1_SUPPORT "Nettle crypto library"
43 #endif
44 #ifdef WITH_BEECRYPT
45 #define SHA1_SUPPORT "BeeCrypt library"
46 #endif
47 #ifdef WITH_KERNEL_CRYPTO_API
48 #define SHA1_SUPPORT "Linux Kernel Crypto API"
49 #endif
50 #ifdef WITH_WINDOWS_CRYPTOAPI
51 #define SHA1_SUPPORT "Windows CryptoAPI"
52 #endif
53 #ifndef SHA1_SUPPORT
54 #define SHA1_SUPPORT "built-in SHA1 algorithm"
55 #endif
56
57
version()58 void version()
59 {
60 fprintf(stderr, "%s version %s (%s) using %s\n", PACKAGE_NAME, VERSION, CANONICAL_HOST, SHA1_SUPPORT);
61 exit(EXIT_SUCCESS);
62 }
63
usage(char * progname,int code)64 void usage(char *progname, int code)
65 {
66 fprintf(stderr, "usage: %s [-h] [-V] [-v] [-q] [-z] [-n] [-i] [-l] file.torrent\n", progname);
67 fprintf(stderr, "\t\t-h: show this help.\n");
68 fprintf(stderr, "\t\t-V: show version number.\n");
69 fprintf(stderr, "\t\t-v: verbose output.\n");
70 fprintf(stderr, "\t\t-q: quiet, no output.\n");
71 fprintf(stderr, "\t\t-z: fill missing data with zeros.\n");
72 fprintf(stderr, "\t\t-n: do not check data (useful whith -i option and default with -l).\n");
73 fprintf(stderr, "\t\t-i: show content information of the given torrent file.\n");
74 fprintf(stderr, "\t\t-l: list filenames in the given torrent file and don't check data.\n");
75 exit(code);
76 }
77