This file is indexed.

/var/lib/pcp/testsuite/src/chkhelp.c is in pcp-testsuite 3.8.12ubuntu1.

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
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
/*
 * Copyright (c) 1997-2001 Silicon Graphics, Inc.  All Rights Reserved.
 */

/*
 * exercise the help facilities
 */

#include <unistd.h>
#include <ctype.h>
#include <pcp/pmapi.h>

int
main()
{
    int		i;
    int		j;
    char	*namelist[2];
    pmID	pmidlist[2];
    int		n;
    int		numpmid;
    char	*buf;
    pmDesc	desc;

    if ((n = pmLoadNameSpace(PM_NS_DEFAULT)) < 0) {
	fprintf(stderr, "pmLoadNameSpace: %s\n", pmErrStr(n));
	exit(1);
    }

    if ((n = pmNewContext(PM_CONTEXT_HOST, "localhost")) < 0) {
	fprintf(stderr, "pmNewContext(..., \"localhost\"): %s\n",
		pmErrStr(n));
	exit(1);
    }

    i = 0;
    namelist[i++] = "sample.colour";
    namelist[i++] = "sample.byte_ctr";
    numpmid = i;
    n = pmLookupName(numpmid, namelist, pmidlist);
    if (n != numpmid) {
	fprintf(stderr, "pmLookupName: %s\n", pmErrStr(n));
	for (i = 0; i < numpmid; i++) {
	    if (pmidlist[i] == PM_ID_NULL)
		fprintf(stderr, "	%s - not known\n", namelist[i]);
	}
	exit(1);
    }

    for (j = 0; j < 3; j++) {
	/* default context (j==0) then NewContext(j==1) then DupContext(j==2) */
	for (i = 0; i < numpmid; i++) {
	    if (j == 0)
		fprintf(stderr, "\nDefault Context\n");
	    else if (j == 1) {
		fprintf(stderr, "\nNew Context\n");
		if ((n = pmNewContext(PM_CONTEXT_HOST, "localhost")) < 0) {
		    fprintf(stderr, "pmNewContext: %s\n", pmErrStr(n));
		    exit(1);
		}
	    }
	    else {
		fprintf(stderr, "\nDup Context\n");
		if ((n = pmDupContext()) < 0) {
		    fprintf(stderr, "pmDupContext: %s\n", pmErrStr(n));
		    exit(1);
		}
	    }

	    fprintf(stderr, "metric: %s\n", namelist[i]);
	    if ((n = pmLookupDesc(pmidlist[i], &desc)) < 0) {
		fprintf(stderr, "pmLookupDesc failed: %s\n", pmErrStr(n));
		exit(1);
	    }

	    if ((n = pmLookupText(pmidlist[i], PM_TEXT_ONELINE, &buf)) < 0)
		fprintf(stderr, "pmLookupText: %s\n", pmErrStr(n));
	    else {
		fprintf(stderr, "\nOneline Text: %s\n", buf);
		free(buf);
	    }

	    if ((n = pmLookupInDomText(desc.indom, PM_TEXT_ONELINE, &buf)) < 0)
		fprintf(stderr, "pmLookupInDomText: %s\n", pmErrStr(n));
	    else {
		fprintf(stderr, "\nOneline InDomText: %s\n", buf);
		free(buf);
	    }

	    if ((n = pmLookupText(pmidlist[i], PM_TEXT_HELP, &buf)) < 0)
		fprintf(stderr, "pmLookupText: %s\n", pmErrStr(n));
	    else {
		fprintf(stderr, "\nHelp Text: %s\n", buf);
		free(buf);
	    }

	    if ((n = pmLookupInDomText(desc.indom, PM_TEXT_HELP, &buf)) < 0)
		fprintf(stderr, "pmLookupInDomText: %s\n", pmErrStr(n));
	    else {
		fprintf(stderr, "\nHelp InDomText: %s\n", buf);
		free(buf);
	    }
	}
    }

    exit(0);
}