added RCSID
[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 * RCSID $Id$
17 */
18
19 #include <sys/types.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <unistd.h>
24 #include <getopt.h>
25 #include <freeswan.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 *version = ipsec_version_code();
43 const char **notice = ipsec_copyright_notice();
44 const char **co;
45
46 while ((opt = getopt_long(argc, argv, "", opts, NULL)) != EOF)
47 switch (opt) {
48 case 'h': /* help */
49 printf("%s\n", usage);
50 exit(0);
51 break;
52 case 'v': /* version */
53 printf("%s %s\n", me, version);
54 exit(0);
55 break;
56 case '?':
57 default:
58 errflg = 1;
59 break;
60 }
61 if (errflg || optind != argc) {
62 fprintf(stderr, "%s\n", usage);
63 exit(2);
64 }
65
66 for (co = notice; *co != NULL; co++)
67 printf("%s\n", *co);
68 exit(0);
69 }