handle zero size Base64 conversions
[strongswan.git] / src / _copyright / _copyright.c
1 /*
2 * copyright reporter
3 * (just avoids having the info in more than one place in the source)
4 * Copyright (C) 2001 Henry Spencer.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 #include <sys/types.h>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <unistd.h>
22 #include <getopt.h>
23
24 #include <freeswan.h>
25 #include <library.h>
26
27 char usage[] = "Usage: ipsec _copyright";
28 struct option opts[] = {
29 {"help", 0, NULL, 'h',},
30 {"version", 0, NULL, 'v',},
31 {0, 0, NULL, 0, },
32 };
33
34 char me[] = "ipsec _copyright"; /* for messages */
35
36 int
37 main(int argc, char *argv[])
38 {
39 int opt;
40 extern int optind;
41 int errflg = 0;
42 const char **notice = ipsec_copyright_notice();
43 const char **co;
44
45 library_init(NULL);
46 atexit(library_deinit);
47
48 while ((opt = getopt_long(argc, argv, "", opts, NULL)) != EOF)
49 switch (opt) {
50 case 'h': /* help */
51 printf("%s\n", usage);
52 exit(0);
53 break;
54 case 'v': /* version */
55 printf("%s strongSwan "VERSION"\n", me);
56 exit(0);
57 break;
58 case '?':
59 default:
60 errflg = 1;
61 break;
62 }
63 if (errflg || optind != argc) {
64 fprintf(stderr, "%s\n", usage);
65 exit(2);
66 }
67
68 for (co = notice; *co != NULL; co++)
69 printf("%s\n", *co);
70 exit(0);
71 }