1 karl 1.5 //%2006////////////////////////////////////////////////////////////////////////
|
2 karl 1.2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.5 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 karl 1.2 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 carson.hovey 1.6 //
|
21 karl 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
|
31 carson.hovey 1.6 //
32 // This example of how to call lib$initialize from C++ was taken
33 // from the internal notes file: cxxc_bugs 11466.4
34 //
35 #include <unixlib.h> // decc$feature_get_index(), set_value()
36 #include <stdio.h> // perror()
37 #include <errno.h> // errno
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
|
42 gs.keenan 1.1
43
|
44 carson.hovey 1.6 typedef void (*fptr_t)(void);
|
45 gs.keenan 1.1
|
46 carson.hovey 1.6 void LIB$INITIALIZE();
|
47 gs.keenan 1.1
48 //
49 // Sets current value for a feature
50 //
51 static void set(char *name, int value)
52 {
53 int index;
54 errno = 0;
55
56 index = decc$feature_get_index(name);
57
58 if (index == -1 ||
59 (decc$feature_set_value(index, 1, value) == -1 &&
60 errno != 0))
61 {
62 perror(name);
63 }
64 }
65
66 static void set_coe(void)
67 {
68 gs.keenan 1.1 set ("DECC$ARGV_PARSE_STYLE", TRUE);
|
69 gs.keenan 1.3 set ("DECC$ENABLE_GETENV_CACHE", TRUE);
|
70 gs.keenan 1.1 set ("DECC$FILE_SHARING", TRUE);
71 set ("DECC$DISABLE_TO_VMS_LOGNAME_TRANSLATION", TRUE);
72 set ("DECC$EFS_CASE_PRESERVE", TRUE);
73 set ("DECC$EFS_CHARSET", TRUE);
74 set ("DECC$EFS_FILE_TIMESTAMPS", TRUE);
75 set ("DECC$FILENAME_UNIX_NO_VERSION", TRUE);
|
76 carson.hovey 1.6 #if !defined FILENAME_UNIX_REPORT_FALSE
|
77 gs.keenan 1.1 set ("DECC$FILENAME_UNIX_REPORT", TRUE);
|
78 carson.hovey 1.6 #else
79 set ("DECC$FILENAME_UNIX_REPORT", FALSE);
80 #endif
|
81 gs.keenan 1.1 set ("DECC$FILE_OWNER_UNIX", TRUE);
82 set ("DECC$FILE_PERMISSION_UNIX", TRUE);
83 set ("DECC$READDIR_DROPDOTNOTYPE", TRUE);
|
84 gs.keenan 1.4 set ("DECC$FILENAME_UNIX_ONLY", FALSE);
|
85 gs.keenan 1.1 set ("DECC$UMASK", 027);
86 }
87
88
|
89 carson.hovey 1.6 fptr_t x = LIB$INITIALIZE;
|
90 gs.keenan 1.1
91 #pragma extern_model save
92
|
93 carson.hovey 1.6 #pragma extern_model strict_refdef "LIB$INITIALIZD_" gbl,noexe,nowrt,noshr,long
94 extern const fptr_t y = set_coe;
|
95 gs.keenan 1.1
96 #pragma extern_model restore
97
|
98 carson.hovey 1.6 #ifdef __cplusplus
99 } // extern "C"
100 #endif
101
|