1ebfedea0SLionel Sambuc #include <stdio.h>
2ebfedea0SLionel Sambuc #include <stdlib.h>
3ebfedea0SLionel Sambuc #include <string.h>
4ebfedea0SLionel Sambuc #include <ctype.h>
5ebfedea0SLionel Sambuc #include <openssl/e_os2.h>
6ebfedea0SLionel Sambuc #include <openssl/buffer.h>
7ebfedea0SLionel Sambuc #include <openssl/crypto.h>
8ebfedea0SLionel Sambuc
main(int argc,char * argv[])9ebfedea0SLionel Sambuc int main(int argc, char *argv[])
10ebfedea0SLionel Sambuc {
11ebfedea0SLionel Sambuc char *p, *q = 0, *program;
12ebfedea0SLionel Sambuc
13ebfedea0SLionel Sambuc p = strrchr(argv[0], '/');
14*0a6a1f1dSLionel Sambuc if (!p)
15*0a6a1f1dSLionel Sambuc p = strrchr(argv[0], '\\');
16ebfedea0SLionel Sambuc #ifdef OPENSSL_SYS_VMS
17*0a6a1f1dSLionel Sambuc if (!p)
18*0a6a1f1dSLionel Sambuc p = strrchr(argv[0], ']');
19*0a6a1f1dSLionel Sambuc if (p)
20*0a6a1f1dSLionel Sambuc q = strrchr(p, '>');
21*0a6a1f1dSLionel Sambuc if (q)
22*0a6a1f1dSLionel Sambuc p = q;
23*0a6a1f1dSLionel Sambuc if (!p)
24*0a6a1f1dSLionel Sambuc p = strrchr(argv[0], ':');
25ebfedea0SLionel Sambuc q = 0;
26ebfedea0SLionel Sambuc #endif
27*0a6a1f1dSLionel Sambuc if (p)
28*0a6a1f1dSLionel Sambuc p++;
29*0a6a1f1dSLionel Sambuc if (!p)
30*0a6a1f1dSLionel Sambuc p = argv[0];
31*0a6a1f1dSLionel Sambuc if (p)
32*0a6a1f1dSLionel Sambuc q = strchr(p, '.');
33*0a6a1f1dSLionel Sambuc if (p && !q)
34*0a6a1f1dSLionel Sambuc q = p + strlen(p);
35ebfedea0SLionel Sambuc
36ebfedea0SLionel Sambuc if (!p)
37ebfedea0SLionel Sambuc program = BUF_strdup("(unknown)");
38*0a6a1f1dSLionel Sambuc else {
39ebfedea0SLionel Sambuc program = OPENSSL_malloc((q - p) + 1);
40ebfedea0SLionel Sambuc strncpy(program, p, q - p);
41ebfedea0SLionel Sambuc program[q - p] = '\0';
42ebfedea0SLionel Sambuc }
43ebfedea0SLionel Sambuc
44ebfedea0SLionel Sambuc for (p = program; *p; p++)
45ebfedea0SLionel Sambuc if (islower((unsigned char)(*p)))
46ebfedea0SLionel Sambuc *p = toupper((unsigned char)(*p));
47ebfedea0SLionel Sambuc
48ebfedea0SLionel Sambuc q = strstr(program, "TEST");
49*0a6a1f1dSLionel Sambuc if (q > p && q[-1] == '_')
50*0a6a1f1dSLionel Sambuc q--;
51ebfedea0SLionel Sambuc *q = '\0';
52ebfedea0SLionel Sambuc
53ebfedea0SLionel Sambuc printf("No %s support\n", program);
54ebfedea0SLionel Sambuc
55ebfedea0SLionel Sambuc OPENSSL_free(program);
56ebfedea0SLionel Sambuc return (0);
57ebfedea0SLionel Sambuc }
58