00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #define _POSIX_SOURCE
00079 #ifdef CKVERS_UNIX98
00080 #define _XOPEN_SOURCE 500
00081 #elif CKVERS_SUSV3
00082 #define _XOPEN_SOURCE 600
00083 #else
00084 #define _XOPEN_SOURCE
00085 #define _XOPEN_SOURCE_EXTENDED 1
00086 #endif
00087
00088 #include <unistd.h>
00089 #include <stdio.h>
00090 #ifdef _POSIX_VERSION
00091 #include <sys/utsname.h>
00092 #endif
00093
00094
00095 #ifdef TESTBED
00096 #undef _XOPEN_XCU_VERSION
00097 #define _XOPEN_VERSION 600
00098 #define _POSIX_VERSION 200112L
00099 #define _POSIX2_VERSION 200112L
00100 #endif
00101
00102 #define CKVERS_VERSION "Ckvers Release 2.0 16-Sept-2002"
00103
00104 int main(void)
00105 {
00106 int ckvers_posix, ckvers_xsh, ckvers_xcu, ckvers_xopen_unix =0;
00107 int ckvers_posix2clb, ckvers_posix2 =0;
00108 #ifdef _POSIX_VERSION
00109 struct utsname ckvers_unames;
00110 #endif
00111
00112 (void) printf("\t\t%s\n\t\tSUMMARY REPORT\n\n",CKVERS_VERSION);
00113
00114 #ifdef _POSIX_VERSION
00115 if (uname(&ckvers_unames) != -1)
00116 {
00117 (void) printf("\tSystem: %s %s %s %s %s\n",
00118 ckvers_unames.sysname, ckvers_unames.nodename,
00119 ckvers_unames.release, ckvers_unames.version,
00120 ckvers_unames.machine);
00121 }
00122
00123 #ifdef CKVERS_UNIX98
00124 (void) printf("\n\tNotice: Compiled to check for UNIX 98 claims\n");
00125 (void) printf("\tIf warnings occur, recompile with -DCKVERS_SUSV3\n");
00126 (void) printf("\tor without any version symbol.\n");
00127 #elif CKVERS_SUSV3
00128 (void) printf("\n\tNotice: Compiled to check for SUS v3 claims\n");
00129 (void) printf("\tIf warnings occur, recompile with -DCKVERS_UNIX98\n");
00130 (void) printf("\tor without any version symbol.\n");
00131 #endif
00132
00133 (void) printf("\n\tPOSIX SUPPORT: ");
00134
00135 switch (_POSIX_VERSION) {
00136
00137 case 199009L:
00138 (void) printf("IEEE Std POSIX.1-1990/ISO 9945-1:1990\n");
00139 ckvers_posix=1990;
00140 break;
00141 case 198808L:
00142 (void) printf("IEEE Std POSIX.1-1988\n");
00143 ckvers_posix=1988;
00144 break;
00145 case 199309L:
00146 (void) printf("IEEE Std POSIX.1b-1993 [Realtime]\n");
00147 ckvers_posix=1993;
00148 break;
00149 case 199506L:
00150 (void) printf("IEEE Std POSIX.1-1996/ISO 9945-1:1996\n");
00151 ckvers_posix=1995;
00152 break;
00153 case 200112L:
00154
00155
00156
00157
00158
00159
00160
00161
00162 (void) printf("IEEE Std POSIX.1-2001\n");
00163 ckvers_posix=2001;
00164 break;
00165 default:
00166 (void) printf("Unknown _POSIX_VERSION=%ldL\n", _POSIX_VERSION);
00167 }
00168
00169
00170 #if (_XOPEN_VERSION - 600 == 0) || (_POSIX_VERSION == 200112L )
00171
00172
00173
00174
00175
00176 (void) printf("\tFor POSIX 1003.1-2001:\n\t\tthe former ISO POSIX.2 C Language Binding is required.\n");
00177 #else
00178 (void) printf("\tPOSIX.2 C Language Binding: ");
00179
00180 #ifdef _POSIX2_C_VERSION
00181 if ( _POSIX2_C_VERSION == 199209L ) {
00182 ckvers_posix2clb = 1;
00183 (void) printf("supported\n");
00184 }
00185 else
00186 (void) printf("not supported\n");
00187 #else
00188 (void) printf("not supported\n");
00189 #endif
00190 #endif
00191
00192 (void) printf("\tPOSIX Shell & Utilities: ");
00193 #ifdef _POSIX2_VERSION
00194
00195
00196
00197 if ( _POSIX2_VERSION == 199209L ) {
00198 ckvers_posix2 = 1;
00199 (void) printf("ISO POSIX 1003.2-1993 supported\n");
00200 }
00201 else if ( _POSIX2_VERSION == 200112L ) {
00202 ckvers_posix2 = 2001;
00203 (void) printf("POSIX 1003.1-2001 Shell & Utilities\n");
00204 }
00205 else
00206 (void) printf("not supported\n");
00207 #else
00208 (void) printf("not supported\n");
00209 #endif
00210
00211
00212 #else
00213 (void) printf("\n\tPOSIX is not supported\n");
00214 #endif
00215
00216
00217 (void) printf("\n\tX/OPEN SUPPORT:\n");
00218 #ifdef _XOPEN_VERSION
00219 (void) printf("\tSYSTEM INTERFACES & HEADERS: ");
00220 switch (_XOPEN_VERSION) {
00221
00222 case 3:
00223 (void) printf("XPG3\n");
00224 ckvers_xsh=3;
00225 break;
00226 case 4:
00227 (void) printf("XPG4\n");
00228 ckvers_xsh=4;
00229 break;
00230 case 500:
00231 (void) printf("XSH 5 claimed for UNIX 98\n");
00232 ckvers_xsh=500;
00233 break;
00234 case 600:
00235 (void) printf("XSH 6 claimed for SUS v.3\n");
00236 ckvers_xsh=600;
00237 break;
00238 default:
00239 (void) printf("Unknown _XOPEN_VERSION=%d\n", _XOPEN_VERSION);
00240 }
00241 #else
00242 (void) printf("\tSYSTEM INTERFACES & HEADERS NOT SUPPORTED\n");
00243 #endif
00244
00245
00246 #if (_XOPEN_VERSION - 600 == 0)
00247 (void) printf("\tCOMMANDS & UTILITIES: ");
00248
00249
00250
00251
00252 ckvers_xcu=6;
00253 (void) printf("XCU6/IEEE Std POSIX 1003.1-2001\n");
00254
00255 #elif _XOPEN_XCU_VERSION
00256 (void) printf("\tCOMMANDS & UTILITIES: ");
00257 switch (_XOPEN_XCU_VERSION) {
00258
00259 case 3:
00260 (void) printf("XPG3/ XPG4 Historical Commands\n");
00261 ckvers_xcu=3;
00262 break;
00263 case 4:
00264 (void) printf("XPG4/IEEE Std POSIX.2-1992/ISO 9945-2:1993\n");
00265 ckvers_xcu=4;
00266 break;
00267 case 5:
00268 (void) printf("XCU5/IEEE Std POSIX.2-1992/ISO 9945-2:1993\n");
00269 ckvers_xcu=5;
00270 break;
00271 default:
00272 (void) printf("Unknown _XOPEN_XCU_VERSION=%d\n", _XOPEN_XCU_VERSION);
00273 break;
00274 }
00275 #endif
00276 if (( ckvers_xcu >= 4 ) && (ckvers_posix2 < 1) )
00277 (void) printf("\tWarning: POSIX Shell & Utilities not supported, but required when XCU 4 or later is claimed (%ld)\n\n", _POSIX_VERSION);
00278 else if (ckvers_xcu == 0)
00279 (void) printf("\tCOMMANDS & UTILITIES NOT SUPPORTED\n");
00280
00281
00282 #ifdef _XOPEN_UNIX
00283 (void) printf("\tX/OPEN UNIX SUPPORT IS CLAIMED\n");
00284 ckvers_xopen_unix=1;
00285 #else
00286 (void) printf("\tX/OPEN UNIX is not supported\n");
00287 #endif
00288
00289
00290
00291
00292
00293 #if (_XOPEN_VERSION - 600 == 0)
00294
00295 if ( ckvers_xopen_unix == 1 ) {
00296
00297 if ( ckvers_xsh == 600) {
00298 if ( ckvers_posix < 2001) {
00299 (void) printf("\tWarning: Invalid value found for POSIX support (%ld) when XSH6 support (for SUS v.3) is claimed\n", _POSIX_VERSION);
00300 (void) printf("\tWarning: Expected _POSIX_VERSION equals 200112L , got %ld\n", _POSIX_VERSION);
00301 }
00302 if ( (ckvers_posix2 < 2001))
00303 (void) printf("\tWarning: Unexpected value found for Commands & Utilities (%d) when XCU6 is claimed\n", _POSIX2_VERSION);
00304 (void) printf("\tWarning: Expected _POSIX2_VERSION equals 200112L , got %ld\n", _POSIX2_VERSION);
00305 }
00306
00307 (void) printf("\n\tIf there are no Warnings output above, then");
00308
00309 (void) printf("\n\tThis could be a UNIX system conforming to the Single UNIX Specification Version 3");
00310 (void) printf("\n\tPlease check the branded products catalogue for confirmation\n\thttp://www.opengroup.org/regproducts/\n");
00311 }
00312
00313 #elif (defined(_POSIX_SOURCE) && defined(_XOPEN_SOURCE) && defined(_XOPEN_XCU_VERSION) && defined(_XOPEN_VERSION))
00314
00315 if ( ckvers_xopen_unix == 1 ) {
00316
00317 if ( ckvers_xcu != 4 && ckvers_xcu != 5 ) {
00318 (void) printf("\tWarning: Invalid value found for Commands & Utilities (%d) when X/OPEN UNIX is claimed\n", _XOPEN_XCU_VERSION);
00319 }
00320 if ( ckvers_xsh != 4 && ckvers_xsh != 500 && ckvers_xsh != 600)
00321 (void) printf("\tWarning: Invalid value found for System Interfaces & Headers (%d) when X/OPEN UNIX is claimed\n", _XOPEN_VERSION);
00322 if ( ckvers_posix < 1990 )
00323 (void) printf("\tWarning: Invalid value found for POSIX support (%ld) when X/OPEN UNIX is claimed\n", _POSIX_VERSION);
00324 if ( ckvers_posix2clb < 1 )
00325 (void) printf("\tWarning: POSIX.2 CLB not supported, but required when X/OPEN UNIX is claimed (%ld)\n\n", _POSIX_VERSION);
00326
00327 }
00328
00329 if ( ckvers_xsh == 4) {
00330 if ( ckvers_posix < 1990)
00331 (void) printf("\tWarning: Invalid value found for POSIX support (%ld) when XPG4 is claimed\n", _POSIX_VERSION);
00332
00333 if ( (ckvers_xcu != 3) && (ckvers_xcu != 4))
00334 (void) printf("\tWarning: Invalid value found for Commands & Utilities (%d) when XPG4 is claimed\n", _XOPEN_XCU_VERSION);
00335
00336 }
00337 if ( ckvers_xsh == 500) {
00338 if ( ckvers_posix < 1995)
00339 (void) printf("\tWarning: Invalid value found for POSIX support (%ld) when XSH5 support (for UNIX 98) is claimed\n", _POSIX_VERSION);
00340 if ( (ckvers_xcu != 5)) {
00341 (void) printf("\tWarning: Unexpected value found for Commands & Utilities (%d) when XSH5 is claimed\n", _XOPEN_XCU_VERSION);
00342 (void) printf("\tWarning: Expected _XOPEN_XCU_VERSION equals 5 , got %ld\n", (long)_XOPEN_XCU_VERSION);
00343 }
00344 }
00345
00346 if ( ckvers_xopen_unix == 1 ) {
00347
00348 (void) printf("\n\tIf there are no Warnings output above, then");
00349
00350 (void) printf("\n\tThis could be a UNIX system conforming to the Single UNIX Specification");
00351 #if _XOPEN_VERSION - 500 == 0
00352 (void) printf(", Version 2\n");
00353 #else
00354 (void) printf("\n");
00355 #endif
00356 (void) printf("\n\tPlease check the branded products catalogue for confirmation\n\thttp://www.opengroup.org/regproducts/\n");
00357 } else {
00358
00359 if (ckvers_xsh == 4) {
00360 if ( ckvers_xcu == 3 )
00361 (void) printf("\n\tThis could be an XPG4 Base system\n");
00362 else if (ckvers_xcu == 4)
00363 (void) printf("\n\tThis could be an XPG4 Base or XPG4 Base 95 system\n");
00364 (void) printf("\n\tPlease check the branded products catalogue for confirmation\n\thttp://www.opengroup.org/regproducts/\n");
00365 }
00366 else if (ckvers_xsh == 3) {
00367 (void) printf("\n\tThis could be an XPG3 Base system\n");
00368 (void) printf("\n\tPlease check the branded products catalogue for confirmation\n\thttp://www.opengroup.org/regproducts/\n");
00369 }
00370 }
00371 #endif
00372 return 0;
00373 }
00374