/var/lib/pcp/testsuite/src/getversion.c is in pcp-testsuite 4.0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | /*
* Copyright (c) 1995-2001 Silicon Graphics, Inc. All Rights Reserved.
* Copyright (c) 2015 Ken McDonell. All Rights Reserved.
*/
#include <pcp/pmapi.h>
int
main(int argc, char **argv)
{
int c;
int sts;
int errflag = 0;
char *str_ver;
char buf[12]; /* enough for XXX.XXX.XXX */
/* trim cmd name of leading directory components */
pmSetProgname(argv[0]);
while ((c = getopt(argc, argv, "D:?")) != EOF) {
switch (c) {
case 'D': /* debug options */
sts = pmSetDebug(optarg);
if (sts < 0) {
fprintf(stderr, "%s: unrecognized debug options specification (%s)\n",
pmGetProgname(), optarg);
errflag++;
}
break;
case '?':
default:
errflag++;
break;
}
}
#if PM_VERSION_CURRENT < PM_VERSION(3,10,5)
fprintf(stderr, "PCP version 0x%x too old, should be >= 0x30a05\n", PM_VERSION_CURRENT);
#else
sts = pmGetVersion();
if (sts != PM_VERSION_CURRENT)
fprintf(stderr, "Botch: header version 0x%x != pmGetVersion() 0x%x\n", PM_VERSION_CURRENT, sts);
else
fprintf(stderr, "pmGetVersion check OK\n");
#endif
str_ver = pmGetConfig("PCP_VERSION");
pmsprintf(buf, sizeof(buf), "%d.%d.%d", (sts&0xff0000)>>16, (sts&0xff00)>>8, (sts&0xff));
if (strcmp(str_ver, buf) != 0)
fprintf(stderr, "Botch: pmGetConfig version %s != pmGetVersion() %s\n", str_ver, buf);
else
fprintf(stderr, "pmGetConfig check OK\n");
return 0;
}
|